You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@hyperreal.org on 1998/05/20 03:33:38 UTC

cvs commit: modperl/src/modules/perl mod_perl.c mod_perl.h

dougm       98/05/19 18:33:38

  Modified:    .        Changes MANIFEST Makefile.PL
               src/modules/perl mod_perl.c mod_perl.h
  Log:
  APACI support added [Ralf S. Engelschall <rs...@engelschall.com>]
  
  Revision  Changes    Path
  1.33      +2 -0      modperl/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /export/home/cvs/modperl/Changes,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- Changes	1998/05/19 23:21:17	1.32
  +++ Changes	1998/05/20 01:33:35	1.33
  @@ -17,6 +17,8 @@
   =over 3
   
   =item 1.11_01-dev
  + 
  +APACI support added [Ralf S. Engelschall <rs...@engelschall.com>]
   
   experimental tie of $0 to Apache->request->filename, enable with
   -DPERL_TIE_SCRIPTNAME  
  
  
  
  1.15      +7 -0      modperl/MANIFEST
  
  Index: MANIFEST
  ===================================================================
  RCS file: /export/home/cvs/modperl/MANIFEST,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- MANIFEST	1998/05/14 03:06:50	1.14
  +++ MANIFEST	1998/05/20 01:33:35	1.15
  @@ -156,3 +156,10 @@
   Tie/Makefile.PL
   Tie/Tie.pm
   Tie/typemap
  +apaci/Makefile.libdir
  +apaci/Makefile.tmpl
  +apaci/README
  +apaci/configure
  +apaci/libperl.module
  +apaci/mod_perl.config
  +apaci/mod_perl.config.sh
  
  
  
  1.29      +125 -54   modperl/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /export/home/cvs/modperl/Makefile.PL,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Makefile.PL	1998/05/19 23:21:17	1.28
  +++ Makefile.PL	1998/05/20 01:33:35	1.29
  @@ -12,6 +12,7 @@
   use Config;
   use FileHandle ();
   use DirHandle ();
  +use File::Compare ();
   use File::Basename qw(dirname);
   use File::Path qw(mkpath rmtree);
   use Cwd;
  @@ -119,6 +120,7 @@
       NONE => "", 
   );	     
   
  +$USE_APACI = 0;
   $EVERYTHING = 0;
   $PERL_DEBUG = "";
   $PERL_DESTRUCT_LEVEL = "";
  @@ -152,7 +154,7 @@
   };
   
   my @mp_args = 
  -    qw(EVERYTHING DO_HTTPD NO_HTTPD CONFIG ADD_MODULE
  +    qw(EVERYTHING DO_HTTPD NO_HTTPD CONFIG ADD_MODULE USE_APACI
          ALL_HOOKS ADD_VERSION STATIC DYNAMIC PORT);
   
   sub is_mp_arg {
  @@ -220,6 +222,10 @@
       $callback_hooks{$k} = $v if exists $callback_hooks{$k};
   }
   
  +if($USE_APACI) {
  +    print "Will configure via APACI\n";
  +}
  +
   @ARGV = @mm_args;
   $STATIC = 0 if $DYNAMIC;
   $Configuration = $CONFIG || "Configuration";
  @@ -317,6 +323,7 @@
   	    $IsBenSSL = -e "$adir/apache_ssl.c";
   	    last unless(-e $conf || -e "$conf.tmpl"); #building from 'make offsite-tar' 
   	}
  +	++$NO_HTTPD if $USE_APACI;
   	unless ($DO_HTTPD or $NO_HTTPD) {
   	    $ans = _prompt("Shall I build httpd in $adir for you?", "y");
   	    ++$NO_HTTPD unless $ans =~ /^y$/i;
  @@ -329,37 +336,46 @@
   		print "(cd $adir && ./Configure -file $cfgfile)";
   	    }
   	}
  -	last if $NO_HTTPD;
   
  -	unless ($can_dash_make{asrc $adir}) {
  -	    unless (-e "$adir/Makefile.tmpl.bak") {
  -		print STDERR "Backing up $adir/Makefile.tmpl to $adir/Makefile.tmpl.bak\n";
  -		cp "$adir/Makefile.tmpl", "$adir/Makefile.tmpl.bak";
  +	#copy the source files
  +	if(!$NO_HTTPD or $USE_APACI) {
  +	    mkpath "$adir/modules/perl";
  +	    #ignore make's output here
  +	    `(cd $adir/modules/perl && make clean 2> /dev/null)`;
  +
  +	    local(*MANI);
  +	    open MANI, "MANIFEST" or die "open MANIFEST $!";
  +	    my $atopdir = dirname($adir);
  +
  +	    #only rm and cp files mod_perl ships with
  +	    while(<MANI>) {
  +		next unless m,^src/modules/perl/,; chomp;
  +		#print "rm -f $adir/$_\n";
  +		unlink "$atopdir/$_";
  +		print "cp $_ $atopdir/$_\n" if $USE_APACI;
  +		my $dest = "$atopdir/$_";
  +		cp $_, $dest;
  +		$mani_src{$_}++;
   	    }
  -	    cp "src/$mft_map{$adir}", "$adir/Makefile.tmpl";
  -	    print STDERR "cp src/$mft_map{$adir} $adir/Makefile.tmpl\n";
  -	}
  +	    close MANI;
   
  -	mkpath "$adir/modules/perl";
  -	#ignore make's output here
  -	`(cd $adir/modules/perl && make clean 2> /dev/null)`;
  -
  -	local(*MANI);
  -	open *MANI, "MANIFEST" or die "open MANIFEST $!";
  -	my $atopdir = dirname($adir);
  -
  -	#only rm and cp files mod_perl ships with
  -	while(<MANI>) {
  -	    next unless m,^src/modules/perl/,; chomp;
  -	    #print "rm -f $adir/$_\n";
  -	    unlink "$atopdir/$_";
  -	    #print "cp $_ $atopdir/$_\n";
  -	    my $dest = "$atopdir/$_";
  -	    cp $_, $dest;
  -	    $mani_src{$_}++;
  +	    if($USE_APACI) {
  +		open MANI, "MANIFEST" or die "open MANIFEST $!";
  +		while(<MANI>) {
  +		    next unless m,^apaci/,; chomp;
  +		    (my $to = $_) =~ s,^apaci/,src/modules/perl/,;
  +		    unlink "$atopdir/$to";
  +		    print "cp $_ $atopdir/$to\n";
  +		    my $dest = "$atopdir/$to";
  +		    cp $_, $dest;
  +		    chmod 0755, $dest if -x $_;
  +		}
  +		close MANI;
  +	    }
   	}
  -	close MANI;
   
  +	last if $NO_HTTPD or $USE_APACI;
  +
   	if($PERL_EXTRA_CFLAGS) {
   	    $PERL_EXTRA_CFLAGS = join(" ", split(",",  $PERL_EXTRA_CFLAGS));
   	    $PERL_EXTRA_CFLAGS =~ s/\s+/ /g;
  @@ -488,7 +504,9 @@
       for (@callback_hooks) {
   	($k,$v) = ($_,$callback_hooks{$_});
   
  -	iedit "$APACHE_SRC/modules/perl/Makefile", "s/^$k /#$k /" if $v;
  +	unless ($USE_APACI) {
  +	    iedit "$APACHE_SRC/modules/perl/Makefile", "s/^$k /#$k /" if $v;
  +	}
   
   	$why = ($cant_hook{$k} || "(enable with $k=1)") unless $v;
   	$k =~ s/([A-Z]+)/ucfirst(lc($1))/ge;
  @@ -524,12 +542,14 @@
   	}
   
   	print "\n";
  -
  -	iedit "$APACHE_SRC/modules/perl/Makefile", "s/^($_) /#\$1 /"
  -	    if $$_;
  +	unless ($USE_APACI) {
  +	    iedit "$APACHE_SRC/modules/perl/Makefile", "s/^($_) /#\$1 /"
  +		if $$_;
  +	}
       }
  -
  -    iedit "$APACHE_SRC/modules/perl/Makefile", "s/^#TRACE/TRACE/" if $PERL_TRACE;
  +    unless ($USE_APACI) {
  +	iedit "$APACHE_SRC/modules/perl/Makefile", "s/^#TRACE/TRACE/" if $PERL_TRACE;
  +    }
   
       my $ssl_name = is_ssl();
       if($ssl_name) {
  @@ -559,8 +579,10 @@
   	    }
   	}
   
  -	iedit "$APACHE_SRC/modules/perl/Makefile",	
  -	"s:^#APACHE_SSL.*:APACHE_SSL = $SSL_CFLAGS:";
  +	unless ($USE_APACI) {
  +	    iedit "$APACHE_SRC/modules/perl/Makefile",	
  +	    "s:^#APACHE_SSL.*:APACHE_SSL = $SSL_CFLAGS:";
  +	}
       }
   
       #my $incdir = ($mmn >= 19970825) ? "../../main" : "../..";
  @@ -586,9 +608,10 @@
   INCDIR = $incdir
   
   EOF
  -
  -    iedit "$APACHE_SRC/modules/perl/Makefile", "s/^#__ORIGINAL__/$edit_note/";
   
  +    unless ($USE_APACI) {
  +	iedit "$APACHE_SRC/modules/perl/Makefile", "s/^#__ORIGINAL__/$edit_note/";
  +    }
       #needed as of 1.3b1+ 
   
       #XXX: argh, what a bloody nightmare!!!
  @@ -606,7 +629,7 @@
   	close $fh;
       }
   
  -    if($mmn >= 19970912) {     #1.3b1
  +    if($mmn >= 19970912 and not $USE_APACI) {     #1.3b1
   	system "cat $APACHE_SRC/Makefile.config $APACHE_SRC/modules/perl/Makefile > /tmp/mpmf.$$";
   	system "mv /tmp/mpmf.$$ $APACHE_SRC/modules/perl/Makefile";
       }
  @@ -648,17 +671,24 @@
       }
   
       {
  -	my $mmn = magic_number($APACHE_SRC) unless $NO_HTTPD;
  +	my $mmn = magic_number($APACHE_SRC) || 0;
  +
   	my $hf = FileHandle->new(">>t/net/config.pl") or 
  -	    die "can't open t/net/config.pl";
  +	    die "can't open t/net/config.pl $!";
  +
  +	my $apaci_cfg = APACI->init;
  +    
   	my($k,$v);
   	print $hf "%callback_hooks = (\n";
   	while(($k,$v) = each %callback_hooks) {
   	    print $hf "   $k => $v,\n";
  +	    my $yes_no = $v ? "yes" : "no";
  +	    print $apaci_cfg "$k = $yes_no\n" if $apaci_cfg;
   	}
           print $hf "   MMN => $mmn,\n";
   	print $hf ");\n1;\n";
   	$hf->close;
  +	$apaci_cfg->close if $apaci_cfg;
       }
   
       #expand ./t to full path
  @@ -1067,7 +1097,7 @@
   sub magic_number {
       my $d = asrc shift;
       return $mcache{$d} if $mcache{$d};
  -    my $fh = FileHandle->new("$d/http_config.h") or die $!;
  +    my $fh = FileHandle->new("$d/http_config.h") or return 0;
       my $n;
       while(<$fh>) {
   	if(s/^#define\s+MODULE_MAGIC_NUMBER\s+(\d+).*/$1/) {
  @@ -1091,9 +1121,10 @@
       my $mf = "$APACHE_SRC/modules/perl/Makefile";
       my @static_src = ();
   
  -    iedit $mf, "s/(PERL_STATIC_EXTS) =.*/\$1 = $PERL_STATIC_EXTS/"
  -	if $PERL_STATIC_EXTS;
  -
  +    unless ($USE_APACI) {
  +	iedit $mf, "s/(PERL_STATIC_EXTS) =.*/\$1 = $PERL_STATIC_EXTS/"
  +	    if $PERL_STATIC_EXTS;
  +    }
       return unless $STATIC;
   
       cp "Apache/typemap", $d;
  @@ -1126,15 +1157,17 @@
       iedit $mf, "s/^#STATIC_EXTS.*/STATIC_EXTS = @xs_names/";
   =cut
   
  -    #XXX: ho,hum, need to generate the whole damn thing 
  -    #instead of all these frigging iedits.
  -    iedit $mf, "s/^#STATIC_SRC.*/STATIC_SRC = @static_src/";
  -    iedit $mf, "s/^#STATIC_EXTS.*/STATIC_EXTS = @xs_modules/";
  -    iedit $mf, "s/^#STATIC_/STATIC_/";
  -
  -    #bloody hell, make sucks and so does this.
  -    #this has only cause a few people pain, enough.
  -    iedit $mf, "s/ \Q\$(STATIC_SRC)\E/ @static_src/";
  +    unless ($USE_APACI) {
  +	#XXX: ho,hum, need to generate the whole damn thing 
  +	#instead of all these frigging iedits.
  +	iedit $mf, "s/^#STATIC_SRC.*/STATIC_SRC = @static_src/";
  +	iedit $mf, "s/^#STATIC_EXTS.*/STATIC_EXTS = @xs_modules/";
  +	iedit $mf, "s/^#STATIC_/STATIC_/";
  +
  +	#bloody hell, make sucks and so does this.
  +	#this has only cause a few people pain, enough.
  +	iedit $mf, "s/ \Q\$(STATIC_SRC)\E/ @static_src/";
  +    }
   }
   
   sub module_name_from_xs {
  @@ -1456,5 +1489,43 @@
       }
       $Embed::ldopts;
   }
  +
  +sub APACI::init {
  +    my $lib_cfg = "$APACHE_SRC/modules/perl/mod_perl.config";
  +
  +    return undef unless $USE_APACI;
  +    unless (File::Compare::compare($lib_cfg,"apaci/mod_perl.config") == 0) {
  +	#warn "mod_perl.config already edited\n";
  +	return undef;
  +    }
  +
  +    my $apaci_cfg = FileHandle->new(">$lib_cfg") or 
  +	die "can't open $lib_cfg $!";
  +
  +    my @static_src = ();
  +    for (@xs_mod_snames) {
  +	push @static_src, "$_.c";
  +    }
   
  -                                    
  +    print $apaci_cfg <<EOF;
  +##
  +##  mod_perl.config -- mod_perl shared configuration file
  +##
  +
  +#   mod_perl version
  +MOD_PERL_VERSION = $VERSION
  +
  +#   Perl interpreter to use 
  +PERL = DEFAULT
  +
  +PERL_STATIC_EXTS = @xs_modules $PERL_STATIC_EXTS
  +PERL_STATIC_SRCS = @static_src
  +
  +EOF
  +    for (qw(PERL_SSI PERL_TRACE)) {
  +	my $yes_no = $$_ ? "yes" : "no";
  +	print $apaci_cfg "$_ = $yes_no\n";
  +    }
  +
  +    return $apaci_cfg;
  +}
  
  
  
  1.20      +2 -0      modperl/src/modules/perl/mod_perl.c
  
  Index: mod_perl.c
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/mod_perl.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- mod_perl.c	1998/05/19 23:21:18	1.19
  +++ mod_perl.c	1998/05/20 01:33:37	1.20
  @@ -394,7 +394,9 @@
       GV *gv, *shgv;
   
   #if MODULE_MAGIC_NUMBER >= 19980507
  +#ifndef MOD_PERL_STRING_VERSION
   #include "mod_perl_version.h"
  +#endif
       ap_add_version_component(MOD_PERL_STRING_VERSION);
   #endif
   
  
  
  
  1.23      +4 -0      modperl/src/modules/perl/mod_perl.h
  
  Index: mod_perl.h
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/mod_perl.h,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- mod_perl.h	1998/05/17 23:31:53	1.22
  +++ mod_perl.h	1998/05/20 01:33:37	1.23
  @@ -4,8 +4,12 @@
   #include "dirent.h"
   #endif
   
  +#ifndef IS_MODULE
   #define IS_MODULE
  +#endif
  +#ifndef SHARED_MODULE
   #define SHARED_MODULE
  +#endif
   
   #ifdef PERL_THREADS
   #define _INCLUDE_APACHE_FIRST