diff options
-rwxr-xr-x | Configure | 6 | ||||
-rw-r--r-- | cygwin/Makefile.SHs | 52 | ||||
-rw-r--r-- | cygwin/perlld.in | 34 | ||||
-rwxr-xr-x | installperl | 16 | ||||
-rw-r--r-- | lib/ExtUtils/MM_Cygwin.pm | 7 | ||||
-rw-r--r-- | lib/ExtUtils/t/Embed.t | 8 | ||||
-rw-r--r-- | lib/ExtUtils/t/MM_Cygwin.t | 1 |
7 files changed, 75 insertions, 49 deletions
@@ -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$$ <<EOF @@ -7555,8 +7555,8 @@ true) linux*) # ld won't link with a bare -lperl otherwise. dflt=libperl.$so ;; - cygwin*) # include version - dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext + cygwin*) # ld links against an importlib + dflt=libperl$lib_ext ;; *) # Try to guess based on whether libc has major.minor. case "$libc" in diff --git a/cygwin/Makefile.SHs b/cygwin/Makefile.SHs index 37383907f7..ffe4815787 100644 --- a/cygwin/Makefile.SHs +++ b/cygwin/Makefile.SHs @@ -81,12 +81,6 @@ perlld: $& Makefile ${src}/cygwin/perlld.in # make sure that all library names are not malformed libperl=`echo $libperl|sed -e s,\\\..*,,` -# it would be nice to allow dll to have any name, -# but for now i insist on 'lib<whatever>.dll' -if ( ! ( echo $libperl | grep '^lib' >/dev/null ) ) -then - libperl=lib$libperl -fi linklibperl=-l`echo $libperl|sed -e s,^lib,,` $spitshell >>Makefile <<!GROK!THIS! @@ -108,11 +102,11 @@ perlmain$(OBJ_EXT): perlmain.c # library used to make statically linked executables # miniperl is linked against it to avoid libperl.dll locking -$(LIBPERL)s$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj) +$(LIBPERL)$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj) $(AR) rcu $@ perl$(OBJ_EXT) $(cwobj) # dll and import library -$(LIBPERL)$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj) ld2 +$(LIBPERL).dll$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj) ld2 $(LDLIBPTH) ld2 $(SHRPLDFLAGS) -o $(LIBPERL)$(DLSUFFIX) \ perl$(OBJ_EXT) $(cwobj) $(libs) @@ -125,10 +119,23 @@ $(LIBPERL)$(LIB_EXT): $& perl$(OBJ_EXT) $(cwobj) ld2 # The Module used here must not depend on Config or any extensions. miniperl.exe \ -miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)s$(LIB_EXT) opmini$(OBJ_EXT) - $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL)s $(libs) +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).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 19a1a2f7b9..90a21bb1ac 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 c18fd6ad25..c4cab78e0c 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 3d03d321f3..50463fb33f 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 bf2d3e77ca..e3869dc982 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 08b6246133..df29ae214a 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' ); |