I've attached two files implementing a build for Win32
concerning the splitting of AP::* from mod_perl.so. They're
attached because:
- win32.diff contains some tabs needed in a Makefile
- the Makefile.PL is to go under a new directory
xs/APR/aprext/
and I wasn't sure how to do a diff with cvs for such a file
without creating the directory first, which I didn't want to
do in case there's a better location for it.
Basically what's done here (all for just Win32) is to build
a static library (aprext.lib) from the src/modules/perl/*.c
files presently compiled into APR.so (and subsequently skip
adding these files into APR.dll for Win32). APR/APR::* are
then linked against this library. The library is built under
xs/APR/aprext/, although that can easily be changed if
desired. With this, all the tests pass (except for
protocol/echo_timeout, which hangs, but this happens on unix
multi-threads too, I gather). It also passes all the
additional apr-ext tests I sent in a couple of recent
messages, both via 'nmake test' and via 'perl t/TEST
--no-httpd apr-ext'.
There is one change that unix will see (although I tested it
on my linux box, and everything's still OK). Unix will want
to build xs/APR/aprext/, and expects a Makefile to be
present after 'perl Makefile.PL'. I couldn't see how to tell
it to skip this, so what this patch does for unix is to
write out a Makefile with a SKIP MakeMaker attribute which
skips both the dynamic and static targets, which seems to
have the desired effect of nothing happening for unix.
Another way to do this is to add a top-level target just for
Win32, but I wasn't sure if this was desired. Of course, if
there's a better way ...?
I guess once this is sorted out for Win32, we can try asking
for an AIX tester, to see if similar gymnastics are needed
there.
--
best regards,
randy
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
retrieving revision 1.138
diff -u -r1.138 Makefile.PL
--- Makefile.PL 21 Jun 2004 06:45:54 -0000 1.138
+++ Makefile.PL 26 Jun 2004 06:28:38 -0000
@@ -155,11 +155,11 @@
#actually linked
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 +471,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
}
Index: lib/ModPerl/BuildMM.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/ModPerl/BuildMM.pm,v
retrieving revision 1.15
diff -u -r1.15 BuildMM.pm
--- lib/ModPerl/BuildMM.pm 4 Mar 2004 06:01:06 -0000 1.15
+++ lib/ModPerl/BuildMM.pm 26 Jun 2004 06:28:38 -0000
@@ -77,7 +77,24 @@
}
}
- my $libs = join ' ', $build->apache_libs, $build->modperl_libs;
+ my $libs;
+ my @libs = ();
+ if (Apache::Build::WIN32) {
+ 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 = (
Index: xs/APR/APR/Makefile.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/APR/APR/Makefile.PL,v
retrieving revision 1.21
diff -u -r1.21 Makefile.PL
--- xs/APR/APR/Makefile.PL 22 Jun 2004 22:09:27 -0000 1.21
+++ xs/APR/APR/Makefile.PL 26 Jun 2004 06:28:38 -0000
@@ -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,8 @@
if (WIN32) {
$libs =~ s{/libpath:}{-L}g;
$libs =~ s{(\w+)\.lib}{-l$1}g;
+ my $aprext = catdir $build->{cwd}, qw(blib arch Apache2 auto aprext);
+ $libs .= qq{ -L"$aprext" -laprext };
}
if (SOLARIS && $libs) {
@@ -68,7 +71,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);
use strict;
use warnings;
use lib qw(../lib);
use ModPerl::BuildMM ();
use Apache::Build ();
use File::Spec::Functions;
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;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]