randyk 2004/07/04 11:44:49
Modified: . Makefile.PL
lib/Apache Build.pm
lib/ModPerl BuildMM.pm BuildOptions.pm
xs/APR/APR Makefile.PL
xs/APR/aprext Makefile.PL
Log:
Reviewed by: stas
some further tweaks to the building of the static library on Win32
(and potentially others) used by APR/APR::* to resolve symbols outside
of mod_perl.so:
- have the name of the library as a configurable option (default: aprext);
- adjust location of the built library under blib/ to take into account
the fact that MP_INST_APACHE2 may not have been used;
- make an install target to install this library under the Apache2 lib/
directory (but don't implement it yet under 'make install;);
Revision Changes Path
1.142 +22 -11 modperl-2.0/Makefile.PL
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -r1.141 -r1.142
--- Makefile.PL 30 Jun 2004 22:54:53 -0000 1.141
+++ Makefile.PL 4 Jul 2004 18:44:49 -0000 1.142
@@ -151,31 +151,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
+ # make up a static library MP_APR_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
+ # the 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.
+ # xs/APR/APR/Makefile.PL). This also means we must ensure the
+ # MP_APR_LIB 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()) {
+ require File::Basename;
+ 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.
- require File::Path;
my $lib1 = "src/modules/perl/$build->{MP_LIBNAME}.lib";
- my $apr_blib = catdir qw(blib arch Apache2 auto aprext);
+ my $lib2 = $build->mp_apr_lib;
+ my $apr_blib = File::Basename::dirname($lib2);
unless (-d $apr_blib) {
File::Path::mkpath($apr_blib) or die "mkdir $apr_blib failed: $!";
}
- my $lib2 = catfile $apr_blib, 'aprext.lib';
foreach my $lib ($lib1, $lib2) {
unless (-e $lib) {
open my $fh, '>', $lib or die "open $lib: $!";
@@ -490,11 +491,19 @@
# must not import File::Spec functions inside MY, it breaks
# 5.6.x builds
- my $aprext = File::Spec->catdir(qw(xs APR aprext));
+ my $from = $build->mp_apr_lib;
+ my $apr_lib = $build->{MP_APR_LIB} . $Config{lib_ext};
+ (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));
$string .= <<"EOF";
aprext:
- cd "$aprext" && \$(MAKE) -f \$(FIRST_MAKEFILE) all \$(PASTHRU)
+ cd "$src_dir" && \$(MAKE) all \$(PASTHRU)
+
+aprext_install:
+ [EMAIL PROTECTED](MKPATH) "$ap_lib"
+ \$(CP) "$from" "$to"
EOF
}
@@ -566,6 +575,8 @@
my $string = $self->MM::install(@_);
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;
ModPerl::MM::add_dep(\$string, pure_install => 'nuke_Apache__test')
if $apache_test_install;
1.164 +20 -0 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.163
retrieving revision 1.164
diff -u -r1.163 -r1.164
--- Build.pm 16 Jun 2004 03:55:46 -0000 1.163
+++ Build.pm 4 Jul 2004 18:44:49 -0000 1.164
@@ -703,6 +703,8 @@
@_,
}, $class;
+ $self->{MP_APR_LIB} = 'aprext';
+
ModPerl::BuildOptions->init($self) if delete $self->{init};
$self;
@@ -1345,6 +1347,24 @@
sub modperl_libs {
my $self = shift;
my $libs = \&{"modperl_libs_$^O"};
+ return "" unless defined &$libs;
+ $libs->($self);
+}
+
+sub mp_apr_lib_MSWin32 {
+ 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};
+ 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";
+}
+
+# name of lib used to build APR/APR::*
+sub mp_apr_lib {
+ my $self = shift;
+ my $libs = \&{"mp_apr_lib_$^O"};
return "" unless defined &$libs;
$libs->($self);
}
1.17 +3 -5 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.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- BuildMM.pm 26 Jun 2004 19:41:53 -0000 1.16
+++ BuildMM.pm 4 Jul 2004 18:44:49 -0000 1.17
@@ -81,15 +81,13 @@
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
+ # link these modules against the static MP_APR_LIB lib,
+ # rather than the 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);
+ @libs = ($build->apache_libs, $build->mp_apr_lib);
}
else {
@libs = ($build->apache_libs, $build->modperl_libs);
1.27 +1 -0 modperl-2.0/lib/ModPerl/BuildOptions.pm
Index: BuildOptions.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/ModPerl/BuildOptions.pm,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- BuildOptions.pm 4 Mar 2004 06:01:06 -0000 1.26
+++ BuildOptions.pm 4 Jul 2004 18:44:49 -0000 1.27
@@ -226,4 +226,5 @@
GENERATE_XS 0 Generate XS code based on httpd version
LIBNAME 0 Name of the modperl dso library (default is mod_perl)
COMPAT_1X 0 Compile-time mod_perl 1.0 backcompat (default is on)
+APR_LIB 0 Lib used to build APR::* on Win32 (default is aprext)
1.25 +6 -3 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.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- Makefile.PL 1 Jul 2004 01:42:52 -0000 1.24
+++ Makefile.PL 4 Jul 2004 18:44:49 -0000 1.25
@@ -30,11 +30,14 @@
}
if (WIN32) {
+ require File::Basename;
$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 };
+ # 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 (SOLARIS && $libs) {
1.4 +3 -1 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Makefile.PL 1 Jul 2004 01:42:52 -0000 1.3
+++ Makefile.PL 4 Jul 2004 18:44:49 -0000 1.4
@@ -6,6 +6,8 @@
require ModPerl::Code;
use Apache::Build ();
+my $build = ModPerl::BuildMM::build_config();
+
my $srcdir = '../../../src/modules/perl';
my @names = ModPerl::Code::src_apr_ext();
@@ -20,7 +22,7 @@
my @skip = qw(dynamic test);
push @skip, q{static} unless Apache::Build::WIN32;
-my %args = (NAME => 'aprext',
+my %args = (NAME => $build->{MP_APR_LIB},
VERSION_FROM => '../APR/APR.pm',
SKIP => [ @skip ] ,
LINKTYPE => 'static',