Hello,

Just for fun, I tried again to get chrokee compiled on win32, using Mingw, Msys and the configure script (not the Makefile.Mingw)

I got it working with some changes (there are probably some remaining bugs).

I attach to this mail a diff file containing some changes.
Notice, some modifications are needed on Makefiles. I made those on Makefile.in, but it will probably best to be done in Makefile.am(but I do not have a working automake in this win32 beast) Notice also, that those modifications are done to get cherokee running on win32, and cannot be used on linux.

Changes are :
cherokee/Makefile.in
Add and "export all symbols" option to the linker flags. (plus regex to only include symbols starting with "cherokee_") Can probably be done with CHEROKEE_EXPORT, but it's more simple using this. Add some references to plugins/libraries, since a win32 executable cannot be linked with unresolved symbols.
   Need probably to add some WIN32 checks
cherokee/main.c
I do not know why but "HAVE_GETOPT_H" is not defined. So, I added a little ifdef before including getopt.h
cherokee/module_read_config.c
   Modified path contatenation to handle win32 pahs (using \ in place of /)
cherokee/read_config_grammar.y
cherokee/read_config_scanner.l
Modified to handle win32 paths. On unix machines, url and filepath have the same structure; not on win32.
   So, I added T_FILEPATH as a possible token
cherokee/util.c
FD_SETSIZE is not defined for WIN32, so, I add a ifdef and reused the value found in config.h.win32.


Hope it will help some one ;)

Olivier Samyn.

diff -ru cherokee-0.4.31b5/cherokee/Makefile.in 
cherokee-0.4.31b5-os/cherokee/Makefile.in
--- cherokee-0.4.31b5/cherokee/Makefile.in      Mon Jan 30 17:12:46 2006
+++ cherokee-0.4.31b5-os/cherokee/Makefile.in   Tue Jan 31 14:37:37 2006
@@ -768,7 +768,7 @@
 #
 # LDFLAGS for libraries
 #
[EMAIL PROTECTED]@no_undefined = -no-undefined
[EMAIL PROTECTED]@no_undefined = -no-undefined -Wl,--export-all-symbols 
-export-symbols_regex "cherokee_.*"
 common_ldflags = \
 $(LIBTOOL_EXPORT_OPTIONS) \
 $(no_undefined)
@@ -781,6 +781,8 @@
 $(common_ldflags) \
 -module \
 -avoid-version \
+-lcherokee-server \
+-lcherokee-base \
 -export-dynamic 
 
 
@@ -878,7 +880,7 @@
 libplugin_fastcgi_la_LDFLAGS = $(module_ldflags)  
 libplugin_fastcgi_la_SOURCES = $(handler_fastcgi)
 @[EMAIL PROTECTED] = $(handler_fastcgi)
[EMAIL PROTECTED]@dynamic_handler_fastcgi_lib = libplugin_fastcgi.la
[EMAIL PROTECTED]@dynamic_handler_fastcgi_lib = libplugin_fastcgi.la
 
 #
 # Handler phpcgi
@@ -887,7 +889,7 @@
 handler_phpcgi.c \
 handler_phpcgi.h
 
-libplugin_phpcgi_la_LDFLAGS = $(module_ldflags)  
+libplugin_phpcgi_la_LDFLAGS = $(module_ldflags) -lplugin_cgi 
 libplugin_phpcgi_la_SOURCES = $(handler_phpcgi)
 @[EMAIL PROTECTED] = $(handler_phpcgi)
 @[EMAIL PROTECTED] = libplugin_phpcgi.la
@@ -911,7 +913,7 @@
 handler_error_redir.c \
 handler_error_redir.h
 
-libplugin_error_redir_la_LDFLAGS = $(module_ldflags)  
+libplugin_error_redir_la_LDFLAGS = $(module_ldflags)   -lplugin_redir
 libplugin_error_redir_la_SOURCES = $(handler_error_redir)
 @[EMAIL PROTECTED] = $(handler_error_redir)
 @[EMAIL PROTECTED] = libplugin_error_redir.la
@@ -923,7 +925,7 @@
 handler_common.c \
 handler_common.h
 
-libplugin_common_la_LDFLAGS = $(module_ldflags) 
+libplugin_common_la_LDFLAGS = $(module_ldflags) -lplugin_dirlist -lplugin_file
 libplugin_common_la_SOURCES = $(handler_common)
 @[EMAIL PROTECTED] = $(handler_common)
 @[EMAIL PROTECTED] = libplugin_common.la
@@ -937,7 +939,7 @@
 handler_nn.c \
 handler_nn.h
 
-libplugin_nn_la_LDFLAGS = $(module_ldflags)  
+libplugin_nn_la_LDFLAGS = $(module_ldflags) -lplugin_redir -lplugin_common  
 libplugin_nn_la_SOURCES = $(handler_nn)
 @[EMAIL PROTECTED] = $(handler_nn)
 @[EMAIL PROTECTED] = libplugin_nn.la
@@ -1002,7 +1004,7 @@
 logger_combined.h \
 logger_combined.c
 
-libplugin_combined_la_LDFLAGS = $(module_ldflags)  
+libplugin_combined_la_LDFLAGS = $(module_ldflags)   -lplugin_ncsa
 libplugin_combined_la_SOURCES = $(logger_combined)
 @[EMAIL PROTECTED] = $(logger_combined)
 @[EMAIL PROTECTED] = libplugin_combined.la
diff -ru cherokee-0.4.31b5/cherokee/main.c cherokee-0.4.31b5-os/cherokee/main.c
--- cherokee-0.4.31b5/cherokee/main.c   Tue Jan 24 17:23:18 2006
+++ cherokee-0.4.31b5-os/cherokee/main.c        Tue Jan 31 14:29:06 2006
@@ -29,7 +29,7 @@
 #include <unistd.h>
 #include <string.h>
 
-#ifdef HAVE_GETOPT_H
+#if defined(HAVE_GETOPT_H)|| defined(WIN32)
 # include <getopt.h>
 #endif
 
diff -ru cherokee-0.4.31b5/cherokee/module_read_config.c 
cherokee-0.4.31b5-os/cherokee/module_read_config.c
--- cherokee-0.4.31b5/cherokee/module_read_config.c     Sat Jan 28 20:54:19 2006
+++ cherokee-0.4.31b5-os/cherokee/module_read_config.c  Tue Jan 31 14:41:34 2006
@@ -103,8 +103,11 @@
                        {
                                continue;
                        }
-                       
+#ifdef _WIN32                  
+                       ret = cherokee_buffer_add_va (&full_new, "%s\\%s", 
path, entry->d_name);
+#else
                        ret = cherokee_buffer_add_va (&full_new, "%s/%s", path, 
entry->d_name);
+#endif
                        if (unlikely (ret != ret_ok)) return ret;
 
                        cherokee_buffer_read_file (buf, full_new.buf);
diff -ru cherokee-0.4.31b5/cherokee/read_config_grammar.y 
cherokee-0.4.31b5-os/cherokee/read_config_grammar.y
--- cherokee-0.4.31b5/cherokee/read_config_grammar.y    Mon Jan 30 14:19:11 2006
+++ cherokee-0.4.31b5-os/cherokee/read_config_grammar.y Tue Jan 31 14:41:34 2006
@@ -418,7 +418,7 @@
 %token T_REQUEST T_MIMETYPE T_MAX_AGE
 
 %token <number> T_NUMBER T_PORT T_PORT_TLS
-%token <string> T_QSTRING T_FULLDIR T_ID T_HTTP_URL T_HTTPS_URL T_HOSTNAME 
T_IP T_DOMAIN_NAME T_ADDRESS_PORT T_MIMETYPE_ID
+%token <string> T_QSTRING T_FULLDIR T_FILEPATH T_ID T_HTTP_URL T_HTTPS_URL 
T_HOSTNAME T_IP T_DOMAIN_NAME T_ADDRESS_PORT T_MIMETYPE_ID
 
 %type <name_ptr> directory_option handler
 %type <string> host_name http_generic id_or_path ip_or_domain str_type 
address_or_path
@@ -636,7 +636,7 @@
           }
 };
 
-document_root : T_DOCUMENT_ROOT T_FULLDIR
+document_root : T_DOCUMENT_ROOT T_FILEPATH
 {
           char                      *root;
           int                        root_len;
@@ -690,7 +690,7 @@
            | tuple_list tuple
            ;
 
-tuple : T_ID T_FULLDIR
+tuple : T_ID T_FILEPATH
 {
           cherokee_virtual_server_t *vserver;
           vserver = auto_virtual_server;
@@ -721,7 +721,7 @@
           }
 };
 
-mime : T_MIME_FILE T_FULLDIR
+mime : T_MIME_FILE T_FILEPATH
 {
           SRV(server)->mime_file = $2;
 };
@@ -769,7 +769,7 @@
           }
 };
 
-icons : T_ICONS T_FULLDIR
+icons : T_ICONS T_FILEPATH
 {
           SRV(server)->icons_file = $2;
 };
@@ -792,7 +792,7 @@
           SRV(server)->keepalive_max = $2;
 };
 
-ssl_file : T_SSL_CERT_FILE T_FULLDIR
+ssl_file : T_SSL_CERT_FILE T_FILEPATH
 {
 #ifdef HAVE_TLS
           cherokee_virtual_server_t *vsrv = auto_virtual_server;
@@ -809,7 +809,7 @@
 #endif
 };
 
-ssl_key_file : T_SSL_CERT_KEY_FILE T_FULLDIR
+ssl_key_file : T_SSL_CERT_KEY_FILE T_FILEPATH
 {
 #ifdef HAVE_TLS
           cherokee_virtual_server_t *vsrv = auto_virtual_server;
@@ -826,7 +826,7 @@
 #endif
 };
 
-ssl_ca_list_file : T_SSL_CA_LIST_FILE T_FULLDIR
+ssl_ca_list_file : T_SSL_CA_LIST_FILE T_FILEPATH
 {
 #ifdef HAVE_TLS
           cherokee_virtual_server_t *vsrv = auto_virtual_server;
@@ -920,7 +920,7 @@
           }
 };
 
-pidfile : T_PIDFILE T_FULLDIR
+pidfile : T_PIDFILE T_FILEPATH
 {
           cherokee_buffer_clean (&SRV(server)->pidfile);
           cherokee_buffer_add (&SRV(server)->pidfile, $2, strlen($2));
@@ -928,7 +928,7 @@
           free ($2);
 };
 
-panic_action : T_PANIC_ACTION T_FULLDIR
+panic_action : T_PANIC_ACTION T_FILEPATH
 {
           if (SRV(server)->panic_action != NULL) {
                         PRINT_MSG ("WARNING: Overwriting panic action '%s' by 
'%s'\n", SRV(server)->panic_action, $2);
@@ -965,7 +965,7 @@
           SRV(server)->max_conn_reuse = $2;
 };
 
-chroot : T_CHROOT T_FULLDIR
+chroot : T_CHROOT T_FILEPATH
 {
           SRV(server)->chroot = $2;
 };
@@ -1081,6 +1081,7 @@
 
 str_type : T_ID
          | T_FULLDIR
+         | T_FILEPATH
          | T_ADDRESS_PORT
          | T_QSTRING
          | T_HTTP_URL
@@ -1169,7 +1170,7 @@
           if (re != 0) return re;
 };
 
-handler_option : T_SOCKET T_FULLDIR
+handler_option : T_SOCKET T_FILEPATH
 { dirs_table_set_handler_prop (current_config_entry, "socket", $2); };
 
 handler_option : T_JUST_ABOUT
@@ -1548,7 +1549,7 @@
 };
 
 
-directory_option : T_DOCUMENT_ROOT T_FULLDIR
+directory_option : T_DOCUMENT_ROOT T_FILEPATH
 {
           if (directory_content_tmp.document_root != NULL) {
                         PRINT_MSG ("WARNING: Overwriting DocumentRoot '%s' by 
'%s'\n",
@@ -1678,7 +1679,7 @@
                    | auth_option_params auth_option_param
                    ;
 
-auth_option_param : T_PASSWDFILE T_FULLDIR 
+auth_option_param : T_PASSWDFILE T_FILEPATH 
 { dirs_table_set_validator_prop (current_config_entry, "file", $2); };
 
 
diff -ru cherokee-0.4.31b5/cherokee/read_config_scanner.l 
cherokee-0.4.31b5-os/cherokee/read_config_scanner.l
--- cherokee-0.4.31b5/cherokee/read_config_scanner.l    Fri Jan 13 20:11:18 2006
+++ cherokee-0.4.31b5-os/cherokee/read_config_scanner.l Tue Jan 31 14:41:34 2006
@@ -33,8 +33,9 @@
 ws              [ \t]+
 integer         [-+]?[0-9]+
 comment         #.*$
-fpath           \/[^\"\n ]*
-qstring         \"[^\"\{\}\n]*\"
+filepath        [a-zA-Z]:[^\"\n\r ]*
+fpath           \/[^\"\n\r ]*
+qstring         \"[^\"\{\}\r\n]*\"
 http            http\:\/{fpath}
 https           https\:\/{fpath}
 id              [_\-\.a-zA-Z][\.\-_a-zA-Z0-9]*
@@ -120,6 +121,7 @@
 "Off"                   { yylval.number = 0; return T_NUMBER; }
 
 {fpath}          { yylval.string = strdup(yytext); return T_FULLDIR; }
+{filepath}       { yylval.string = strdup(yytext); return T_FILEPATH; }
 {http}           { yylval.string = strdup(yytext); return T_HTTP_URL; }
 {https}          { yylval.string = strdup(yytext); return T_HTTPS_URL; }
 {id}             { yylval.string = strdup(yytext); return T_ID; }
diff -ru cherokee-0.4.31b5/cherokee/util.c cherokee-0.4.31b5-os/cherokee/util.c
--- cherokee-0.4.31b5/cherokee/util.c   Mon Jan 30 23:06:32 2006
+++ cherokee-0.4.31b5-os/cherokee/util.c        Tue Jan 31 14:41:34 2006
@@ -187,8 +187,13 @@
         *limit = OPEN_MAX;         /* need to include limits.h somehow */
        return ret_ok;
 #else
+#ifdef _WIN32
+        *limit = 256;
+  return ret_ok;
+#else
         *limit = FD_SETSIZE;  
        return ret_ok;
+#endif
 #endif
 #endif
 #endif
_______________________________________________
Cherokee mailing list
[email protected]
http://www.alobbs.com/cgi-bin/mailman/listinfo/cherokee

Reply via email to