stas 2003/08/12 16:13:20
Modified: . Makefile.PL
lib/Apache Build.pm
t/apr-ext uuid.t
xs/APR/APR Makefile.PL
Log:
build tweaks to support interactive build, when the source dir is picked
from the user's input and not provided by MP_AP_PREFIX
- also gracefully handle the case when mod_perl is built against the httpd
source tree, in which case we can't quite link against apr libs. (at least
for now)
Revision Changes Path
1.121 +9 -5 modperl-2.0/Makefile.PL
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -r1.120 -r1.121
--- Makefile.PL 12 Aug 2003 21:07:48 -0000 1.120
+++ Makefile.PL 12 Aug 2003 23:13:19 -0000 1.121
@@ -87,15 +87,18 @@
sub get_DEFINE {
+ my $opt_define = '';
+
# do we have apr libs?
# XXX: this define is really needed in xs/APR/APR/Makefile.PL, but this
# top-level Makefile.PL overrides MY::pasthru, and defines DEFINE= which
# overrides any local definition, not sure what's the right fix, for
# now just define it here (should it define PASTHRU_DEFINE instead?)
- my $apr_bindir = $build->apr_bindir();
- my @apr_libs = grep $_, map { -x $_ && qx{$_ --link-ld} }
- map { qq{$apr_bindir/$_-config} } qw(apr apu);
- my $opt_define = @apr_libs ? '-DMP_HAVE_APR_LIBS' : '';
+ if (my $apr_bindir = $build->apr_bindir()) {
+ my @apr_libs = grep $_, map { -x $_ && qx{$_ --link-ld} }
+ map { qq{$apr_bindir/$_-config} } qw(apr apu);
+ my $opt_define = '-DMP_HAVE_APR_LIBS' if @apr_libs;
+ }
# preserve any DEFINE opts from outside and combine them with our
# local DEFINE
@@ -189,7 +192,8 @@
# we need to know where apr-config and apu-configs are
# which sometimes aren't placed into the same dir with apxs/httpd
# XXX: need to fix that for WIN32
- unless (WIN32 || $build->apr_config_path) {
+ # XXX: when the source tree is used, there is not much use for apr-config
+ unless (WIN32 || $build->apr_config_path || $build->httpd_is_source_tree) {
error "can't find 'apr-config', please pass " .
"MP_APR_CONFIG=/full/path/to/apr-config to 'perl Makefile.PL'";
exit 1;
1.137 +29 -17 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.136
retrieving revision 1.137
diff -u -r1.136 -r1.137
--- Build.pm 12 Aug 2003 21:19:26 -0000 1.136
+++ Build.pm 12 Aug 2003 23:13:20 -0000 1.137
@@ -73,14 +73,15 @@
return '';
}
-sub ap_prefix_is_source_tree {
+sub httpd_is_source_tree {
my $self = shift;
- return unless exists $self->{MP_AP_PREFIX};
+ return $self->{httpd_is_source_tree}
+ if exists $self->{httpd_is_source_tree};
- my $prefix = $self->{MP_AP_PREFIX};
-
- -d $prefix and -e "$prefix/CHANGES";
+ my $prefix = $self->{MP_AP_PREFIX} || $self->{dir};
+ $self->{httpd_is_source_tree} =
+ defined $prefix && -d $prefix && -e "$prefix/CHANGES";
}
sub apxs {
@@ -744,14 +745,20 @@
}
if (!$self->{apr_config_path}) {
- # APR_BINDIR was added only at httpd-2.0.46
- my @tries = grep length,
- map $self->apxs(-q => $_), qw(APR_BINDIR BINDIR);
- push @tries, catdir $self->{MP_AP_PREFIX}, "bin"
- if exists $self->{MP_AP_PREFIX} and -d $self->{MP_AP_PREFIX};
-# # could be the source tree configured interactively
-# push @tries, catdir $self->{dir}, "srclib", "apr"
-# if exists $self->{dir} and -d $self->{dir};
+ my @tries = ();
+ if ($self->httpd_is_source_tree) {
+ push @tries, grep { -d $_ }
+ map catdir($_, "srclib", "apr"),
+ grep defined $_,
+ map $self->{$_}, qw(dir MP_AP_PREFIX);
+ }
+ else {
+ # APR_BINDIR was added only at httpd-2.0.46
+ push @tries, grep length,
+ map $self->apxs(-q => $_), qw(APR_BINDIR BINDIR);
+ push @tries, catdir $self->{MP_AP_PREFIX}, "bin"
+ if exists $self->{MP_AP_PREFIX} and -d $self->{MP_AP_PREFIX};
+ }
for (@tries) {
my $try = catfile $_, "apr-config";
@@ -762,9 +769,14 @@
$self->{apr_config_path} ||= Apache::TestConfig::which('apr-config');
- $self->{apr_bindir} = $self->{apr_config_path}
- ? dirname $self->{apr_config_path}
- : '';
+ # apr_bindir makes sense only if httpd/apr is installed, if we are
+ # building against the source tree we can't link against
+ # apr/aprutil libs
+ unless ($self->httpd_is_source_tree) {
+ $self->{apr_bindir} = $self->{apr_config_path}
+ ? dirname $self->{apr_config_path}
+ : '';
+ }
$self->{apr_config_path};
}
@@ -1427,7 +1439,7 @@
push @inc, $self->mp_include_dir;
- unless ($self->ap_prefix_is_source_tree) {
+ unless ($self->httpd_is_source_tree) {
push @inc, $self->apr_includedir;
my $ainc = $self->apxs('-q' => 'INCLUDEDIR');
1.3 +4 -1 modperl-2.0/t/apr-ext/uuid.t
Index: uuid.t
===================================================================
RCS file: /home/cvs/modperl-2.0/t/apr-ext/uuid.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- uuid.t 7 Aug 2003 16:57:39 -0000 1.2
+++ uuid.t 12 Aug 2003 23:13:20 -0000 1.3
@@ -12,7 +12,10 @@
# XXX: only when apr-config is found APR will be linked against
# libapr/libaprutil, probably need a more intuitive method for this
# prerequisite
-my $has_apr_config = $build->{apr_config_path};
+# also need to check whether we build against the source tree, in
+# which case we APR.so won't be linked against libapr/libaprutil
+my $has_apr_config = $build->{apr_config_path} &&
+ !$build->httpd_is_source_tree;
plan tests => 3,
have {"the build couldn't find apr-config" => $has_apr_config};
1.16 +11 -8 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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- Makefile.PL 7 Aug 2003 00:13:18 -0000 1.15
+++ Makefile.PL 12 Aug 2003 23:13:20 -0000 1.16
@@ -5,16 +5,19 @@
use ModPerl::BuildMM ();
use Config;
-my $apr_bindir = ModPerl::BuildMM::build_config()->apr_bindir();
+my $libs = '';
+if (my $apr_bindir = ModPerl::BuildMM::build_config()->apr_bindir()) {
-# XXX: this works only with libapr 0.9.2+ (not on win32)
-my @libs = grep $_, map { -x $_ && qx{$_ --link-ld --libs} }
- map { qq{$apr_bindir/$_-config} } qw(apr apu);
-chomp @libs;
-my $libs = join ' ', @libs;
+ # XXX: this works only with libapr 0.9.2+ (not on win32)
+ my @libs = grep $_, map { -x $_ && qx{$_ --link-ld --libs} }
+ map { qq{$apr_bindir/$_-config} } qw(apr apu);
+ chomp @libs;
+ $libs = join ' ', @libs;
+
+ # fix for broken older apu-config script 0.9.2 (httpd 2.0.43)
+ $libs =~ s/-laprutil(?!-)/-laprutil-0/ if $libs =~ /-lapr-0/;
+}
-# fix for broken older apu-config script 0.9.2 (httpd 2.0.43)
-$libs =~ s/-laprutil(?!-)/-laprutil-0/ if $libs =~ /-lapr-0/;
ModPerl::BuildMM::WriteMakefile(
'NAME' => 'APR',