perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@hyperreal.org
Subject cvs commit: modperl/apaci load_modules.pl.PL Makefile.tmpl
Date Mon, 08 Jun 1998 01:01:29 GMT
dougm       98/06/07 18:01:29

  Modified:    .        MANIFEST Makefile.PL
               apaci    Makefile.tmpl
  Added:       apaci    load_modules.pl.PL
  Log:
  improve ap{aci,dso,xs} support:
  
  perl Makefile.PL USE_APACI=1
  
  now works just like the old 'perl Makefile.PL'
  
  if you don't want Makefile.PL to build httpd:
  perl Makefile.PL USE_APACI=1 NO_HTTPD=1
  
  ----
  
  perl Makefile.PL USE_DSO=1
  
  works just USE_APACI=1 but passes `--enable-shared=perl' to the
  configure script.
  
  See apache/load_modules.pl.PL, which will attempt to add all the
  .so modules to the t/conf/httpd.conf for 'make test'.  httpd starts
  okay now, but when running the tests, all fail and
  /tmp/mod_perl_error_log says:
  "...handler "perl-script" not found, using default handler ..."
  
  ---
  
  perl Makefile.PL USE_APXS=/opt/apache/sbin/apxs
  runs apaci/configure ...
  Does not try to build any httpd.
  
  'make' will (cd ./apaci && make)
  'make install' will (cd ./apaci && make install)
  'make test' will echo can't make test with apxs (yet)
  
  ---
  
  APACI_ARGS=... can be passed to Makefile.PL or present in
  .makepl_args.mod_perl for the configure script, like so:
  APACI_ARGS=--prefix=/opt/apache,--enable-module=most,--enable-shared=max
  
  ---
  
  added a .xs.lo rule in Makefile.tmpl, hpux build failed otherwise
  
  Revision  Changes    Path
  1.19      +1 -0      modperl/MANIFEST
  
  Index: MANIFEST
  ===================================================================
  RCS file: /export/home/cvs/modperl/MANIFEST,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- MANIFEST	1998/05/29 22:07:41	1.18
  +++ MANIFEST	1998/06/08 01:01:27	1.19
  @@ -165,6 +165,7 @@
   apaci/libperl.module
   apaci/mod_perl.config
   apaci/mod_perl.config.sh
  +apaci/load_modules.pl.PL
   .gdbinit
   INSTALL.simple
   INSTALL.simple.ssl
  
  
  
  1.38      +83 -13    modperl/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /export/home/cvs/modperl/Makefile.PL,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- Makefile.PL	1998/06/07 17:58:40	1.37
  +++ Makefile.PL	1998/06/08 01:01:27	1.38
  @@ -112,7 +112,9 @@
       NONE => "", 
   );	     
   
  -$USE_APACI = 0;
  +$USE_APACI = $USE_DSO = $USE_APXS = 0;
  +$WITH_APXS = "";
  +$APACI_ARGS = "";
   $EVERYTHING = 0;
   $PERL_DEBUG = "";
   $PERL_DESTRUCT_LEVEL = "";
  @@ -147,7 +149,8 @@
   };
   
   my @mp_args = 
  -    qw(EVERYTHING DO_HTTPD NO_HTTPD CONFIG ADD_MODULE USE_APACI
  +    qw(EVERYTHING DO_HTTPD NO_HTTPD CONFIG ADD_MODULE 
  +       USE_APACI USE_DSO USE_APXS APACI_ARGS
          ALL_HOOKS ADD_VERSION STATIC DYNAMIC PORT);
   
   sub is_mp_arg {
  @@ -215,8 +218,22 @@
       $callback_hooks{$k} = $v if exists $callback_hooks{$k};
   }
   
  -if($USE_APACI) {
  -    print "Will configure via APACI\n";
  +$USE_APACI = 1 if $USE_DSO;
  +
  +if($USE_APXS) {
  +    $WITH_APXS = $USE_APXS if -e $USE_APXS;
  +    print "Will configure via APXS";
  +    print " (apxs=$WITH_APXS)" if $WITH_APXS;
  +    print "\n";
  +    ++$NO_HTTPD;
  +}
  +elsif($USE_APACI) {
  +    print "Will configure via APACI";
  +    if($USE_DSO) {
  +        gen_script("apaci/load_modules.pl");
  +        print " (dso enabled)";
  +    }
  +    print "\n";
   }
   
   @ARGV = @mm_args;
  @@ -264,6 +281,12 @@
       win32_setup();
   } 
   
  +if($USE_APXS) {
  +    my $cmd = "./configure --with-perl=$^X";
  +    $cmd .= " --with-apxs=$WITH_APXS" if $WITH_APXS;
  +    system "(cd apaci && $cmd)";
  +}
  +
   unless ($NO_HTTPD) {
   for $src_dir ($APACHE_SRC, <../apache*/src>, 
       <../stronghold*/src>, </usr/local/stronghold*/src>,
  @@ -316,7 +339,7 @@
   	    $IsBenSSL = -e "$adir/apache_ssl.c";
   	    last unless(-e $conf || -e "$conf.tmpl"); #building from 'make offsite-tar' 
   	}
  -	++$NO_HTTPD if $USE_APACI;
  +	#++$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;
  @@ -368,7 +391,7 @@
   	    }
   	}
   
  -	last if $NO_HTTPD or $USE_APACI;
  +	last if $NO_HTTPD; # or $USE_APACI;
   
   	if($PERL_EXTRA_CFLAGS) {
   	    $PERL_EXTRA_CFLAGS = join(" ", split(",",  $PERL_EXTRA_CFLAGS));
  @@ -406,9 +429,21 @@
   	}
       }
   
  +    ($APACHE_ROOT = $APACHE_SRC) =~ s,/src/?$,,;
  +
       if ($NO_HTTPD) {
   
       }
  +    elsif($USE_APACI) {
  +	my $cmd = "./configure --activate-module=src/modules/perl/libperl.a";
  +	if($USE_DSO) {
  +	    $cmd .= " --enable-shared=perl";
  +	}
  +	if($APACI_ARGS) {
  +	    $cmd .= " " . join " ", split(',', $APACI_ARGS);
  +	}
  +	system "(cd $APACHE_ROOT && $cmd)";
  +    }
       else {
   	$conf = "src/Configuration";
   	my($dash_make, $cfgfile);
  @@ -644,8 +679,11 @@
   unless (-e "t/net/config.pl") {
       cp "t/net/config.pl.dist", "t/net/config.pl";
   }
  +unless($Is_Win32 or -e "t/conf/httpd.conf" or $NO_HTTPD) {
  +    init_tests_and_config();
  +}
   
  -unless($Is_Win32 or -e "t/conf/httpd.conf") {
  +sub init_tests_and_config {
       cp "t/conf/httpd.conf-dist", "t/conf/httpd.conf";
       chmod 0644, "t/conf/httpd.conf";
   
  @@ -890,16 +928,37 @@
       $string;
   }
   
  +sub MY::install {
  +    my $self = shift;
  +    my $string = $self->MM::install;
  +    return $string unless $USE_APXS;
  +    $string =~ s/(pure_install\s+)(.*)/$1 apxs_install $2/;
  +    return $string;
  +}
  +
   sub MY::top_targets {
       my $self = shift;
       my $string = $self->MM::top_targets;
  -    return $string unless $APACHE_SRC and -f "$APACHE_SRC/$Configuration";
  -    my $asrc = asrc($APACHE_SRC, "http_main.c");
  -    if(-e "$asrc/http_main.c" and !$NO_HTTPD) {
  -        $string =~ s/(pure_all\s+::\s+)(.*)/$1 apache_httpd $2/;
  +    return $string unless $USE_APXS or $APACHE_SRC;
  +
  +    if($APACHE_SRC) {
  +	return $string unless -f "$APACHE_SRC/$Configuration";
  +	my $asrc = asrc($APACHE_SRC, "http_main.c");
  +	if(-e "$asrc/http_main.c" and !$NO_HTTPD) {
  +	    $string =~ s/(pure_all\s+::\s+)(.*)/$1 apache_httpd $2/;
  +	}
       }
  +    if($USE_APXS) {
  +	    $string =~ s/(pure_all\s+::\s+)(.*)/$1 apxs_libperl $2/;
  +    }
       $string .= <<'EOF';
   
  +apxs_libperl:
  +	(cd ./apaci && $(MAKE) CC="$(CC)";)
  +
  +apxs_install: apxs_libperl
  +	(cd ./apaci && $(MAKE) install;)
  +
   apache_httpd: $(APACHE_SRC)/Makefile.tmpl
   	(cd $(APACHE_SRC) && $(MAKE) CC="$(CC)";)
   
  @@ -934,6 +993,13 @@
   }
   
   sub MY::test {
  +    my $self = shift;
  +    my $test = $self->MM::test;
  +    return <<'EOF' if $USE_APXS;
  +test:
  +	@echo can't make test with apxs (yet)
  +EOF
  +
       my $script = "t/TEST";
       $script .= ".win32" if $Is_Win32;
       my $my_test = $Is_Win32 ? q(
  @@ -947,7 +1013,9 @@
   test:	pure_all start_httpd run_tests kill_httpd
   
   );
  -
  +    push @test_pre_init, "\t", 
  +    './apaci/load_modules.pl $(APACHE_SRC)', "\n" if $USE_DSO;
  + 
       join '', @test_pre_init,
       qq(
   MP_TEST_SCRIPT=$script
  @@ -1324,6 +1392,8 @@
   
   sub conf_fixup {
       my($mf, $cfg) = @_;
  +    return if $USE_APACI;
  +
       my $mmn    = magic_number($APACHE_SRC);
       #source re-org
       my $sro = 1 if $mmn >= 19970825;
  @@ -1518,7 +1588,7 @@
       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;
  +	#return undef;
       }
   
       my $apaci_cfg = FileHandle->new(">$lib_cfg") or 
  
  
  
  1.5       +4 -0      modperl/apaci/Makefile.tmpl
  
  Index: Makefile.tmpl
  ===================================================================
  RCS file: /export/home/cvs/modperl/apaci/Makefile.tmpl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Makefile.tmpl	1998/06/04 14:54:51	1.4
  +++ Makefile.tmpl	1998/06/08 01:01:28	1.5
  @@ -74,6 +74,10 @@
   	$(MP_XSUBPP) $*.xs >$*.c
   	$(MP_CC) $(MP_CFLAGS) -c $*.c
   
  +.xs.lo:
  +	$(MP_XSUBPP) $*.xs >$*.c
  +	$(MP_CC) $(MP_CFLAGS_SHLIB) -c $*.c && mv $*.o $*.lo
  +
   perlxsi.c:
   	$(MP_XSINIT) -- -o perlxsi.c -std $(MP_STATIC_EXTS)
   
  
  
  
  1.1                  modperl/apaci/load_modules.pl.PL
  
  Index: load_modules.pl.PL
  ===================================================================
  use File::Find;
  use strict;
  my $APACHE_SRC = shift;
  
  my $LoadModule_conf = "t/conf/LoadModule.conf";
  my $tmp = "t/conf/httpd.conf.new";
  my $orig = "t/conf/httpd.conf";
  
  local *ORIG;
  open ORIG, $orig or die "can't open $orig $!";
  while(<ORIG>) {
      if(/^LoadModule/) {
  	exit 0; #already cat-ed
      } 
  }
  unless (-d "t") {
      chdir "..";
  }
  #phooey, this mess should have been cleaned up before 1.3.0
  my $name_map = {
      log_config => "config_log",
      include => "includes",
      actions => "action",
      auth_anon => "anon_auth",
      auth_dbm => "dbm_auth",
  };
  
  my @sh_mods = ();
  finddepth(sub {
      return unless /(mod_|lib)(.*)\.s[ol]$/;
      my $name = $name_map->{$2} || $2;
      my $full = "$File::Find::dir/$_";
      if($full !~ m,^/,) {
  	if($full =~ m,^\.\./,) {
  	    $full = "../$full";
  	}
      }
      push @sh_mods, "LoadModule ${name}_module $full";
  }, $APACHE_SRC);
  
  my($perl_mod) = grep /perl/, @sh_mods;
  unshift @sh_mods, $perl_mod; #must come before mod_include/USE_PERL_SSI
    
  local *FH;
  open FH, ">$LoadModule_conf" or
      die "can't open $LoadModule_conf $!";
  print FH join "\n", @sh_mods, "";
  close FH;
  
  system "cat $LoadModule_conf $orig > $tmp && mv $tmp $orig";
  
  
  
  

Mime
View raw message