summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMurray Nesbitt <murray@nesbitt.ca>1998-06-29 07:30:59 -0700
committerGurusamy Sarathy <gsar@cpan.org>1998-06-30 08:20:52 +0000
commit8f993c78f49e0284b2296d2b6c92c2a4c69354c0 (patch)
treecdc5ee441a0e46b8d77b44496cd55fa088500392 /lib
parent0d3da1c83c7295757745950f76ff9cfcd4d61253 (diff)
downloadperl-8f993c78f49e0284b2296d2b6c92c2a4c69354c0.tar.gz
Re: [PATCH 5.004_67] MakeMaker mods for PPD support
Message-Id: <77180549BCE.AAA466A@mail.rdc1.bc.wave.home.com> p4raw-id: //depot/perl@1269
Diffstat (limited to 'lib')
-rw-r--r--lib/ExtUtils/MM_Unix.pm84
-rw-r--r--lib/ExtUtils/MakeMaker.pm17
2 files changed, 93 insertions, 8 deletions
diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm
index daa477cd10..6739743da0 100644
--- a/lib/ExtUtils/MM_Unix.pm
+++ b/lib/ExtUtils/MM_Unix.pm
@@ -5,7 +5,7 @@ use Config;
use File::Basename qw(basename dirname fileparse);
use DirHandle;
use strict;
-use vars qw($VERSION $Is_Mac $Is_OS2 $Is_VMS $Is_Win32 $Is_Dos
+use vars qw($VERSION $Is_Mac $Is_OS2 $Is_VMS $Is_Win32 $Is_Dos $Is_PERL_OBJECT
$Verbose %pm %static $Xsubpp_Version);
$VERSION = substr q$Revision: 1.126 $, 10;
@@ -19,6 +19,8 @@ $Is_Mac = $^O eq 'MacOS';
$Is_Win32 = $^O eq 'MSWin32';
$Is_Dos = $^O eq 'dos';
+$Is_PERL_OBJECT = 1 if $Config{'ccflags'} =~ /-DPERL_OBJECT/;
+
if ($Is_VMS = $^O eq 'VMS') {
require VMS::Filespec;
import VMS::Filespec qw( &vmsify );
@@ -212,6 +214,7 @@ sub ExtUtils::MM_Unix::pm_to_blib ;
sub ExtUtils::MM_Unix::post_constants ;
sub ExtUtils::MM_Unix::post_initialize ;
sub ExtUtils::MM_Unix::postamble ;
+sub ExtUtils::MM_Unix::ppd ;
sub ExtUtils::MM_Unix::prefixify ;
sub ExtUtils::MM_Unix::processPL ;
sub ExtUtils::MM_Unix::realclean ;
@@ -371,7 +374,7 @@ sub cflags {
$self->{uc $_} ||= $cflags{$_}
}
- if ($self->{CAPI}) {
+ if ($self->{CAPI} && $Is_PERL_OBJECT == 1) {
$self->{CCFLAGS} =~ s/-DPERL_OBJECT(\s|$)//;
$self->{CCFLAGS} .= '-DPERL_CAPI';
if ($Is_Win32 && $Config{'cc'} =~ /^cl.exe/i) {
@@ -2596,6 +2599,32 @@ sub parse_version {
return $result;
}
+=item parse_abstract
+
+parse a file and return what you think is the ABSTRACT
+
+=cut
+
+sub parse_abstract {
+ my($self,$parsefile) = @_;
+ my $result;
+ local *FH;
+ local $/ = "\n";
+ open(FH,$parsefile) or die "Could not open '$parsefile': $!";
+ my $inpod = 0;
+ my $package = $self->{DISTNAME};
+ $package =~ s/-/::/;
+ while (<FH>) {
+ $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod;
+ next if !$inpod;
+ chop;
+ next unless /^($package\s-\s)(.*)/;
+ $result = $2;
+ last;
+ }
+ close FH;
+ return $result;
+}
=item pasthru (o)
@@ -2695,6 +2724,57 @@ $(OBJECT) : $(PERL_HDRS)
join "\n", @m;
}
+=item ppd
+
+Defines target that creates a PPD (Perl Package Description) file
+for a binary distribution.
+
+=cut
+
+sub ppd {
+ my($self) = @_;
+ my(@m);
+ if ($self->{ABSTRACT_FROM}){
+ $self->{ABSTRACT} = $self->parse_abstract($self->{ABSTRACT_FROM}) or
+ Carp::carp "WARNING: Setting ABSTRACT via file '$self->{ABSTRACT_FROM}' failed\n";
+ }
+ my ($pack_ver) = join ",", (split (/\./, $self->{VERSION}), (0) x 4) [0 .. 3];
+ push(@m, "# Creates a PPD (Perl Package Description) for a binary distribution.\n");
+ push(@m, "ppd:\n");
+ push(@m, "\t\@\$(PERL) -e \"print qq{<SOFTPKG NAME=\\\"$self->{DISTNAME}\\\" VERSION=\\\"$pack_ver\\\">\\n}");
+ push(@m, ". qq{\\t<TITLE>$self->{DISTNAME}</TITLE>\\n}");
+ my $abstract = $self->{ABSTRACT};
+ $abstract =~ s/</&lt;/g;
+ $abstract =~ s/>/&gt;/g;
+ push(@m, ". qq{\\t<ABSTRACT>$abstract</ABSTRACT>\\n}");
+ my ($author) = $self->{AUTHOR};
+ $author =~ s/@/\\@/g;
+ push(@m, ". qq{\\t<AUTHOR>$author</AUTHOR>\\n}");
+ push(@m, ". qq{\\t<IMPLEMENTATION>\\n}");
+ my ($prereq);
+ foreach $prereq (sort keys %{$self->{PREREQ_PM}}) {
+ my $pre_req = $prereq;
+ $pre_req =~ s/::/-/g;
+ push(@m, ". qq{\\t\\t<DEPENDENCY NAME=\\\"$pre_req\\\" />\\n}");
+ }
+ push(@m, ". qq{\\t\\t<OS NAME=\\\"\$(OSNAME)\\\" />\\n}");
+ my ($bin_location) = $self->{BINARY_LOCATION};
+ $bin_location =~ s/\\/\\\\/g;
+ if ($self->{PPM_INSTALL_SCRIPT}) {
+ if ($self->{PPM_INSTALL_EXEC}) {
+ push(@m, " . qq{\\t\\t<INSTALL EXEC=\\\"$self->{PPM_INSTALL_EXEC}\\\">$self->{PPM_INSTALL_SCRIPT}</INSTALL>\\n}");
+ }
+ else {
+ push(@m, " . qq{\\t\\t<INSTALL>$self->{PPM_INSTALL_SCRIPT}</INSTALL>\\n}");
+ }
+ }
+ push(@m, ". qq{\\t\\t<CODEBASE HREF=\\\"$bin_location\\\" />\\n}");
+ push(@m, ". qq{\\t</IMPLEMENTATION>\\n}");
+ push(@m, ". qq{</SOFTPKG>\\n}\" > $self->{DISTNAME}.ppd");
+
+ join("", @m);
+}
+
=item perm_rw (o)
Returns the attribute C<PERM_RW> or the string C<644>.
diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm
index eac32ace23..375a699c49 100644
--- a/lib/ExtUtils/MakeMaker.pm
+++ b/lib/ExtUtils/MakeMaker.pm
@@ -73,6 +73,10 @@ $Is_OS2 = $^O eq 'os2';
$Is_Mac = $^O eq 'MacOS';
$Is_Win32 = $^O eq 'MSWin32';
+# This is for module authors to query, so they can enable 'CAPI' => 'TRUE'
+# in their Makefile.pl
+$CAPI_support = 1;
+
require ExtUtils::MM_Unix;
if ($Is_VMS) {
@@ -235,7 +239,7 @@ sub full_setup {
@Attrib_help = qw/
- CAPI
+ AUTHOR ABSTRACT ABSTRACT_FROM BINARY_LOCATION LICENSE_HREF CAPI
C CCFLAGS CONFIG CONFIGURE DEFINE DIR DISTNAME DL_FUNCS DL_VARS
EXE_FILES EXCLUDE_EXT INCLUDE_EXT NO_VC FIRST_MAKEFILE FULLPERL H
INC INSTALLARCHLIB INSTALLBIN INSTALLDIRS INSTALLMAN1DIR
@@ -248,7 +252,7 @@ sub full_setup {
PL_FILES PM PMLIBDIRS PREFIX
PREREQ_PM SKIP TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG
XS_VERSION clean depend dist dynamic_lib linkext macro realclean
- tool_autosplit
+ tool_autosplit PPM_INSTALL_SCRIPT PPM_INSTALL_EXEC
IMPORTS
@@ -280,7 +284,7 @@ sub full_setup {
c_o xs_c xs_o top_targets linkext dlsyms dynamic dynamic_bs
dynamic_lib static static_lib manifypods processPL installbin subdirs
clean realclean dist_basics dist_core dist_dir dist_test dist_ci
- install force perldepend makefile staticmake test
+ install force perldepend makefile staticmake test ppd
); # loses section ordering
@@ -309,7 +313,7 @@ sub full_setup {
@Get_from_Config =
qw(
ar cc cccdlflags ccdlflags dlext dlsrc ld lddlflags ldflags libc
- lib_ext obj_ext ranlib sitelibexp sitearchexp so exe_ext
+ lib_ext obj_ext osname osvers ranlib sitelibexp sitearchexp so exe_ext
);
my $item;
@@ -383,8 +387,9 @@ sub ExtUtils::MakeMaker::new {
eval $eval;
if ($@){
warn "Warning: prerequisite $prereq $self->{PREREQ_PM}->{$prereq} not found";
- } else {
- delete $self->{PREREQ_PM}{$prereq};
+# Why is/was this 'delete' here? We need PREREQ_PM later to make PPDs.
+# } else {
+# delete $self->{PREREQ_PM}{$prereq};
}
}
# if (@unsatisfied){