httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apache-1.3/src/support apxs.pl
Date Fri, 04 May 2001 06:22:18 GMT
wrowe       01/05/03 23:22:17

  Modified:    src      CHANGES makefile.win
               src/support apxs.pl
  Log:
    Apxs spoken here [win32].
  
  Revision  Changes    Path
  1.1676    +3 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1675
  retrieving revision 1.1676
  diff -u -r1.1675 -r1.1676
  --- CHANGES	2001/04/12 17:54:58	1.1675
  +++ CHANGES	2001/05/04 06:22:16	1.1676
  @@ -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 
  
  
  
  1.24      +23 -0     apache-1.3/src/makefile.win
  
  Index: makefile.win
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/makefile.win,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- makefile.win	2001/02/14 19:36:19	1.23
  +++ makefile.win	2001/05/04 06:22:16	1.24
  @@ -211,3 +211,26 @@
         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;
  +    }
  +<<
  
  
  
  1.37      +74 -25    apache-1.3/src/support/apxs.pl
  
  Index: apxs.pl
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/support/apxs.pl,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- apxs.pl	2001/01/15 17:06:36	1.36
  +++ apxs.pl	2001/05/04 06:22:17	1.37
  @@ -222,6 +222,7 @@
   ##
   ##  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 @@
       print STDERR "apxs:Error: binary `$CFG_SBINDIR/$CFG_TARGET'.\n";
       exit(1);
   }
  +}
   
   ##
   ##  Operation
  @@ -359,23 +361,44 @@
           $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 @@
           }
       }
       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 @@
               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 ($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 @@
           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 @@
                    $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 (@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##
  
  
  

Mime
View raw message