It was discussed earlier about renaming the aprext static
library (used to build APR::* outside of mod_perl.so) to
modperl_aprext, and then install it in the Apache2 lib/
directory, so as to be available to 3rd party modules. The
following diff does that. I've created an aprext_libs sub
within Apache::Build to return the name of the library (in
analogy with the apache_libs and modperl_libs subs); this is
more as a placeholder for the future, when subclasses
containing platform-specific code for Win32 are made.

And I kept in mind to use File::Spec->catdir within
a MY ...

========================================================
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
retrieving revision 1.141
diff -u -r1.141 Makefile.PL
--- Makefile.PL 30 Jun 2004 22:54:53 -0000      1.141
+++ Makefile.PL 1 Jul 2004 04:53:37 -0000
@@ -151,17 +151,17 @@
     $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 modperl_aprext 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
+    # modperl_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
@@ -171,11 +171,11 @@
         # 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 $apr_blib = catdir qw(blib arch Apache2 auto modperl_aprext);
         unless (-d $apr_blib) {
             File::Path::mkpath($apr_blib) or die "mkdir $apr_blib failed: $!";
         }
-        my $lib2 = catfile $apr_blib, 'aprext.lib';
+        my $lib2 = catfile $apr_blib, "modperl_aprext.lib";
         foreach my $lib ($lib1, $lib2) {
             unless (-e $lib) {
                 open my $fh, '>', $lib or die "open $lib: $!";
@@ -490,11 +490,18 @@

         # must not import File::Spec functions inside MY, it breaks
         # 5.6.x builds
-        my $aprext = File::Spec->catdir(qw(xs APR aprext));
+        my $libname = 'modperl_aprext' . $Config{lib_ext};
+        my $src_dir = File::Spec->catdir(qw(xs APR aprext));
+        my $dest_dir = File::Spec->catdir(qw(blib arch Apache2 auto modperl_aprext));
+        (my $mp_ap_lib = $build->ap_includedir()) =~ s{include$}{lib};
         $string .= <<"EOF";

 aprext:
-        cd "$aprext" && \$(MAKE) -f \$(FIRST_MAKEFILE) all \$(PASTHRU)
+        cd "$src_dir" && \$(MAKE) -f \$(FIRST_MAKEFILE) all \$(PASTHRU)
+
+aprext_install:
+       [EMAIL PROTECTED](MKPATH) "$mp_ap_lib"
+        \$(CP) "$dest_dir/$libname" "$mp_ap_lib/$libname"

 EOF
     }
@@ -566,6 +573,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;
Index: lib/Apache/Build.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
retrieving revision 1.163
diff -u -r1.163 Build.pm
--- lib/Apache/Build.pm 16 Jun 2004 03:55:46 -0000      1.163
+++ lib/Apache/Build.pm 1 Jul 2004 04:53:40 -0000
@@ -1349,6 +1349,20 @@
     $libs->($self);
 }

+sub aprext_libs_MSWin32 {
+    my $self = shift;
+    # modperl_aprext.lib will be installed into MP_AP_PREFIX/lib
+    # for use by 3rd party xs modules
+    "$self->{cwd}/blib/arch/Apache2/auto/modperl_aprext/modperl_aprext.lib";
+}
+
+sub aprext_libs {
+    my $self = shift;
+    my $libs = \&{"aprext_libs_$^O"};
+    return "" unless defined &$libs;
+    $libs->($self);
+}
+
 sub modperl_symbols_MSWin32 {
     my $self = shift;
     return "" unless $self->{MP_DEBUG};
Index: lib/ModPerl/BuildMM.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/ModPerl/BuildMM.pm,v
retrieving revision 1.16
diff -u -r1.16 BuildMM.pm
--- lib/ModPerl/BuildMM.pm      26 Jun 2004 19:41:53 -0000      1.16
+++ lib/ModPerl/BuildMM.pm      1 Jul 2004 04:53:40 -0000
@@ -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 modperl_aprext 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->aprext_libs);
         }
         else {
             @libs = ($build->apache_libs, $build->modperl_libs);
Index: xs/APR/APR/Makefile.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/APR/APR/Makefile.PL,v
retrieving revision 1.24
diff -u -r1.24 Makefile.PL
--- xs/APR/APR/Makefile.PL      1 Jul 2004 01:42:52 -0000       1.24
+++ xs/APR/APR/Makefile.PL      1 Jul 2004 04:53:40 -0000
@@ -33,8 +33,9 @@
     $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 };
+    my $aprext = catdir $build->{cwd},
+        qw(blib arch Apache2 auto modperl_aprext);
+    $libs .= qq{ -L"$aprext" -lmodperl_aprext };
 }

 if (SOLARIS && $libs) {
Index: xs/APR/aprext/Makefile.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/APR/aprext/Makefile.PL,v
retrieving revision 1.3
diff -u -r1.3 Makefile.PL
--- xs/APR/aprext/Makefile.PL   1 Jul 2004 01:42:52 -0000       1.3
+++ xs/APR/aprext/Makefile.PL   1 Jul 2004 04:53:40 -0000
@@ -20,7 +20,7 @@
 my @skip = qw(dynamic test);
 push @skip, q{static} unless Apache::Build::WIN32;

-my %args = (NAME          => 'aprext',
+my %args = (NAME          => 'modperl_aprext',
             VERSION_FROM  => '../APR/APR.pm',
             SKIP          =>  [ @skip ] ,
             LINKTYPE      =>  'static',

============================================================

-- 
best regards,
randy


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to