dougm 00/04/29 20:31:17
Modified: . Makefile.PL
lib/Apache Build.pm
lib/ModPerl Code.pm
Log:
MP_INST_APACHE2=1 attribute will cause *.pm and *.so to be installed in
an Apache2/ subdirectory so mod_perl-1.xx and mod_perl-2.0 can co-exist
in the same site_perl tree.
'PerlModule Apache2' will add these directories to @INC
Revision Changes Path
1.18 +36 -12 modperl-2.0/Makefile.PL
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- Makefile.PL 2000/04/29 02:28:35 1.17
+++ Makefile.PL 2000/04/30 03:31:16 1.18
@@ -2,12 +2,10 @@
use strict;
use warnings;
-use ExtUtils::Embed ();
-use ExtUtils::MakeMaker qw(WriteMakefile);
-
use lib qw(lib);
use Apache::Build ();
use ModPerl::Code ();
+use ModPerl::MM ();
our $VERSION;
@@ -21,12 +19,13 @@
configure();
-WriteMakefile(
+ModPerl::MM::WriteMakefile(
NAME => 'mod_perl',
VERSION => $VERSION,
macro => {
MODPERL_SRC => $code->path,
PERL => $build->perl_config('perlpath'),
+ MOD_INSTALL => ModPerl::MM::mod_install(),
},
clean => {
FILES => "@{ clean_files() }",
@@ -60,6 +59,10 @@
printf "Will build mod_perl %s as %s\n",
$build->is_dynamic ? "shared" : "static",
$build->{"MODPERL_LIB"};
+
+ if ($build->{MP_INST_APACHE2}) {
+ print "Will install Apache Perl modules into Apache2/\n";
+ }
}
sub echo_cmd {
@@ -84,12 +87,6 @@
chdir $build->cwd;
}
-sub echo_unlink {
- my $file = shift;
- print "unlink $file\n";
- unlink $file;
-}
-
sub clean_files {
my $path = $code->path;
@@ -153,11 +150,13 @@
}
}
+package MY;
+
sub MY::top_targets {
my $self = shift;
my $string = $self->MM::top_targets;
- $build->mm_add_dep(\$string, pure_all => 'modperl_lib');
+ ModPerl::MM::add_dep(\$string, pure_all => 'modperl_lib');
$string .= <<'EOF';
@@ -175,7 +174,7 @@
sub MY::clean {
my $self = shift;
my $string = $self->MM::clean(@_);
- $build->mm_add_dep(\$string, clean => 'modperl_src_clean');
+ ModPerl::MM::add_dep(\$string, clean => 'modperl_src_clean');
$string;
}
@@ -185,4 +184,29 @@
sub MY::tool_autosplit {
'';
+}
+
+sub MY::post_initialize {
+ my $self = shift;
+ #up one from the Apache2/ subdir
+ #so it can be found for 'use Apache2 ()'
+ $self->{PM}->{'lib/Apache2.pm'} =~ s:^\$\(INST_LIB\):blib/lib:;
+ '';
+}
+
+sub MY::manifypods {
+ my $self = shift;
+ my $ver = $self->{VERSION} || "";
+ local $_ = $self->MM::manifypods(@_);
+ s/pod2man\s*$/pod2man --release mod_perl-$ver/m;
+ $_;
+}
+
+sub MY::pasthru {
+ my $self = shift;
+ chomp(my $str = $self->MM::pasthru);
+ join $/, "$str\\",
+ "\t".'PERL="$(PERL)"\\',
+ "\t".'DEFINE="$(DEFINE)"',
+ "";
}
1.15 +1 -7 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.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Build.pm 2000/04/29 18:01:25 1.14
+++ Build.pm 2000/04/30 03:31:17 1.15
@@ -301,6 +301,7 @@
'build_config' => 'lib/Apache/BuildConfig.pm',
'ldopts' => 'src/modules/perl/ldopts',
'makefile' => 'src/modules/perl/Makefile',
+ 'apache2_pm' => 'lib/Apache2.pm',
);
sub clean_files {
@@ -743,13 +744,6 @@
my $self = shift;
return "";
-}
-
-#--- tweak MakeMaker ---
-
-sub mm_add_dep {
- my($self, $string, $targ, $add) = @_;
- $$string =~ s/($targ\s+::)/$1 $add /;
}
1;
1.23 +29 -0 modperl-2.0/lib/ModPerl/Code.pm
Index: Code.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- Code.pm 2000/04/28 05:40:34 1.22
+++ Code.pm 2000/04/30 03:31:17 1.23
@@ -2,8 +2,10 @@
use strict;
use warnings;
+use Apache::Build ();
our $VERSION = '0.01';
+our @ISA = qw(Apache::Build);
my %handlers = (
Process => [qw(ChildInit)], #ChildExit Restart PreConfig
@@ -473,6 +475,33 @@
warn "generating...$xsinit\n";
ExtUtils::Embed::xsinit($xsinit);
+
+ warn "generating...", $self->generate_apache2_pm, "\n";
+}
+
+sub generate_apache2_pm {
+ my $self = shift;
+
+ my $lib = $self->perl_config('installsitelib');
+ my $arch = $self->perl_config('installsitearch');
+ my $file = $self->default_file('apache2_pm');
+
+ open my $fh, '>', $file or die "open $file: $!";
+
+ my $package = 'package Apache2';
+
+ print $fh <<EOF;
+$package;
+
+use lib qw($lib/Apache2
+ $arch/Apache2);
+
+1;
+
+EOF
+ close $fh;
+
+ $file;
}
1;