From: Gerrit P. Haase Date: Sun, 27 Jan 2002 22:30:41 +0000 (+0100) Subject: Bleadperl on Cygwin today X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b53432e421f16fabc5e5530a1e2ce8c38d941676;p=p5sagit%2Fp5-mst-13.2.git Bleadperl on Cygwin today Message-ID: <462007239437.20020127223041@familiehaase.de> p4raw-id: //depot/perl@14453 --- diff --git a/Configure b/Configure index 87d901e..4e6a731 100755 --- a/Configure +++ b/Configure @@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $ # -# Generated on Thu Jan 24 16:12:51 EET 2002 [metaconfig 3.0 PL70] +# Generated on Mon Jan 28 01:36:10 EET 2002 [metaconfig 3.0 PL70] # (with additional metaconfig patches by perlbug@perl.org) cat >c1$$ <.dll' -if ( ! ( echo $libperl | grep '^lib' >/dev/null ) ) -then - libperl=lib$libperl -fi linklibperl=-l`echo $libperl|sed -e s,^lib,,` $spitshell >>Makefile <' || $(MAKE) minitest +perl.exe \ +perl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs + $(SHRPENV) $(LDLIBPTH) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + +pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs + $(SHRPENV) $(LDLIBPTH) purify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + +purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs + $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + +quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs + $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + !NO!SUBS! ;; *) @@ -152,6 +159,19 @@ miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) opmini$(OBJ_EXT) $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs) $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '' || $(MAKE) minitest +perl.exe \ +perl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs + $(SHRPENV) $(LDLIBPTH) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) -Wl,-Bstatic $(LLIBPERL) -Wl,-Bdynamic `cat ext.libs` $(libs) + +pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs + $(SHRPENV) $(LDLIBPTH) purify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + +purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs + $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + +quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs + $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) + !NO!SUBS! ;; esac @@ -166,18 +186,6 @@ esac # $spitshell >>Makefile <<'!NO!SUBS!' -perl.exe \ -perl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs - $(SHRPENV) $(LDLIBPTH) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) -Wl,-Bstatic $(LLIBPERL) -Wl,-Bdynamic `cat ext.libs` $(libs) - -pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs - $(SHRPENV) $(LDLIBPTH) purify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) - -purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs - $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) - -quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs - $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) !NO!SUBS! diff --git a/cygwin/perlld.in b/cygwin/perlld.in index 19a1a2f..90a21bb 100644 --- a/cygwin/perlld.in +++ b/cygwin/perlld.in @@ -3,19 +3,14 @@ # to be built, special processing is done, else the standard ld is called. # -# theese are pretty mandatory +# these are pretty mandatory my $CC = '@CC@'; -my $DLLWRAP = '@DLLWRAP@'; - -# following are optional. -my $WRAPDRIVER = '@WRAPDRIVER@'; -my $AS = '@AS@'; -my $DLLTOOL = '@DLLTOOL@'; my $EXPORT_ALL = @EXPORT_ALL@; + # if some of extensions are undefined, # no corresponding output will be done. # most probably, you'd like to have an export library -my $DEF_EXT = '@DEF_EXT@'; +# my $DEF_EXT = '@DEF_EXT@'; # my $EXP_EXT = '@EXP_EXT@'; my $LIB_EXT = '@LIB_EXT@'; @@ -51,27 +46,30 @@ if ($args !~ /\-o (\S+)/) { $path =~ s,[/\\](\.[/\\])*,/,g; } if ($dllname =~ /\./) { $libname =$`; } else { $libname =$dllname; }; + my $v_e_r_s = '5_7_2'; + if ( $dllname =~ /.*perl.*/) { + $dllname ="cygperl$v_e_r_s.dll"; + } else { $dllname ="$libname.dll"; + } $libname ="lib$libname" unless ($libname =~ /^lib/); print DEBUGFILE "dll name: $dllname\nimport library: $libname\npath: $path\n" if $DEBUG; - $command ="$DLLWRAP --dllname $dllname"; - $command .=" --driver-name $WRAPDRIVER" if $WRAPDRIVER; - $command .=" --dlltool $DLLTOOL" if $DLLTOOL; - $command .=" --export-all-symbols" if $EXPORT_ALL; - $command .=" --as $AS" if $AS; - $command .=" --verbose" if $verbose; + $command ="$CC -shared -o $dllname"; +# $command .=" --verbose" if $verbose; - $command .=" --output-def $libname$DEF_EXT" if $DEF_EXT; - $command .=" --output-exp $libname$EXP_EXT" if $EXP_EXT; - $command .=" --output-lib $libname$LIB_EXT" if $LIB_EXT; + $command .=" -Wl,--output-def=$libname$DEF_EXT" if $DEF_EXT; + $command .=" -Wl,--output-exp=$libname$EXP_EXT" if $EXP_EXT; + $command .=" -Wl,--out-implib=$libname.dll$LIB_EXT" if $LIB_EXT; + $command .=" -Wl,--export-all-symbols" if $EXPORT_ALL; + $command .=" -Wl,--enable-auto-import -Wl,--stack,67108864"; # always # other args are passed through shellexec("$command \\\n$args\n"); if ($path) { $command ="mv $dllname"; - $command .=" $libname$LIB_EXT" if $LIB_EXT; + $command .=" $libname.dll$LIB_EXT" if $LIB_EXT; shellexec("$command $path\n"); }; }; diff --git a/installperl b/installperl index c18fd6a..c4cab78 100755 --- a/installperl +++ b/installperl @@ -234,7 +234,9 @@ if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) { if ($Is_Cygwin) { $perldll = $libperl; - $perldll =~ s/(\..*)?$/.$dlext/; + my $v_e_r_s = $ver; $v_e_r_s =~ tr/./_/; + $perldll =~ s/(\..*)?$/$v_e_r_s.$dlext/; + $perldll =~ s/^lib/cyg/; if ($Config{useshrplib} eq 'true') { # install ld2 and perlld as well foreach ('ld2', 'perlld') { @@ -242,6 +244,18 @@ if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) { copy("$_", "$installbin/$_"); chmod(0755, "$installbin/$_"); }; + { + open (LD2, "$installbin/ld2"); + print LD2 "#!/bin/sh\n#\n# ld wrapper, passes all args to perlld;\n#\n" + . "for trythis in $installbin/perl\ndo\n if [ -x \$trythis ]\n" + . " then\n \$trythis $installbin/perlld \"\$\@\"\n" + . " exit \$?\n fi\ndone\n# hard luck!\necho i see no perl" + . " executable around there\necho perl is required to build " + . "dynamic libraries\necho look if the path to perl in /bin/ld2" + . " is correct\nexit 1\n"; + close LD2; + }; + chmod(0755, "$installbin/ld2"); }; } else { $perldll = 'perl57.' . $dlext; diff --git a/lib/ExtUtils/MM_Cygwin.pm b/lib/ExtUtils/MM_Cygwin.pm index 3d03d32..50463fb 100644 --- a/lib/ExtUtils/MM_Cygwin.pm +++ b/lib/ExtUtils/MM_Cygwin.pm @@ -86,7 +86,14 @@ q[-e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "], sub perl_archive { + if ($Config{useshrplib} eq 'true') + { + my $libperl = '$(PERL_INC)' .'/'. "$Config{libperl}"; + $libperl =~ s/a$/dll.a/; + return $libperl; + } else { return '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a"); + } } 1; diff --git a/lib/ExtUtils/t/Embed.t b/lib/ExtUtils/t/Embed.t index bf2d3e7..e3869dc 100644 --- a/lib/ExtUtils/t/Embed.t +++ b/lib/ExtUtils/t/Embed.t @@ -88,11 +88,10 @@ if ($^O eq 'VMS') { s!-bE:(\S+)!-bE:$perl_exp!; } } - elsif ($^O eq 'cygwin') { # Cygwin needs the libperl copied + elsif ($^O eq 'cygwin') { # Cygwin needs the shared libperl copied my $v_e_r_s = $Config{version}; $v_e_r_s =~ tr/./_/; - system("cp ../libperl$v_e_r_s.dll ./"); # for test 1 - system("cp ../$Config{'libperl'} ../libperl.a"); # for test 1 + system("cp ../cygperl$v_e_r_s.dll ./"); # for test 1 } elsif ($Config{'libperl'} !~ /\Alibperl\./) { # Everyone needs libperl copied if it's not found by '-lperl'. @@ -129,8 +128,7 @@ print (($status? 'not ':'')."ok 9 # $status\n"); unlink($exe,"embed_test.c",$obj); unlink("$exe$Config{exe_ext}") if $skip_exe; unlink("embed_test.map","embed_test.lis") if $^O eq 'VMS'; -unlink(glob("./libperl*.dll")) if $^O eq 'cygwin'; -unlink("../libperl.a") if $^O eq 'cygwin'; +unlink(glob("./*.dll")) if $^O eq 'cygwin'; unlink($testlib) if $libperl_copied; # gcc -g -I.. -L../ -o perl_test perl_test.c -lperl `../perl -I../lib -MExtUtils::Embed -I../ -e ccopts -e ldopts` diff --git a/lib/ExtUtils/t/MM_Cygwin.t b/lib/ExtUtils/t/MM_Cygwin.t index 08b6246..df29ae2 100644 --- a/lib/ExtUtils/t/MM_Cygwin.t +++ b/lib/ExtUtils/t/MM_Cygwin.t @@ -90,6 +90,7 @@ like( $res, qr/bar \\\n\t1 \\\n\tfoo/, '... should join MAN1PODS and MAN3PODS'); # test perl_archive my $libperl = $Config{libperl} || 'libperl.a'; +$libperl =~ s/.a/.dll.a/; is( $args->perl_archive(), "\$(PERL_INC)/$libperl", 'perl_archive() should respect libperl setting' );