stas 2003/03/21 23:36:58
Modified: . .cvsignore Changes Makefile.PL perl-framework/Apache-Test .cvsignore ModPerl-Registry .cvsignore lib/ModPerl BuildMM.pm xs .cvsignore xs/APR .cvsignore xs/APR/APR .cvsignore xs/APR/Const .cvsignore xs/APR/PerlIO .cvsignore xs/Apache .cvsignore xs/Apache/Const .cvsignore xs/ModPerl .cvsignore xs/ModPerl/Const .cvsignore Makefile.PL Log: - the build now automatically glues the .pod files to the respective .pm files, so one can use perldoc on .pm files to read the documentation. - had to change a few Makefile.PL's MM overrides to append their extensions to the output of BuildMM's respective methods Revision Changes Path 1.7 +1 -0 modperl-2.0/.cvsignore Index: .cvsignore =================================================================== RCS file: /home/cvs/modperl-2.0/.cvsignore,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- .cvsignore 6 Apr 2002 04:01:56 -0000 1.6 +++ .cvsignore 22 Mar 2003 07:36:57 -0000 1.7 @@ -6,3 +6,4 @@ diff.txt smoke-report-*.txt MANIFEST +glue_pods 1.155 +4 -0 modperl-2.0/Changes Index: Changes =================================================================== RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.154 retrieving revision 1.155 diff -u -r1.154 -r1.155 --- Changes 22 Mar 2003 07:21:36 -0000 1.154 +++ Changes 22 Mar 2003 07:36:57 -0000 1.155 @@ -10,6 +10,10 @@ =item 1.99_09-dev +the build now automatically glues the .pod files to the respective .pm +files, so one can use perldoc on .pm files to read the +documentation. [Stas] + provide a workaround for ExtUtils::MakeMaker::mv_all_methods, so ModPerl::BuildMM and ModPerl::MM can override EU::MM methods behind the scenes. [Stas] 1.97 +8 -2 modperl-2.0/Makefile.PL Index: Makefile.PL =================================================================== RCS file: /home/cvs/modperl-2.0/Makefile.PL,v retrieving revision 1.96 retrieving revision 1.97 diff -u -r1.96 -r1.97 --- Makefile.PL 22 Mar 2003 07:21:36 -0000 1.96 +++ Makefile.PL 22 Mar 2003 07:36:57 -0000 1.97 @@ -404,7 +404,7 @@ sub MY::top_targets { my $self = shift; - my $string = $self->MM::top_targets; + my $string = $self->ModPerl::BuildMM::MY::top_targets; ModPerl::MM::add_dep(\$string, pure_all => 'modperl_lib'); @@ -478,13 +478,19 @@ } sub MY::postamble { - return <<'EOF'; + my $self = shift; + + my $string = $self->ModPerl::BuildMM::MY::postamble; + + $string .= <<'EOF'; mydist : manifest tardist cvs_tag : cvs tag MODPERL_$(VERSION_SYM) . @echo update mod_perl.pm VERSION now EOF + + return $string; } sub MY::tool_autosplit { 1.2 +1 -0 httpd-test/perl-framework/Apache-Test/.cvsignore Index: .cvsignore =================================================================== RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- .cvsignore 2 Apr 2001 09:36:01 -0000 1.1 +++ .cvsignore 22 Mar 2003 07:36:57 -0000 1.2 @@ -1,3 +1,4 @@ Makefile pm_to_blib blib +glue_pods 1.3 +1 -0 modperl-2.0/ModPerl-Registry/.cvsignore Index: .cvsignore =================================================================== RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- .cvsignore 19 Oct 2001 03:00:15 -0000 1.2 +++ .cvsignore 22 Mar 2003 07:36:57 -0000 1.3 @@ -1,3 +1,4 @@ Makefile pm_to_blib blib +glue_pods 1.2 +84 -0 modperl-2.0/lib/ModPerl/BuildMM.pm Index: BuildMM.pm =================================================================== RCS file: /home/cvs/modperl-2.0/lib/ModPerl/BuildMM.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BuildMM.pm 22 Mar 2003 07:21:36 -0000 1.1 +++ BuildMM.pm 22 Mar 2003 07:36:57 -0000 1.2 @@ -81,6 +81,11 @@ } push @opts, TYPEMAPS => [EMAIL PROTECTED] if @typemaps; + my $clean_files = (exists $args{clean} && exists $args{clean}{FILES}) ? + $args{clean}{FILES} : ''; + $clean_files .= " glue_pods"; # cleanup the dependency target + $args{clean}{FILES} = $clean_files; + ExtUtils::MakeMaker::WriteMakefile(@opts, %args); } @@ -121,6 +126,85 @@ } $self->MM::constants; +} + +sub ModPerl::BuildMM::MY::top_targets { + my $self = shift; + my $string = $self->MM::top_targets; + + ModPerl::MM::add_dep_after(\$string, "pure_all", pm_to_blib => 'glue_pods'); + + return $string; +} + +sub ModPerl::BuildMM::MY::postamble { + my $self = shift; + my $build = build_config(); + + my $root = $build->{cwd}; + + my $doc_root = File::Spec->catdir($root, "docs", "api"); + + my $lib_dir = File::Spec->catdir($root, "lib"); + + my @targets = (); + my @target; + + # add the code to glue the existing pods to the .pm files in blib + + @target = ('glue_pods:'); + + if (-d $doc_root) { + while (my ($pm, $blib) = each %{$self->{PM}}) { + my $pod = File::Spec->catdir( + (File::Spec->splitdir($blib))[-2 .. -1]); + $pod =~ s/\.pm/\.pod/; + my $podpath = File::Spec->catfile($doc_root, $pod); + next unless -r $podpath; + + push @target, + "\$(FULLPERLRUN) -Mlib=$lib_dir -MModPerl::BuildMM " . + "-e ModPerl::BuildMM::glue_pod $pm $podpath $blib"; + } + + push @target, $self->{NOECHO} . '$(TOUCH) $@'; + } + else { + # we don't have the docs sub-cvs repository extracted, skip + # the docs gluing + push @target, $self->{NOECHO} . '$(NOOP)'; + } + push @targets, join "\n\t", @target; + +# # next target: cleanup the dependency file +# @target = ('glue_pods_clean:'); +# push @target, '$(RM_F) glue_pods'; +# push @targets, join "\n\t", @target; + + return join "\n\n", @targets, ''; +} + +sub glue_pod { + + die "expecting 3 arguments: pm, pod, dst" unless @ARGV == 3; + my($pm, $pod, $dst) = @ARGV; + + # have we already glued the doc? + exit 0 unless -s $pm == -s $dst; + + # ExtUtils::Install::pm_to_blib removes the 'w' perms, so we can't + # just append the doc there + my $orig_mode = (stat $dst)[2]; + my $rw_mode = 0666; + + chmod $rw_mode, $dst or die "Can't chmod $rw_mode $dst: $!"; + open my $pod_fh, "<$pod" or die "Can't open $pod: $!"; + open my $dst_fh, ">>$dst" or die "Can't open $dst: $!"; + print $dst_fh (<$pod_fh>); + close $pod_fh; + close $dst_fh; + # restore the perms + chmod $orig_mode, $dst or die "Can't chmod $orig_mode $dst: $!"; } sub ModPerl::BuildMM::MY::post_initialize { 1.5 +1 -0 modperl-2.0/xs/.cvsignore Index: .cvsignore =================================================================== RCS file: /home/cvs/modperl-2.0/xs/.cvsignore,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- .cvsignore 21 Oct 2001 05:29:46 -0000 1.4 +++ .cvsignore 22 Mar 2003 07:36:57 -0000 1.5 @@ -4,3 +4,4 @@ modperl_xs_sv_convert.h *.exp *.def +glue_pods 1.3 +1 -0 modperl-2.0/xs/APR/.cvsignore Index: .cvsignore =================================================================== RCS file: /home/cvs/modperl-2.0/xs/APR/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- .cvsignore 20 Mar 2003 05:53:17 -0000 1.2 +++ .cvsignore 22 Mar 2003 07:36:57 -0000 1.3 @@ -1,3 +1,4 @@ pm_to_blib Makefile APR.exp +glue_pods 1.3 +1 -0 modperl-2.0/xs/APR/APR/.cvsignore Index: .cvsignore =================================================================== RCS file: /home/cvs/modperl-2.0/xs/APR/APR/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- .cvsignore 20 Mar 2003 05:53:17 -0000 1.2 +++ .cvsignore 22 Mar 2003 07:36:57 -0000 1.3 @@ -3,3 +3,4 @@ *.c *.bs APR.exp +glue_pods 1.3 +1 -0 modperl-2.0/xs/APR/Const/.cvsignore Index: .cvsignore =================================================================== RCS file: /home/cvs/modperl-2.0/xs/APR/Const/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- .cvsignore 20 Mar 2003 05:53:17 -0000 1.2 +++ .cvsignore 22 Mar 2003 07:36:57 -0000 1.3 @@ -3,3 +3,4 @@ Const.c Const.bs Const.exp +glue_pods 1.3 +1 -0 modperl-2.0/xs/APR/PerlIO/.cvsignore Index: .cvsignore =================================================================== RCS file: /home/cvs/modperl-2.0/xs/APR/PerlIO/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- .cvsignore 20 Mar 2003 05:53:17 -0000 1.2 +++ .cvsignore 22 Mar 2003 07:36:57 -0000 1.3 @@ -3,3 +3,4 @@ PerlIO.exp Makefile pm_to_blib +glue_pods 1.3 +1 -0 modperl-2.0/xs/Apache/.cvsignore Index: .cvsignore =================================================================== RCS file: /home/cvs/modperl-2.0/xs/Apache/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- .cvsignore 20 Mar 2003 05:53:17 -0000 1.2 +++ .cvsignore 22 Mar 2003 07:36:57 -0000 1.3 @@ -1,3 +1,4 @@ pm_to_blib Makefile Apache.exp +glue_pods 1.3 +1 -0 modperl-2.0/xs/Apache/Const/.cvsignore Index: .cvsignore =================================================================== RCS file: /home/cvs/modperl-2.0/xs/Apache/Const/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- .cvsignore 20 Mar 2003 05:53:17 -0000 1.2 +++ .cvsignore 22 Mar 2003 07:36:57 -0000 1.3 @@ -3,3 +3,4 @@ Const.c Const.bs Const.exp +glue_pods 1.3 +1 -0 modperl-2.0/xs/ModPerl/.cvsignore Index: .cvsignore =================================================================== RCS file: /home/cvs/modperl-2.0/xs/ModPerl/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- .cvsignore 20 Mar 2003 05:53:17 -0000 1.2 +++ .cvsignore 22 Mar 2003 07:36:57 -0000 1.3 @@ -1,3 +1,4 @@ Makefile pm_to_blib ModPerl.exp +glue_pods 1.4 +1 -0 modperl-2.0/xs/ModPerl/Const/.cvsignore Index: .cvsignore =================================================================== RCS file: /home/cvs/modperl-2.0/xs/ModPerl/Const/.cvsignore,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- .cvsignore 20 Mar 2003 05:53:17 -0000 1.3 +++ .cvsignore 22 Mar 2003 07:36:57 -0000 1.4 @@ -3,3 +3,4 @@ *.c Const.bs Const.exp +glue_pods 1.4 +6 -1 modperl-2.0/xs/ModPerl/Const/Makefile.PL Index: Makefile.PL =================================================================== RCS file: /home/cvs/modperl-2.0/xs/ModPerl/Const/Makefile.PL,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Makefile.PL 22 Mar 2003 07:21:37 -0000 1.3 +++ Makefile.PL 22 Mar 2003 07:36:57 -0000 1.4 @@ -21,7 +21,12 @@ ); sub MY::postamble { - join '', map { + my $self = shift; + my $string = $self->ModPerl::BuildMM::MY::postamble; + + $string .= join '', map { "$_: $src{$_}\n\t\$(CP) $src{$_} .\n"; } keys %src; + + return $string; }