perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject Re: Trying to test current apreq2 CVS
Date Sun, 04 Jul 2004 17:16:46 GMT
[ trimmed apreq-dev from cc list ]
On Sun, 4 Jul 2004, Markus Wichitill wrote:

> >> C:\A\modperl-2.0\blib\arch\Apache2\auto\aprext\aprext.lib : fatal error
> >> LNK1136: invalid or corrupt file
> > Is this with the current mp2 cvs?
>
> Yes.
>
> > - was aprext.lib built (shortly after building mod_perl.so)?
> > - if so, was it put under
> >      C:\A\modperl-2.0\blib\arch\Apache2\auto\aprext\
> >   If not, can you find where?
>
> It's built and put under blib\arch\auto\aprext.
>
> I don't use MP_INST_APACHE2 BTW.

Sorry about that - in the cvs I was assuming MP_INST_APACHE2
was being used. Could you try the following patch against
the mod_perl 2 cvs? I'll also send it to you (privately) as
an attachment, in case you have trouble applying it. Thanks.
==================================================================
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	4 Jul 2004 16:03:02 -0000
@@ -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) -f \$(FIRST_MAKEFILE) all \$(PASTHRU)
+
+aprext_install:
+        \@\$(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;
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	4 Jul 2004 16:03:05 -0000
@@ -703,6 +703,8 @@
         @_,
     }, $class;

+    $self->{MP_APR_LIB} = WIN32 ? '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);
 }
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	4 Jul 2004 16:03:05 -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 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);
Index: lib/ModPerl/BuildOptions.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/ModPerl/BuildOptions.pm,v
retrieving revision 1.26
diff -u -r1.26 BuildOptions.pm
--- lib/ModPerl/BuildOptions.pm	4 Mar 2004 06:01:06 -0000	1.26
+++ lib/ModPerl/BuildOptions.pm	4 Jul 2004 16:03:05 -0000
@@ -226,4 +226,4 @@
 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)
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	4 Jul 2004 16:03:05 -0000
@@ -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) {
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	4 Jul 2004 16:03:05 -0000
@@ -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',

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

-- 
best regards,
randy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message