Stas just discovered that when building static, mod_perl's header files ended up
being installed in httpd's build tree. That had 2 bad effects. First, 3rd party
modules wouldn't find the headers. Second, thus polluted, the httpd source tree
wouldn't build anymore, confused by header files that shouldn't be there.

The following patch _fixes_ that problem, but the only way I could manage to do
it was by peeking at config_vars.mk. It did make me think about how we could 
make
use of config_vars.mk ourselves more directly and not rely on system(apxs) as 
much
in the future.

Anyways, here is the patch itself.

--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
Index: Makefile.PL
===================================================================
--- Makefile.PL	(revision 111148)
+++ Makefile.PL	(working copy)
@@ -66,6 +66,8 @@
 
 my @exe_files =  map "bin/$_", qw(mp2doc mp2bug);
 
+my $include_dir = $build->ap_exp_includedir() || $build->ap_includedir();
+
 ModPerl::BuildMM::WriteMakefile(
     NAME          => 'mod_perl',
     VERSION       => $VERSION,
@@ -78,7 +80,7 @@
         MODPERL_MAKEFILE   => basename($build->default_file('makefile')),
         PERL               => $build->perl_config('perlpath'),
         MOD_INSTALL        => ModPerl::BuildMM::mod_install(),
-        MODPERL_AP_INCLUDEDIR  => $build->ap_includedir(),
+        MODPERL_AP_INCLUDEDIR  => $include_dir,
         MODPERL_XS_H_FILES => join(" \\\n\t", @xs_h_files),
     },
     clean     => {
Index: lib/Apache/Build.pm
===================================================================
--- lib/Apache/Build.pm	(revision 111148)
+++ lib/Apache/Build.pm	(working copy)
@@ -946,6 +946,22 @@
     $self->{ap_includedir} = $d;
 }
 
+sub ap_exp_includedir {
+    my ($self) = @_;
+    return unless $self->should_build_apache;
+    my $build_vars = File::Spec->catfile($self->{MP_AP_PREFIX}, 
+                                         'build', 'config_vars.mk');
+    open my $vars, "<$build_vars" || die "Couldn't open $build_vars $!";
+    my $exp_includedir;
+    while (<$vars>) {
+        if (/exp_includedir\s*=\s*(.*)/) {
+            $exp_includedir = $1;
+            last;
+        }
+    }
+    return $exp_includedir;
+}
+
 # where apr-config and apu-config reside
 sub apr_bindir {
     my ($self) = @_;
@@ -1605,8 +1621,11 @@
     }
 
     print $fh $self->canon_make_attr('lib', "@libs");
+    
+    my $incdir = $self->ap_exp_includedir() || $self->ap_includedir();
+    print $fh $self->canon_make_attr('AP_INCLUDEDIR', $incdir);
 
-    for my $q (qw(LIBEXECDIR INCLUDEDIR)) {
+    for my $q (qw(LIBEXECDIR)) {
         print $fh $self->canon_make_attr("AP_$q",
                                          $self->apxs(-q => $q));
     }

Attachment: signature.asc
Description: OpenPGP digital signature



Reply via email to