You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tcl.apache.org by mx...@apache.org on 2018/12/09 01:36:51 UTC

[tcl-rivet] branch winbuild updated: now building on Windows, but getting garbled data in the conf record

This is an automated email from the ASF dual-hosted git repository.

mxmanghi pushed a commit to branch winbuild
in repository https://gitbox.apache.org/repos/asf/tcl-rivet.git


The following commit(s) were added to refs/heads/winbuild by this push:
     new dc40bcd  now building on Windows, but getting garbled data in the conf record
dc40bcd is described below

commit dc40bcdfbf6bb158061b6411a0e874ab29940777
Author: Massimo Manghi <mx...@apache.org>
AuthorDate: Sun Dec 9 02:36:06 2018 +0100

    now building on Windows, but getting garbled data in the conf record
---
 ChangeLog                            |  5 +++++
 cmake/CMakeLists.txt                 | 41 +++++++++++++++++++++++++-----------
 rivet/pkgIndex.tcl                   |  8 +++----
 src/mod_rivet_ng/TclWebapache.c      |  2 +-
 src/mod_rivet_ng/mod_rivet.c         | 12 ++++++++---
 src/mod_rivet_ng/mod_rivet.h         |  8 ++-----
 src/mod_rivet_ng/mod_rivet_common.c  |  9 +++++++-
 src/mod_rivet_ng/rivet_lazy_mpm.c    |  6 +++---
 src/mod_rivet_ng/rivet_prefork_mpm.c |  1 +
 src/mod_rivet_ng/rivet_worker_mpm.c  |  1 +
 10 files changed, 62 insertions(+), 31 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 384044f..38e2c4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-12-08 Massimo Manghi <mx...@apache.org>
+	* cmake/CMakeList.c: changed suffix of librivetparser.so and librivet.so
+	* src/mod_rivet_ng: various changes to have a compilable module
+	on Windows. Still the module not working tough
+	
 2018-12-04 Massimo Manghi <mx...@apache.org>
     * configure.ac: now infer the version number from VERSION.
     * doc/rivet.xml,doc/xml/examples.xml: modified example "color table"
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 101d367..c68da15 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -123,12 +123,12 @@ set(mod_rivet_sources
 
 #  Add build targets...
 # ===========================================================================
-add_library(mod_rivet            ${mod_rivet_sources})
-add_library(rivetparser          ${rivetparser_sources})
-add_library(rivetlib             ${rivetlib_sources})
-add_library(rivet_worker_mpm     ${rivet_worker_mpm_sources})
-add_library(rivet_prefork_mpm    ${rivet_prefork_mpm_sources})
-add_library(rivet_lazy_mpm       ${rivet_lazy_mpm_sources})
+add_library(mod_rivet            SHARED ${mod_rivet_sources})
+add_library(rivetparser          SHARED ${rivetparser_sources})
+add_library(rivetlib             SHARED ${rivetlib_sources})
+add_library(rivet_worker_mpm     SHARED ${rivet_worker_mpm_sources})
+add_library(rivet_prefork_mpm    SHARED ${rivet_prefork_mpm_sources})
+add_library(rivet_lazy_mpm       SHARED ${rivet_lazy_mpm_sources})
 add_library(rivet::parser        ALIAS rivetparser)
 add_library(rivet::lib           ALIAS rivetparser)
 add_library(rivet::rivet         ALIAS mod_rivet)
@@ -140,8 +140,12 @@ SET_TARGET_PROPERTIES(mod_rivet         PROPERTIES PREFIX "" SUFFIX ".so")
 SET_TARGET_PROPERTIES(rivet_worker_mpm  PROPERTIES PREFIX "" SUFFIX ".so")
 SET_TARGET_PROPERTIES(rivet_prefork_mpm PROPERTIES PREFIX "" SUFFIX ".so")
 SET_TARGET_PROPERTIES(rivet_lazy_mpm    PROPERTIES PREFIX "" SUFFIX ".so")
-SET_TARGET_PROPERTIES(rivetparser       PROPERTIES PREFIX "lib")
-SET_TARGET_PROPERTIES(rivetlib          PROPERTIES PREFIX "lib")
+
+# these definition shouldn't rely on the .so suffix, but use Tcl's 
+# introspection to determine the correct suffix portably
+
+SET_TARGET_PROPERTIES(rivetparser       PROPERTIES PREFIX "lib" SUFFIX ".so")
+SET_TARGET_PROPERTIES(rivetlib          PROPERTIES PREFIX "lib" SUFFIX ".so")
 
 #  Definitions...
 # ===========================================================================
@@ -186,6 +190,19 @@ MESSAGE ( STATUS "  TCL_STUB_LIBRARY:        " ${TCL_STUB_LIBRARY} )
 #  Locate Apache...
 # ===========================================================================
 MESSAGE ( STATUS "Searching for Apache..." )
+
+if (NOT "${with-apache}" STREQUAL "")
+  MESSAGE ( STATUS "  Apache directory manually set by -Dwith-apache=" ${with-apache} )
+  get_filename_component(RIVET_APACHE_ROOT "${with-apache}" ABSOLUTE)
+  MESSAGE ( STATUS "  Setting Apache root to: " ${RIVET_APACHE_ROOT} )
+
+  set ( APACHE_ROOT ${RIVET_APACHE_ROOT} )
+  set ( APACHE_MODULE_DIR "${RIVET_APACHE_ROOT}/modules" )
+  set ( APACHE_LIB_DIR "${RIVET_APACHE_ROOT}/lib" )
+  set ( TclStub_ROOT ${RIVET_APACHE_ROOT})
+
+endif ()
+
 find_package(APACHE REQUIRED)
 MESSAGE ( STATUS "  APACHE_INCLUDE_DIR:      " ${APACHE_INCLUDE_DIR} )
 MESSAGE ( STATUS "  APACHE_MODULE_DIR:       " ${APACHE_MODULE_DIR} )
@@ -253,9 +270,9 @@ if(WIN32)
   #SET_TARGET_PROPERTIES(mod_rivet PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
 
   target_link_libraries(mod_rivet          ${APR_LIBRARY} ${APACHE_HTTPD_LIBRARY} )
-  target_link_libraries(rivet_worker_mpm   ${APR_LIBRARY} ${APRUTIL_LIBRARY} ${APACHE_HTTPD_LIBRARY} mod_rivet)
-  target_link_libraries(rivet_prefork_mpm  ${APR_LIBRARY} ${APACHE_HTTPD_LIBRARY} mod_rivet)
-  target_link_libraries(rivet_lazy_mpm     ${APR_LIBRARY} ${APACHE_HTTPD_LIBRARY} mod_rivet)
+  target_link_libraries(rivet_worker_mpm   ${APR_LIBRARY} ${APRUTIL_LIBRARY} ${APACHE_HTTPD_LIBRARY} mod_rivet )
+  target_link_libraries(rivet_prefork_mpm  ${APR_LIBRARY} ${APACHE_HTTPD_LIBRARY} mod_rivet )
+  target_link_libraries(rivet_lazy_mpm     ${APR_LIBRARY} ${APACHE_HTTPD_LIBRARY} mod_rivet )
   # rivet_worker_mpm.c uses round(), which is available in C99
   SET_TARGET_PROPERTIES(rivet_worker_mpm PROPERTIES C_STANDARD 99)
   if(MSVC)
@@ -306,7 +323,7 @@ set(UPLOAD_DIR ${with-upload-dir})
 #  Location of the Rivet library...
 # ===========================================================================
 if(NOT DEFINED RIVETLIB_DESTDIR)
-  set(RIVETLIB_DESTDIR "${APACHE_LIB_DIR}/rivet${RIVET_VERSION}")
+  set(RIVETLIB_DESTDIR "${APACHE_ROOT}/rivet${RIVET_VERSION}")
 endif(NOT DEFINED RIVETLIB_DESTDIR)
 
 if(TCL_THREADS)
diff --git a/rivet/pkgIndex.tcl b/rivet/pkgIndex.tcl
index 3693a7e..db51d5c 100644
--- a/rivet/pkgIndex.tcl
+++ b/rivet/pkgIndex.tcl
@@ -12,11 +12,9 @@ package ifneeded AsciiGlyphs 0.1 [list source [file join $dir packages/asciiglyp
 package ifneeded Calendar 1.2 [list source [file join $dir packages/calendar/calendar.tcl]]
 package ifneeded DIO 1.1 [list source [file join $dir packages/dio/dio.tcl]]
 package ifneeded DIODisplay 1.0 [list source [file join $dir packages/dio/diodisplay.tcl]]
-package ifneeded Dtcl 1.0 [list source [file join $dir packages/dtcl/dtcl.tcl]]
-package ifneeded Rivet 3.0 [list source [file join $dir init.tcl]]
+package ifneeded Rivet 3.2 [list source [file join $dir init.tcl]]
 package ifneeded RivetEntities 1.0 [list source [file join $dir packages/entities/entities.tcl]]
 package ifneeded Session 1.0 [list source [file join $dir packages/session/session-class.tcl]]
-package ifneeded commserver 0.1 [list source [file join $dir packages/commserver/commserver.tcl]]
 package ifneeded dio_Mysql 0.3 [list source [file join $dir packages/dio/dio_Mysql.tcl]]
 package ifneeded dio_Oracle 0.1 [list source [file join $dir packages/dio/dio_Oracle.tcl]]
 package ifneeded dio_Postgresql 0.1 [list source [file join $dir packages/dio/dio_Postgresql.tcl]]
@@ -25,7 +23,7 @@ package ifneeded dio_Tdbc 0.1 [list source [file join $dir packages/dio/dio_Tdbc
 package ifneeded form 1.0 [list source [file join $dir packages/form/form.tcl]]
 package ifneeded form 2.1 [list source [file join $dir packages/form/form2.tcl]]
 package ifneeded formbroker 1.0 [list source [file join $dir packages/formbroker/formbroker.tcl]]
-package ifneeded ncgi 1.0 [list source [file join $dir packages/rivet_ncgi/rivet_ncgi.tcl]]
-package ifneeded simpledb 0.1 [list source [file join $dir packages/simpledb/simpledb.tcl]]
+package ifneeded rivetlib 3.2.0 [list load [file join $dir librivetlib.so]]
+package ifneeded rivetparser 0.2 [list load [file join $dir librivetparser.so]]
 package ifneeded tclrivet 0.1 [list source [file join $dir packages/tclrivet/tclrivet.tcl]]
 package ifneeded tclrivetparser 0.1 [list source [file join $dir packages/tclrivet/tclrivetparser.tcl]]
diff --git a/src/mod_rivet_ng/TclWebapache.c b/src/mod_rivet_ng/TclWebapache.c
index 0f3b1ec..4bf8a6b 100644
--- a/src/mod_rivet_ng/TclWebapache.c
+++ b/src/mod_rivet_ng/TclWebapache.c
@@ -96,7 +96,7 @@ TclWeb_InitRequest(rivet_thread_private* private, Tcl_Interp *interp)
 {
     request_rec*        r   = private->r;
     TclWebRequest*      req = private->req;
-    int content_type_len = strlen(r->content_type);
+    size_t content_type_len = strlen(r->content_type);
 
     req->interp             = interp;
     req->req                = r;
diff --git a/src/mod_rivet_ng/mod_rivet.c b/src/mod_rivet_ng/mod_rivet.c
index 4ec8930..12e4c74 100644
--- a/src/mod_rivet_ng/mod_rivet.c
+++ b/src/mod_rivet_ng/mod_rivet.c
@@ -67,9 +67,15 @@
 #include "mod_rivet_generator.h"
 
 module AP_MODULE_DECLARE_DATA rivet_module;
-extern    Tcl_ChannelType   RivetChan;
-DLLEXPORT apr_threadkey_t*         rivet_thread_key    = NULL;
-DLLEXPORT mod_rivet_globals*       module_globals      = NULL;
+
+/*
+ * Macros DLLIMPORT and DLLEXPORT are defined in tcl.h
+ */
+
+extern    Tcl_ChannelType   	RivetChan;
+DLLEXPORT apr_threadkey_t*      rivet_thread_key    = NULL;
+DLLEXPORT mod_rivet_globals*    module_globals      = NULL;
+DLLEXPORT module				rivet_module;
 
 #define ERRORBUF_SZ         256
 #define TCL_HANDLER_FILE    RIVET_DIR"/default_request_handler.tcl"
diff --git a/src/mod_rivet_ng/mod_rivet.h b/src/mod_rivet_ng/mod_rivet.h
index aa7ee52..0e9ee93 100644
--- a/src/mod_rivet_ng/mod_rivet.h
+++ b/src/mod_rivet_ng/mod_rivet.h
@@ -39,6 +39,8 @@
 
 APLOG_USE_MODULE(rivet);
 
+
+
 /* init.tcl file relative to the server root directory */
 
 #define RIVET_DIR  RIVET_RIVETLIB_DESTDIR
@@ -322,10 +324,4 @@ Tcl_Obj* Rivet_CurrentServerRec (Tcl_Interp* interp, server_rec* s);
 
 #define RIVET_MPM_BRIDGE_COMPOSE(bridge) RIVET_DIR,"/mpm/rivet_",bridge,"_mpm.so"
 
-#ifdef WIN32
-#define DLLIMPORT   __declspec( dllimport )
-#else
-#define DLLIMPORT
-#endif
-
 #endif /* MOD_RIVET_H */
diff --git a/src/mod_rivet_ng/mod_rivet_common.c b/src/mod_rivet_ng/mod_rivet_common.c
index 7c3b8a8..1b26240 100644
--- a/src/mod_rivet_ng/mod_rivet_common.c
+++ b/src/mod_rivet_ng/mod_rivet_common.c
@@ -166,7 +166,10 @@ running_scripts* Rivet_RunningScripts ( apr_pool_t* pool,
     {
 		char* request_handler;
 		int	  handler_size;
-			
+
+		ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_EGENERAL, module_globals->server, 
+                     MODNAME ": reading request handler %s",rivet_conf->request_handler);
+
 		ap_assert(Rivet_ReadFile(pool,rivet_conf->request_handler,
 		                        &request_handler,&handler_size) == 0);
 
@@ -174,6 +177,10 @@ running_scripts* Rivet_RunningScripts ( apr_pool_t* pool,
 				 Tcl_NewStringObj(request_handler,handler_size);
 
     } else {
+
+		ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_EGENERAL, module_globals->server, 
+                     MODNAME ": reading default request handler %s",module_globals->default_handler);
+
         scripts->request_processing = 
 				 Tcl_NewStringObj(module_globals->default_handler,
                                   module_globals->default_handler_size);
diff --git a/src/mod_rivet_ng/rivet_lazy_mpm.c b/src/mod_rivet_ng/rivet_lazy_mpm.c
index b3a57b0..2b935b7 100644
--- a/src/mod_rivet_ng/rivet_lazy_mpm.c
+++ b/src/mod_rivet_ng/rivet_lazy_mpm.c
@@ -36,9 +36,9 @@
 #include "rivetChannel.h"
 #include "apache_config.h"
 
-extern DLLIMPORT mod_rivet_globals*   module_globals;
-extern DLLIMPORT apr_threadkey_t*     rivet_thread_key;
-extern DLLIMPORT module 			  rivet_module;
+DLLIMPORT mod_rivet_globals* module_globals;
+DLLIMPORT apr_threadkey_t*   rivet_thread_key;
+module rivet_module;
 
 enum
 {
diff --git a/src/mod_rivet_ng/rivet_prefork_mpm.c b/src/mod_rivet_ng/rivet_prefork_mpm.c
index d14ec04..fd7259a 100644
--- a/src/mod_rivet_ng/rivet_prefork_mpm.c
+++ b/src/mod_rivet_ng/rivet_prefork_mpm.c
@@ -35,6 +35,7 @@
 
 extern DLLIMPORT mod_rivet_globals* module_globals;
 extern DLLIMPORT apr_threadkey_t*   rivet_thread_key;
+module           rivet_module;
 
 rivet_thread_private*   Rivet_VirtualHostsInterps (rivet_thread_private* private);
 
diff --git a/src/mod_rivet_ng/rivet_worker_mpm.c b/src/mod_rivet_ng/rivet_worker_mpm.c
index 7c36afe..660f862 100644
--- a/src/mod_rivet_ng/rivet_worker_mpm.c
+++ b/src/mod_rivet_ng/rivet_worker_mpm.c
@@ -51,6 +51,7 @@
 
 extern DLLIMPORT mod_rivet_globals* module_globals;
 extern DLLIMPORT apr_threadkey_t*   rivet_thread_key;
+DLLIMPORT module rivet_module;
 
 apr_threadkey_t*        handler_thread_key;
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tcl.apache.org
For additional commands, e-mail: commits-help@tcl.apache.org