perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ran...@apache.org
Subject cvs commit: modperl-2.0/xs/APR/aprext Makefile.PL .cvsignore
Date Sat, 26 Jun 2004 19:41:54 GMT
randyk      2004/06/26 12:41:54

  Modified:    .        Makefile.PL
               lib/ModPerl BuildMM.pm
               xs/APR/APR Makefile.PL
  Added:       xs/APR/aprext Makefile.PL .cvsignore
  Log:
  Reviewed by:	stas
  On Win32, in order to decouple the APR/APR::* modules from mod_perl.so,
  build a static library aprext.lib from the symbols needed from
  src/modules/perl/*.c and link APR/APR::* against this library,
  rather than against mod_perl.lib.
  
  Revision  Changes    Path
  1.139     +21 -6     modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.138
  retrieving revision 1.139
  diff -u -r1.138 -r1.139
  --- Makefile.PL	21 Jun 2004 06:45:54 -0000	1.138
  +++ Makefile.PL	26 Jun 2004 19:41:53 -0000	1.139
  @@ -149,17 +149,32 @@
   
       $build->generate_apache2_pm;
   
  +    # On Win32, in order to decouple APR::* from mod_perl.so, we
  +    # make up a static library aprext.lib of the symbols required from
  +    # src/modules/perl/*.c (see xs/APR/aprext/Makefile.PL), and
  +    # then link APR/APR::* against this library. The reason for
  +    # this is that, unlike Unix, if we had linked APR/APR::* against
  +    # mod_perl.lib, then use of APR/APR::* would demand mod_perl.so
  +    # be available, even if these symbols are supplied by another
  +    # loaded library (which is done for unix by APR.so - see
  +    # xs/APR/APR/Makefile.PL). This also means we must ensure aprext.lib
  +    # is built before any of the APR/APR::* modules (see the aprext
  +    # target in the MY::top_targets sub below), as symbols must
  +    # get resolved at link time.
  +
       if (WIN32()) {
           #Makefile.PL's in WrapXS/ just need to pass the -e mod_perl.lib test
           #the real mod_perl.lib will be in place when WrapXS/ dll's are
           #actually linked
  +        # this must also be done for aprext.lib, build in xs/APR/aprext/;
  +        # we must create a dummy aprext.lib to pass the -e test.
           require File::Path;
           my $lib1 = "src/modules/perl/$build->{MP_LIBNAME}.lib";
  -        my $apr_blib = catdir qw(blib arch Apache2 auto APR);
  +        my $apr_blib = catdir qw(blib arch Apache2 auto aprext);
           unless (-d $apr_blib) {
               File::Path::mkpath($apr_blib) or die "mkdir $apr_blib failed: $!";
           }
  -        my $lib2 = catfile $apr_blib, 'APR.lib';
  +        my $lib2 = catfile $apr_blib, 'aprext.lib';
           foreach my $lib ($lib1, $lib2) {
               unless (-e $lib) {
                   open my $fh, '>', $lib or die "open $lib: $!";
  @@ -471,13 +486,13 @@
       my $string = $self->ModPerl::BuildMM::MY::top_targets;
   
       if (WIN32) {
  -        ModPerl::MM::add_dep(\$string, pure_all => 'apr_lib');
  +        ModPerl::MM::add_dep(\$string, pure_all => 'aprext');
   
  -        my $apr_lib = catdir qw(xs APR APR);
  +        my $aprext = catdir qw(xs APR aprext);
           $string .= <<"EOF";
   
  -apr_lib:
  -	cd "$apr_lib" && \$(MAKE) -f \$(FIRST_MAKEFILE) all \$(PASTHRU)
  +aprext:
  +        cd "$aprext" && \$(MAKE) -f \$(FIRST_MAKEFILE) all \$(PASTHRU)
   
   EOF
       }
  
  
  
  1.16      +23 -1     modperl-2.0/lib/ModPerl/BuildMM.pm
  
  Index: BuildMM.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/BuildMM.pm,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- BuildMM.pm	4 Mar 2004 06:01:06 -0000	1.15
  +++ BuildMM.pm	26 Jun 2004 19:41:53 -0000	1.16
  @@ -77,7 +77,29 @@
           }
       }
   
  -    my $libs = join ' ', $build->apache_libs, $build->modperl_libs;
  +    my $libs;
  +    my @libs = ();
  +    if (Apache::Build::WIN32) {
  +        # in order to decouple APR/APR::* from mod_perl.so,
  +        # link these modules against the static aprext.lib,
  +        # rather than mod_perl.lib (which would demand mod_perl.so
  +        # be available). For other modules, use mod_perl.lib as
  +        # usual. This is done for APR in xs/APR/APR/Makefile.PL.
  +        my $aprext = catfile $build->{cwd},
  +            qw(blib arch Apache2 auto aprext aprext.lib);
  +        my $name = $args{NAME};
  +        if ($name =~ /^APR::\w+$/) {
  +            @libs = ($build->apache_libs, $aprext);
  +        }
  +        else {
  +            @libs = ($build->apache_libs, $build->modperl_libs);
  +        }
  +    }
  +    else {
  +        @libs = ($build->apache_libs, $build->modperl_libs);
  +    }
  +    $libs = join ' ', @libs;
  +
       my $ccflags = $build->perl_ccopts . $build->ap_ccopts;
   
       my @opts = (
  
  
  
  1.22      +5 -1      modperl-2.0/xs/APR/APR/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/APR/APR/Makefile.PL,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Makefile.PL	22 Jun 2004 22:09:27 -0000	1.21
  +++ Makefile.PL	26 Jun 2004 19:41:54 -0000	1.22
  @@ -5,6 +5,7 @@
   use ModPerl::BuildMM ();
   use Apache::Build ();
   use Config;
  +use File::Spec::Functions;
   
   use constant WIN32   => Apache::Build::WIN32;
   use constant SOLARIS => $^O eq 'solaris';
  @@ -30,6 +31,9 @@
   if (WIN32) {
       $libs =~ s{/libpath:}{-L}g;
       $libs =~ s{(\w+)\.lib}{-l$1}g;
  +    # include the static aprext.lib
  +    my $aprext = catdir $build->{cwd}, qw(blib arch Apache2 auto aprext);
  +    $libs .= qq{ -L"$aprext" -laprext };
   }
   
   if (SOLARIS && $libs) {
  @@ -68,7 +72,7 @@
       $src{$cfile} = "$srcdir/$cfile";
   }
   
  -$args{OBJECT} = "APR.o @obj";
  +$args{OBJECT} = WIN32 ? "APR.o" : "APR.o @obj";
   $args{clean}  = { FILES => "@clean" };
   
   ModPerl::BuildMM::WriteMakefile(%args);
  
  
  
  1.1                  modperl-2.0/xs/APR/aprext/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  use strict;
  use warnings;
  
  use lib qw(../lib);
  use ModPerl::BuildMM ();
  use Apache::Build ();
  
  my $srcdir = '../../../src/modules/perl';
  my @names = map { "modperl_$_" } (qw(error bucket),
                                    map { "common_$_" } qw(util log));
  my(@obj, @clean, %src);
  for (@names) {
      push @obj, join '.', $_, 'o';
      my $cfile = join '.', $_, 'c';
      push @clean, $cfile;
      $src{$cfile} = "$srcdir/$cfile";
  }
  
  my @skip = qw(dynamic test);
  push @skip, q{static} unless Apache::Build::WIN32;
  
  my %args = (NAME          => 'aprext',
              VERSION_FROM  => '../APR/APR.pm',
              SKIP          =>  [ @skip ] ,
              LINKTYPE      =>  'static',
              OBJECT        => "@obj",
              clean         => { FILES => "@clean" },
  	   );
  
  ModPerl::BuildMM::WriteMakefile(%args);
  
  sub MY::postamble {
      my $self = shift;
      my $string = $self->ModPerl::BuildMM::MY::postamble;
  
      $string .= join '', map {
          "$_: $src{$_}\n\t\$(CP) $src{$_} .\n";
      } keys %src;
      return $string;
  }
  
  
  
  1.1                  modperl-2.0/xs/APR/aprext/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  pm_to_blib
  Makefile
  *.c
  *.bs
  glue_pods
  blibdirs
  
  
  
  

Mime
View raw message