randyk      2004/08/01 12:44:01

  Modified:    .        Makefile.PL
               lib/ModPerl BuildMM.pm
               lib/Apache Build.pm
               xs/APR/APR Makefile.PL
               xs/APR/aprext Makefile.PL
  Log:
  Reviewed by:  stas
  use a constant Apache::Build::BUILD_APREXT to signify that a static
  aprext lib should be built to provide symbols for APR/APR::* outside
  of the mod_perl.so environment. Currently this is only needed for Win32,
  but this way makes it easier to arrange to have other platforms build
  things in this manner in the future, should the need arise.
  
  Revision  Changes    Path
  1.151     +17 -14    modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.150
  retrieving revision 1.151
  diff -u -r1.150 -r1.151
  --- Makefile.PL       23 Jul 2004 23:24:55 -0000      1.150
  +++ Makefile.PL       1 Aug 2004 19:44:00 -0000       1.151
  @@ -39,6 +39,7 @@
   use ModPerl::BuildMM ();
   
   use constant WIN32 => Apache::Build::WIN32;
  +use constant BUILD_APREXT => Apache::Build::BUILD_APREXT;
   
   our $VERSION;
   
  @@ -165,17 +166,17 @@
       # (see the aprext target in the MY::top_targets sub below), as 
       # symbols must get resolved at link time.
   
  -    if (WIN32()) {
  -        require File::Basename;
  +    if (BUILD_APREXT()) {
           require File::Path;
           #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.
  -        my $lib1 = "src/modules/perl/$build->{MP_LIBNAME}.lib";
  -        my $lib2 = $build->mp_apr_lib;
  -        my $apr_blib = File::Basename::dirname($lib2);
  +        my $lib1 = catfile qw(src modules perl), 
  +            $build->{MP_LIBNAME} . $Config{lib_ext};
  +        my ($apr_blib, $full_libname) = $build->mp_apr_blib();
  +        my $lib2 = catfile $apr_blib, $full_libname;
           unless (-d $apr_blib) {
               File::Path::mkpath($apr_blib) or die "mkdir $apr_blib failed: $!";
           }
  @@ -484,10 +485,12 @@
       system(@args) == 0 or die "system @args failed: $?";
   }
   
  +
   package MY;
   
   use Config;
   use constant WIN32 => $^O eq 'MSWin32';
  +use constant BUILD_APREXT => Apache::Build::BUILD_APREXT;
   
   my $apache_test_install;
   BEGIN {
  @@ -500,24 +503,24 @@
       my $self = shift;
       my $string = $self->ModPerl::BuildMM::MY::top_targets;
   
  -    if (WIN32) {
  +    if (BUILD_APREXT) {
           ModPerl::MM::add_dep(\$string, pure_all => 'aprext');
   
           # must not import File::Spec functions inside MY, it breaks
           # 5.6.x builds
  -        my $from = $build->mp_apr_lib;
  -        my $apr_lib = $build->{MP_APR_LIB} . $Config{lib_ext};
  +        my ($apr_blib, $full_libname) = $build->mp_apr_blib();
  +        my $from = File::Spec->catfile($apr_blib, $full_libname);
           (my $ap_lib = $build->ap_includedir()) =~ s{include$}{lib};
  -        my $to = File::Spec->catfile($ap_lib, $apr_lib);
  -        my $src_dir = File::Spec->catdir(qw(xs APR aprext));
  +        my $to = File::Spec->catfile($ap_lib, $full_libname);
  +        my $src_dir = File::Spec->catdir(qw(xs APR), 'aprext');
           $string .= <<"EOF";
   
   aprext:
  -        cd "$src_dir" && \$(MAKE) all \$(PASTHRU)
  +     cd "$src_dir" && \$(MAKE) all \$(PASTHRU) LINKTYPE="static"
   
   aprext_install:
  -        [EMAIL PROTECTED](MKPATH) "$ap_lib"
  -        \$(CP) "$from" "$to"
  +     [EMAIL PROTECTED](MKPATH) "$ap_lib"
  +     \$(CP) "$from" "$to"
   
   EOF
       }
  @@ -595,7 +598,7 @@
       ModPerl::MM::add_dep(\$string, pure_install => 'modperl_lib_install');
       ModPerl::MM::add_dep(\$string, pure_install => 'modperl_xs_h_install');
       # ModPerl::MM::add_dep(\$string, pure_install => 'aprext_install')
  -    #    if WIN32;
  +    #    if BUILD_APREXT;
   
       ModPerl::MM::add_dep(\$string, pure_install => 'nuke_Apache__test')
             if $apache_test_install;
  
  
  
  1.18      +1 -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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- BuildMM.pm        4 Jul 2004 18:44:49 -0000       1.17
  +++ BuildMM.pm        1 Aug 2004 19:44:00 -0000       1.18
  @@ -79,7 +79,7 @@
   
       my $libs;
       my @libs = ();
  -    if (Apache::Build::WIN32) {
  +    if (Apache::Build::BUILD_APREXT) {
           # in order to decouple APR/APR::* from mod_perl.so,
           # link these modules against the static MP_APR_LIB lib,
           # rather than the mod_perl lib (which would demand mod_perl.so
  
  
  
  1.166     +19 -6     modperl-2.0/lib/Apache/Build.pm
  
  Index: Build.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
  retrieving revision 1.165
  retrieving revision 1.166
  diff -u -r1.165 -r1.166
  --- Build.pm  23 Jul 2004 23:24:55 -0000      1.165
  +++ Build.pm  1 Aug 2004 19:44:00 -0000       1.166
  @@ -37,6 +37,7 @@
   use constant REQUIRE_ITHREADS => grep { $^O eq $_ } qw(MSWin32);
   use constant PERL_HAS_ITHREADS =>
       $Config{useithreads} && ($Config{useithreads} eq 'define');
  +use constant BUILD_APREXT => WIN32();
   
   use ModPerl::Code ();
   use ModPerl::BuildOptions ();
  @@ -1392,17 +1393,29 @@
       $libs->($self);
   }
   
  -sub mp_apr_lib_MSWin32 {
  +# returns the directory and name of the aprext lib built under blib/ 
  +sub mp_apr_blib {
       my $self = shift;
  -    # MP_APR_LIB.lib will be installed into MP_AP_PREFIX/lib
  -    # for use by 3rd party xs modules
  -    my $mp_apr_lib = $self->{MP_APR_LIB};
  +    return unless (my $mp_apr_lib = $self->{MP_APR_LIB});
  +    my $lib_mp_apr_lib = 'lib' . $mp_apr_lib;
       my @dirs = $self->{MP_INST_APACHE2} ?
           qw(blib arch Apache2 auto) : qw(blib arch auto);
  -    return catdir $self->{cwd}, @dirs, $mp_apr_lib, "$mp_apr_lib.lib";
  +    my $apr_blib = catdir $self->{cwd}, @dirs, $lib_mp_apr_lib;
  +    my $full_libname = $lib_mp_apr_lib . $Config{lib_ext};
  +    return ($apr_blib, $full_libname);
  +}
  +
  +sub mp_apr_lib_MSWin32 {
  +    my $self = shift;
  +    # The MP_APR_LIB will be installed into MP_AP_PREFIX/lib
  +    # for use by 3rd party xs modules
  +    my ($dir, $lib) = $self->mp_apr_blib();
  +    $lib =~ s[^lib(\w+)$Config{lib_ext}$][$1];
  +    $dir = Win32::GetShortPathName($dir);
  +    return qq{ -L$dir -l$lib };
   }
   
  -# name of lib used to build APR/APR::*
  +# linking used for the aprext lib used to build APR/APR::*
   sub mp_apr_lib {
       my $self = shift;
       my $libs = \&{"mp_apr_lib_$^O"};
  
  
  
  1.26      +7 -7      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.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- Makefile.PL       4 Jul 2004 18:44:49 -0000       1.25
  +++ Makefile.PL       1 Aug 2004 19:44:01 -0000       1.26
  @@ -10,6 +10,7 @@
   
   use constant WIN32   => Apache::Build::WIN32;
   use constant SOLARIS => $^O eq 'solaris';
  +use constant BUILD_APREXT   => Apache::Build::BUILD_APREXT;
   
   my %args = (
       'NAME'         => 'APR',
  @@ -30,14 +31,13 @@
   }
   
   if (WIN32) {
  -    require File::Basename;
       $libs =~ s{/libpath:}{-L}g;
       $libs =~ s{(\w+)\.lib}{-l$1}g;
  -    # include the static MP_APR_LIB lib
  -    my ($lib, $dir, $ext) =
  -        File::Basename::fileparse($build->mp_apr_lib, qr{\.lib});
  -    $dir =~ s!\\$!!;
  -    $libs .= qq{ -L"$dir" -l$lib };
  +}
  +
  +if (BUILD_APREXT) {
  +    my $mp_apr_lib = $build->mp_apr_lib;
  +    $libs .= qq{ $mp_apr_lib };
   }
   
   if (SOLARIS && $libs) {
  @@ -76,7 +76,7 @@
       $src{$cfile} = "$srcdir/$cfile";
   }
   
  -$args{OBJECT} = WIN32 ? "APR.o" : "APR.o @obj";
  +$args{OBJECT} = BUILD_APREXT() ? "APR.o" : "APR.o @obj";
   $args{clean}  = { FILES => "@clean" };
   
   ModPerl::BuildMM::WriteMakefile(%args);
  
  
  
  1.5       +3 -2      modperl-2.0/xs/APR/aprext/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/APR/aprext/Makefile.PL,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Makefile.PL       4 Jul 2004 18:44:49 -0000       1.4
  +++ Makefile.PL       1 Aug 2004 19:44:01 -0000       1.5
  @@ -20,9 +20,10 @@
   }
   
   my @skip = qw(dynamic test);
  -push @skip, q{static} unless Apache::Build::WIN32;
  +push @skip, q{static}
  +    unless (Apache::Build::BUILD_APREXT);
   
  -my %args = (NAME          => $build->{MP_APR_LIB},
  +my %args = (NAME          => 'lib' . $build->{MP_APR_LIB},
               VERSION_FROM  => '../APR/APR.pm',
               SKIP          =>  [ @skip ] ,
               LINKTYPE      =>  'static',
  
  
  

Reply via email to