diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-05-29 11:05:50 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-05-29 11:05:50 +0000 |
commit | 26ca90b622247714396690e385249f8ca1417aa0 (patch) | |
tree | 520b78b2e1d8b3429b4833f9ee8a1465d8e6abc2 /lib | |
parent | 8a29a26d101c2a07bdfaee1b99a0c73504c5cbe4 (diff) | |
parent | 30ac6d9be367ff08cc605906fbe575fb1ca35fdf (diff) | |
download | perl-26ca90b622247714396690e385249f8ca1417aa0.tar.gz |
[win32] reverse integrate asperl branch contents (phew!)
- various fixups to ensure AS stuff does no harm
- adjust win32/makefiles for the new directory layout (new layout
looks rather a muddle--needs rework)
- verified build & test on NT and Solaris/gcc
p4raw-id: //depot/win32/perl@1060
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ExtUtils/MM_Unix.pm | 96 | ||||
-rw-r--r-- | lib/ExtUtils/MM_Win32.pm | 15 | ||||
-rw-r--r-- | lib/ExtUtils/MakeMaker.pm | 10 | ||||
-rw-r--r-- | lib/ExtUtils/Mksymlists.pm | 6 | ||||
-rwxr-xr-x | lib/ExtUtils/xsubpp | 49 |
5 files changed, 165 insertions, 11 deletions
diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index 101812145d..729906dd80 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -208,6 +208,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 ; @@ -367,6 +368,15 @@ sub cflags { $self->{uc $_} ||= $cflags{$_} } + if ($self->{CAPI}) { + $self->{CCFLAGS} =~ s/-DPERL_OBJECT(\s|$)//; + $self->{CCFLAGS} .= '-DPERL_CAPI'; + if ($Is_Win32 && $Config{'cc'} =~ /^cl.exe/i) { + # Turn off C++ mode of the MSC compiler + $self->{CCFLAGS} =~ s/-TP(\s|$)//; + $self->{OPTIMIZE} =~ s/-TP(\s|$)//; + } + } return $self->{CFLAGS} = qq{ CCFLAGS = $self->{CCFLAGS} OPTIMIZE = $self->{OPTIMIZE} @@ -2568,6 +2578,45 @@ 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; +# my $eval = qq{ +# package ExtUtils::MakeMaker::_version; +# no strict; +# +# local $1$2; +# \$$2=undef; do { +# $_ +# }; \$$2 +# }; +# local($^W) = 0; +# $result = eval($eval); +# die "Could not eval '$eval' in $parsefile: $@" if $@; +# $result = "undef" unless defined $result; + last; + } + close FH; + return $result; +} =item pasthru (o) @@ -2667,6 +2716,49 @@ $(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/</</g; + $abstract =~ s/>/>/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; + 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 pm_to_blib Defines target that copies all files in the hash PM to their @@ -3164,9 +3256,11 @@ sub tool_xsubpp { } } + $xsubpp = $self->{CAPI} ? "xsubpp -object_capi" : "xsubpp"; + return qq{ XSUBPPDIR = $xsdir -XSUBPP = \$(XSUBPPDIR)/xsubpp +XSUBPP = \$(XSUBPPDIR)/$xsubpp XSPROTOARG = $self->{XSPROTOARG} XSUBPPDEPS = @tmdeps XSUBPPARGS = @tmargs diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index 101f76ada1..5b0184c39e 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -33,6 +33,7 @@ $BORLAND = 1 if $Config{'cc'} =~ /^bcc/i; $GCC = 1 if $Config{'cc'} =~ /^gcc/i; $DMAKE = 1 if $Config{'make'} =~ /^dmake/i; $NMAKE = 1 if $Config{'make'} =~ /^nmake/i; +$OBJ = 1 if $Config{'ccflags'} =~ /PERL_OBJECT/i; sub dlsyms { my($self,%attribs) = @_; @@ -163,7 +164,8 @@ sub init_others $self->{'LDLOADLIBS'} ||= ( $BORLAND ? 'import32.lib cw32mti.lib ' - : 'msvcrt.lib oldnames.lib kernel32.lib comdlg32.lib winspool.lib gdi32.lib ' + : ( $OBJ ? '' : 'msvcrt.lib ' ) + .'oldnames.lib kernel32.lib comdlg32.lib winspool.lib gdi32.lib ' .'advapi32.lib user32.lib shell32.lib netapi32.lib ole32.lib ' .'oleaut32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib ' ) . ' odbc32.lib odbccp32.lib'; @@ -447,7 +449,16 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists sub perl_archive { - return '$(PERL_INC)\perl$(LIB_EXT)'; + my ($self) = @_; + if($OBJ) { + if ($self->{CAPI} eq 'TRUE') { + return '$(PERL_INC)\PerlCAPI$(LIB_EXT)'; + } + else { + return '$(PERL_INC)\perlcore$(LIB_EXT)'; + } + } + return '$(PERL_INC)\perl$(LIB_EXT)'; } sub export_list diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm index ee451c7051..168c98d7f2 100644 --- a/lib/ExtUtils/MakeMaker.pm +++ b/lib/ExtUtils/MakeMaker.pm @@ -235,6 +235,7 @@ sub full_setup { @Attrib_help = qw/ + 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 @@ -278,7 +279,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 @@ -307,7 +308,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; @@ -381,8 +382,9 @@ sub ExtUtils::MakeMaker::new { eval $eval; if ($@){ warn "Warning: prerequisite $prereq $self->{PREREQ_PM}->{$prereq} not found"; - } else { - delete $self->{PREREQ_PM}{$prereq}; +# mjn +# } else { +# delete $self->{PREREQ_PM}{$prereq}; } } # if (@unsatisfied){ diff --git a/lib/ExtUtils/Mksymlists.pm b/lib/ExtUtils/Mksymlists.pm index 48a4b1505b..efee155801 100644 --- a/lib/ExtUtils/Mksymlists.pm +++ b/lib/ExtUtils/Mksymlists.pm @@ -112,8 +112,10 @@ sub _write_win32 { # put library name in quotes (it could be a keyword, like 'Alias') if ($Config::Config{'cc'} !~ /^gcc/i) { print DEF "LIBRARY \"$data->{DLBASE}\"\n"; - print DEF "CODE LOADONCALL\n"; - print DEF "DATA LOADONCALL NONSHARED MULTIPLE\n"; + if ($Config{'ccflags'} !~ /PERL_OBJECT/i) { + print DEF "CODE LOADONCALL\n"; + print DEF "DATA LOADONCALL NONSHARED MULTIPLE\n"; + } } print DEF "EXPORTS\n "; my @syms; diff --git a/lib/ExtUtils/xsubpp b/lib/ExtUtils/xsubpp index b8ec042b41..8e253ff215 100755 --- a/lib/ExtUtils/xsubpp +++ b/lib/ExtUtils/xsubpp @@ -6,7 +6,7 @@ xsubpp - compiler to convert Perl XS code into C code =head1 SYNOPSIS -B<xsubpp> [B<-v>] [B<-C++>] [B<-except>] [B<-s pattern>] [B<-prototypes>] [B<-noversioncheck>] [B<-nolinenumbers>] [B<-typemap typemap>]... file.xs +B<xsubpp> [B<-v>] [B<-C++>] [B<-except>] [B<-s pattern>] [B<-prototypes>] [B<-noversioncheck>] [B<-nolinenumbers>] [B<-typemap typemap>] [B<-object_capi>]... file.xs =head1 DESCRIPTION @@ -59,7 +59,11 @@ number. Prevents the inclusion of `#line' directives in the output. -=back +=item B<-object_capi> + +Compile code as C in a PERL_OBJECT environment. + +back =head1 ENVIRONMENT @@ -83,6 +87,8 @@ require 5.002; use Cwd; use vars '$cplusplus'; +use Config; + sub Q ; # Global Constants @@ -103,6 +109,8 @@ $FH = 'File0000' ; $usage = "Usage: xsubpp [-v] [-C++] [-except] [-prototypes] [-noversioncheck] [-nolinenumbers] [-s pattern] [-typemap typemap]... file.xs\n"; $proto_re = "[" . quotemeta('\$%&*@;') . "]" ; +# mjn +$OBJ = 1 if $Config{'ccflags'} =~ /PERL_OBJECT/i; $except = ""; $WantPrototypes = -1 ; @@ -118,6 +126,7 @@ SWITCH: while (@ARGV and $ARGV[0] =~ /^-./) { $WantPrototypes = 1, next SWITCH if $flag eq 'prototypes'; $WantVersionChk = 0, next SWITCH if $flag eq 'noversioncheck'; $WantVersionChk = 1, next SWITCH if $flag eq 'versioncheck'; + $WantCAPI = 1, next SWITCH if $flag eq 'object_capi'; $except = " TRY", next SWITCH if $flag eq 'except'; push(@tm,shift), next SWITCH if $flag eq 'typemap'; $WantLineNumbers = 0, next SWITCH if $flag eq 'nolinenumbers'; @@ -714,6 +723,10 @@ print("#line 1 \"$filename\"\n") while (<$FH>) { last if ($Module, $Package, $Prefix) = /^MODULE\s*=\s*([\w:]+)(?:\s+PACKAGE\s*=\s*([\w:]+))?(?:\s+PREFIX\s*=\s*(\S+))?\s*$/; + + if ($OBJ) { + s/#if(?:def|\s+defined)\s+(\(__cplusplus\)|__cplusplus)/#if defined(__cplusplus) && !defined(PERL_OBJECT)/; + } print $_; } &Exit unless defined $_; @@ -1167,6 +1180,19 @@ EOF } # print initialization routine +if ($WantCAPI) { +print Q<<"EOF"; +# +##ifdef __cplusplus +#extern "C" +##endif +#XS(boot__CAPI_entry) +#[[ +# dXSARGS; +# char* file = __FILE__; +# +EOF +} else { print Q<<"EOF"; ##ifdef __cplusplus #extern "C" @@ -1177,6 +1203,7 @@ print Q<<"EOF"; # char* file = __FILE__; # EOF +} print Q<<"EOF" if $WantVersionChk ; # XS_VERSION_BOOTCHECK ; @@ -1207,7 +1234,25 @@ print Q<<"EOF";; # ST(0) = &sv_yes; # XSRETURN(1); #]] +# +EOF + +if ($WantCAPI) { +print Q<<"EOF"; +# +##define XSCAPI(name) void name(CV* cv, void* pPerl) +# +##ifdef __cplusplus +#extern "C" +##endif +#XSCAPI(boot_$Module_cname) +#[[ +# SetCPerlObj(pPerl); +# boot__CAPI_entry(cv); +#]] +# EOF +} warn("Please specify prototyping behavior for $filename (see perlxs manual)\n") unless $ProtoUsed ; |