Author: stas
Date: Fri Feb 18 08:27:33 2005
New Revision: 154318

URL: http://svn.apache.org/viewcvs?view=rev&rev=154318
Log:
introduce a new build option MP_AP_DESTDIR to aid package builders
direct the Apache-specific files to the right place.
Contributed by: Cory Omand <[EMAIL PROTECTED]>

Modified:
    perl/modperl/trunk/Changes
    perl/modperl/trunk/Makefile.PL
    perl/modperl/trunk/lib/Apache/Build.pm
    perl/modperl/trunk/lib/ModPerl/BuildOptions.pm

Modified: perl/modperl/trunk/Changes
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?view=diff&r1=154317&r2=154318
==============================================================================
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Fri Feb 18 08:27:33 2005
@@ -12,6 +12,10 @@
 
 =item 1.999_22-dev
 
+introduce a new build option MP_AP_DESTDIR to aid package builders
+direct the Apache-specific files to the right place. [Cory Omand
+<[EMAIL PROTECTED]>]
+
 Fix bug in modperl_package_clear_stash() segfaulting when
 encountering declared but not yet defined subroutines.
 [Steve Hay <[EMAIL PROTECTED]>, Gozer]

Modified: perl/modperl/trunk/Makefile.PL
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Makefile.PL?view=diff&r1=154317&r2=154318
==============================================================================
--- perl/modperl/trunk/Makefile.PL (original)
+++ perl/modperl/trunk/Makefile.PL Fri Feb 18 08:27:33 2005
@@ -74,12 +74,13 @@
     EXE_FILES     => [EMAIL PROTECTED],
     DEFINE        => get_DEFINE(),
     macro         => {
-        MODPERL_SRC        => $code->path,
-        MODPERL_MAKEFILE   => basename($build->default_file('makefile')),
-        PERL               => $build->perl_config('perlpath'),
-        MOD_INSTALL        => ModPerl::BuildMM::mod_install(),
-        MODPERL_AP_INCLUDEDIR  => $build->install_headers_dir(),
-        MODPERL_XS_H_FILES => join(" \\\n\t", @xs_h_files),
+        MODPERL_SRC           => $code->path,
+        MODPERL_MAKEFILE      => basename($build->default_file('makefile')),
+        PERL                  => $build->perl_config('perlpath'),
+        MOD_INSTALL           => ModPerl::BuildMM::mod_install(),
+        MODPERL_AP_INCLUDEDIR =>
+            $build->ap_destdir($build->install_headers_dir),
+        MODPERL_XS_H_FILES    => join(" \\\n\t", @xs_h_files),
     },
     clean     => {
         FILES => "@{ clean_files() }",

Modified: perl/modperl/trunk/lib/Apache/Build.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/lib/Apache/Build.pm?view=diff&r1=154317&r2=154318
==============================================================================
--- perl/modperl/trunk/lib/Apache/Build.pm (original)
+++ perl/modperl/trunk/lib/Apache/Build.pm Fri Feb 18 08:27:33 2005
@@ -20,7 +20,8 @@
 
 use Config;
 use Cwd ();
-use File::Spec::Functions qw(catfile catdir canonpath rel2abs devnull);
+use File::Spec::Functions qw(catfile catdir canonpath rel2abs devnull
+                             catpath splitpath);
 use File::Basename;
 use ExtUtils::Embed ();
 
@@ -141,6 +142,27 @@
     }
 }
 
+# if MP_AP_DESTDIR was specified this sub will prepend this path to
+# any Apache-specific installation path (that option is used only by
+# package maintainers).
+sub ap_destdir {
+    my $self = shift;
+    my $path = shift || '';
+    return $path unless $self->{MP_AP_DESTDIR};
+
+    if (WIN32) {
+        my($dest_vol, $dest_dir) = splitpath $self->{MP_AP_DESTDIR}, 1;
+        my $real_dir = (splitpath $path)[1];
+
+        $path = catpath $dest_vol, catdir($dest_dir, $real_dir), '';
+    }
+    else {
+        $path = catdir $self->{MP_AP_DESTDIR}, $path;
+    }
+
+    return canonpath $path;
+}
+
 sub apxs {
     my $self = shift;
 
@@ -1628,8 +1650,11 @@
 
     if (my $libs = $self->modperl_libs) {
         print $fh $self->canon_make_attr('lib_location', $libs);
-        print $fh $self->canon_make_attr('ap_libdir', 
-                                         "$self->{MP_AP_PREFIX}/lib");
+
+        print $fh $self->canon_make_attr('ap_libdir',
+            $self->ap_destdir(catdir $self->{MP_AP_PREFIX}, 'lib')
+        );
+
         $install .= <<'EOI';
 # install mod_perl.lib
        @$(MKPATH) $(MODPERL_AP_LIBDIR)
@@ -1666,12 +1691,12 @@
     }
 
     print $fh $self->canon_make_attr('lib', "@libs");
-    
-    print $fh $self->canon_make_attr('AP_INCLUDEDIR', 
-                                     $self->install_headers_dir());
+
+    print $fh $self->canon_make_attr('AP_INCLUDEDIR',
+        $self->ap_destdir($self->install_headers_dir));
 
     print $fh $self->canon_make_attr('AP_LIBEXECDIR',
-                                     $self->apxs(-q => 'LIBEXECDIR'));
+        $self->ap_destdir($self->apxs(-q => 'LIBEXECDIR')));
 
     my $xs_targ = $self->make_xs($fh);
 

Modified: perl/modperl/trunk/lib/ModPerl/BuildOptions.pm
URL: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/lib/ModPerl/BuildOptions.pm?view=diff&r1=154317&r2=154318
==============================================================================
--- perl/modperl/trunk/lib/ModPerl/BuildOptions.pm (original)
+++ perl/modperl/trunk/lib/ModPerl/BuildOptions.pm Fri Feb 18 08:27:33 2005
@@ -230,6 +230,7 @@
 OPTIONS_FILE   0    Read options from given file
 STATIC_EXTS    0    Build Apache::*.xs as static extensions
 APXS           0    Path to apxs
+AP_DESTDIR     0    Destination for Apache specific mod_perl bits
 AP_PREFIX      0    Apache installation or source tree prefix
 AP_CONFIGURE   0    Apache ./configure arguments
 APR_CONFIG     0    Path to apr-config


Reply via email to