]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Apxs spoken here [win32].
authorWilliam A. Rowe Jr <wrowe@apache.org>
Fri, 4 May 2001 06:22:17 +0000 (06:22 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Fri, 4 May 2001 06:22:17 +0000 (06:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@88985 13f79535-47bb-0310-9956-ffa450edef68

src/CHANGES
src/makefile.win
src/support/apxs.pl

index 261f05b3d77fecf7ae6966ff306d3d04ba2f4305..b2bc7abf1c2a3442238921c0d04a61a286888ec5 100644 (file)
@@ -1,5 +1,8 @@
 Changes with Apache 1.3.20
 
+  *) Add support for Win32 apxs.  Note that cygwin builders must use a
+     cygwin perl to avoid the MSWin32 handling.  [William Rowe]
+
   *) Changed the initial screen handling for NetWare so that the -s 
      parameter will properly destroy the Apache console screen and switch 
      to the system console screen.  Also removed the call to clrscr() for 
index 262ab7fdb4ff8df1f131df019b82469ce85a8005..558c4f1e8821a23a3d000dce2ca01ee2844ea16c 100644 (file)
@@ -210,4 +210,27 @@ A
       } 
       print $$0;
     }
+<<
+       awk -f <<script2.awk "support\apxs.pl" $(INSTDIR) >"$(INSTDIR)\bin\apxs.pl"
+    BEGIN {
+          target = ARGV[2];
+          gsub( /\\/, "/", target );
+          delete ARGV[2];
+    }
+    { if ( $$0 ~ /@/) {
+          gsub( /@TARGET@/,            "httpd" ); 
+          gsub( /@CC@/,                "cl" ); 
+          gsub( /@CFLAGS@/,            "-nologo -MD -W3 -O2 -DNDEBUG -DWIN32 -D_WINDOWS -FD" ); 
+          gsub( /@CFLAGS_SHLIB@/,      "-DSHARED_MODULE" ); 
+          gsub( /@LD_SHLIB@/,          "link" ); 
+          gsub( /@LDFLAGS_MOD_SHLIB@/, "-nologo -subsystem:windows -dll -libpath:\"" target "/libexec\" -incremental:no -map -machine:I386" ); 
+          gsub( /@LIBS_SHLIB@/,        "ApacheCore.lib kernel32.lib advapi32.lib wsock32.lib ws2_32.lib" ); 
+          gsub( /@prefix@/,            target  ); 
+          gsub( /@sbindir@/,           target ); 
+          gsub( /@includedir@/,        target "/include" ); 
+          gsub( /@libexecdir@/,        target "/modules" ); 
+          gsub( /@sysconfdir@/,        target "/conf" ); 
+      } 
+      print $$0;
+    }
 <<
index 1d6aef740eaff692958e178e622ce70dc7b6bb42..e5e5ada1b0aae391d661889f3c258c214f037dcc 100644 (file)
@@ -222,6 +222,7 @@ if (@opt_S) {
 ##
 ##  Initial DSO support check
 ##
+if ($^O ne "MSWin32") {
 if (not -x "$CFG_SBINDIR/$CFG_TARGET") {
     print STDERR "apxs:Error: $CFG_SBINDIR/$CFG_TARGET not found or not executable\n";
     exit(1);
@@ -233,6 +234,7 @@ if (not grep(/mod_so/, `$CFG_SBINDIR/$CFG_TARGET -l`)) {
     print STDERR "apxs:Error: binary `$CFG_SBINDIR/$CFG_TARGET'.\n";
     exit(1);
 }
+}
 
 ##
 ##  Operation
@@ -359,23 +361,44 @@ if ($opt_c) {
         $opt .= "$1 " if ($opt_Wc =~ m|^\s*c,(.*)$|);
     }
     foreach $opt_I (@opt_I) {
+        $opt_I = '"' . $opt_I . '"' if ($opt_I =~ m|\s|);
         $opt .= "-I$opt_I ";
     }
     foreach $opt_D (@opt_D) {
         $opt .= "-D$opt_D ";
     }
     my $cflags = "$CFG_CFLAGS $CFG_CFLAGS_SHLIB";
+    if ($^O eq "MSWin32") {
+        my $d = $dso_file;
+        $d =~ s|\.so$||;
+        $d = '"' . $d . '"' if ($d =~ m|\s|);
+        $opt .= "-Fd$d ";
+    }
     my $s;
     foreach $s (@srcs) {
         my $o = $s;
-        $o =~ s|\.c$|.o|;
-        $o =~ s|^.*/||;
-        push(@cmds, "$CFG_CC $cflags -I$CFG_INCLUDEDIR $opt -c $s");
+        $s = '"' . $s . '"' if ($s =~ m|\s|);
+        if ($^O ne "MSWin32") {
+            $o =~ s|\.c$|.o|;
+            $o =~ s|^.*/||;
+            $o = '"' . $o . '"' if ($o =~ m|\s|);
+            push(@cmds, "$CFG_CC $cflags -I$CFG_INCLUDEDIR $opt -c $s");
+        } else {
+            $o =~ s|\.c$|.obj|;
+            $o =~ s|^.*/||;
+            $o = '"' . $o . '"' if ($o =~ m|\s|);
+            push(@cmds, "$CFG_CC $cflags -I\"$CFG_INCLUDEDIR\" $opt -c $s -Fo$o");
+        }
         unshift(@objs, $o);
     }
 
     #   create link command
-    my $cmd = "$CFG_LD_SHLIB $CFG_LDFLAGS_SHLIB -o $dso_file";
+    my $cmd;
+    if ($^O ne "MSWin32") {
+        $cmd = "$CFG_LD_SHLIB $CFG_LDFLAGS_SHLIB -o $dso_file";
+    } else {
+        $cmd = "$CFG_LD_SHLIB $CFG_LDFLAGS_SHLIB -out:\"$dso_file\"";
+    }
     my $o;
     foreach $o (@objs) {
         $cmd .= " $o";
@@ -390,10 +413,18 @@ if ($opt_c) {
         }
     }
     foreach $opt_L (@opt_L) {
-        $opt .= " -L$opt_L";
+        if ($^O ne "MSWin32") {
+            $opt .= " -L$opt_L";
+        } else {
+            $opt .= " -libpath:\"$opt_L\"";
+        }
     }
     foreach $opt_l (@opt_l) {
-        $opt .= " -l$opt_l";
+        if ($^O ne "MSWin32") {
+            $opt .= " -l$opt_l";
+        } else {
+            $opt .= " $opt_l";
+        }
     }
     $cmd .= $opt;
     $cmd .= " $CFG_LIBS_SHLIB";
@@ -425,12 +456,20 @@ if ($opt_i or $opt_e) {
             exit(1);
         }
         my $t = $f;
-        $t =~ s|^.+/([^/]+)$|$1|;
-        if ($opt_i) {
-            push(@cmds, "cp $f $CFG_LIBEXECDIR/$t");
-            push(@cmds, "chmod 755 $CFG_LIBEXECDIR/$t");
+        if ($^O ne "MSWin32") {
+            $t =~ s|^.+/([^/]+)$|$1|;
+            if ($opt_i) {
+                push(@cmds, "cp $f $CFG_LIBEXECDIR/$t");
+                push(@cmds, "chmod 755 $CFG_LIBEXECDIR/$t");
+            }
         }
-
+       else {
+            $t =~ s|^.+[/\\]([^/\\]+)$|$1|;
+            if ($opt_i) {
+                push(@cmds, "copy \"$f\" \"$CFG_LIBEXECDIR/$t\"");
+            }
+        }
+        
         #   determine module symbolname and filename
         my $filename = '';
         if ($name eq 'unknown') {
@@ -444,14 +483,16 @@ if ($opt_i or $opt_e) {
                 if ($content =~ m|.*module\s+(?:MODULE_VAR_EXPORT\s+)?([a-zA-Z0-9_]+)_module\s*=\s*.*|s) {
                     $name = "$1";
                     $filename = "$base.c";
-                    $filename =~ s|^[^/]+/||;
+                    $filename =~ s|^.+/||;
+                    $filename =~ s|^.+\\|| if ($^O eq "MSWin32");
                 }
             }
             if ($name eq '') {
                 if ($base =~ m|.*mod_([a-zA-Z0-9_]+)\..+|) {
                     $name = "$1";
                     $filename = $base;
-                    $filename =~ s|^[^/]+/||;
+                    $filename =~ s|^.+/||;
+                    $filename =~ s|^.+\\|| if ($^O eq "MSWin32");
                 }
             }
             if ($name eq '') {
@@ -470,22 +511,20 @@ if ($opt_i or $opt_e) {
         push(@amd, sprintf("AddModule %s", $filename));
     }
 
-    #   execute the commands
-    &execute_cmds(@cmds);
-
     #   activate module via LoadModule/AddModule directive
     if ($opt_a or $opt_A) {
-        if (not -f "$CFG_SYSCONFDIR/$CFG_TARGET.conf") {
-            print STDERR "apxs:Error: Config file $CFG_SYSCONFDIR/$CFG_TARGET.conf not found\n";
+        my $cfgbase = "$CFG_SYSCONFDIR/$CFG_TARGET";
+        if (not -f "$cfgbase.conf") {
+            print STDERR "apxs:Error: Config file $cfgbase.conf not found\n";
             exit(1);
         }
 
-        open(FP, "<$CFG_SYSCONFDIR/$CFG_TARGET.conf") || die;
+        open(FP, "<$cfgbase.conf") || die;
         my $content = join('', <FP>);
         close(FP);
 
         if ($content !~ m|\n#?\s*LoadModule\s+|) {
-            print STDERR "apxs:Error: Activation failed for custom $CFG_SYSCONFDIR/$CFG_TARGET.conf file.\n";
+            print STDERR "apxs:Error: Activation failed for custom $cfgbase.conf file.\n";
             print STDERR "apxs:Error: At least one `LoadModule' directive already has to exist.\n";
             exit(1);
         }
@@ -501,7 +540,7 @@ if ($opt_i or $opt_e) {
                  $content =~ s|^(.*\n)#?\s*$lmd[^\n]*\n|$1$c$lmd\n|sg;
             }
             $lmd =~ m|LoadModule\s+(.+?)_module.*|;
-            print STDERR "[$what module `$1' in $CFG_SYSCONFDIR/$CFG_TARGET.conf]\n";
+            print STDERR "[$what module `$1' in $cfgbase.conf]\n";
         }
         my $amd;
         foreach $amd (@amd) {
@@ -512,17 +551,27 @@ if ($opt_i or $opt_e) {
             }
         }
         if (@lmd or @amd) {
-            if (open(FP, ">$CFG_SYSCONFDIR/$CFG_TARGET.conf.new")) {
+            if (open(FP, ">$cfgbase.conf.new")) {
                 print FP $content;
                 close(FP);
-                system("cp $CFG_SYSCONFDIR/$CFG_TARGET.conf $CFG_SYSCONFDIR/$CFG_TARGET.conf.bak && " .
-                       "cp $CFG_SYSCONFDIR/$CFG_TARGET.conf.new $CFG_SYSCONFDIR/$CFG_TARGET.conf && " .
-                       "rm $CFG_SYSCONFDIR/$CFG_TARGET.conf.new");
+                if ($^O ne "MSWin32") {
+                    push(@cmds, "cp $cfgbase.conf $cfgbase.conf.bak");
+                    push(@cmds, "cp $cfgbase.conf.new $cfgbase.conf");
+                    push(@cmds, "rm $cfgbase.conf.new");
+                } else {
+                    $cfgbase =~ s|/|\\|g;
+                    push(@cmds, "copy \"$cfgbase.conf\" \"$cfgbase.conf.bak\"");
+                    push(@cmds, "copy \"$cfgbase.conf.new\" \"$cfgbase.conf\"");
+                    push(@cmds, "del \"$cfgbase.conf.new\"");
+                }
             } else {
                 print STDERR "apxs:Error: unable to open configuration file\n";
             }
         }
     }
+
+    #   execute the commands
+    &execute_cmds(@cmds);
 }
 
 ##EOF##