From: Reini Urban Date: Mon, 28 Jul 2008 12:55:40 +0000 (+0200) Subject: Cygwin build harmonization, remove cygwin/Makefile.SHs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5f9145a3c5d730d3a29901fe5c70a26f92663207;p=p5sagit%2Fp5-mst-13.2.git Cygwin build harmonization, remove cygwin/Makefile.SHs From: "Reini Urban" Message-ID: <6910a60807280355g129511d9v61c9763c3fd12a27@mail.gmail.com> p4raw-id: //depot/perl@34200 --- diff --git a/MANIFEST b/MANIFEST index bf648ec..6435153 100644 --- a/MANIFEST +++ b/MANIFEST @@ -42,7 +42,6 @@ Cross/TODO Cross-compilation Cross/warp Cross-compilation cv.h Code value header cygwin/cygwin.c Additional code for Cygwin port -cygwin/Makefile.SHs Shared library generation for Cygwin port deb.c Debugging routines djgpp/config.over DOS/DJGPP port djgpp/configure.bat DOS/DJGPP port diff --git a/Makefile.SH b/Makefile.SH index fa109a8..e925558 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -68,7 +68,8 @@ true) -install_name \$(shrpdir)/\$@" ;; cygwin*) - linklibperl="-lperl" + shrpldflags="$shrpldflags -Wl,--out-implib=libperl.dll.a -Wl,--image-base,0x52000000" + linklibperl="-L. -lperl" ;; sunos*) linklibperl="-lperl" @@ -516,19 +517,9 @@ miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE) sh writemain $(DYNALOADER) $(static_ext) > perlmain.c -!NO!SUBS! -case "$osname" in -cygwin) - ;; # Let cygwin/Makefile.SHs do its work. -*) - $spitshell >>Makefile <<'!NO!SUBS!' perlmain$(OBJ_EXT): perlmain.c $(CCCMD) $(PLDLFLAGS) $*.c -!NO!SUBS! - ;; -esac -$spitshell >>Makefile <<'!NO!SUBS!' # The file ext.libs is a list of libraries that must be linked in # for static extensions, e.g. -lm -lgdbm, etc. The individual # static extension Makefile's add to it. @@ -601,9 +592,22 @@ perl5.def: $(MINIPERLEXP) makedef.pl config.sh $(SYM) $(SYMH) miniperl.map !NO!SUBS! ;; +cygwin) + $spitshell >>Makefile <<'!NO!SUBS!' +cygwin.c: cygwin/cygwin.c + $(LNS) cygwin/cygwin.c + +LIBPERL_NONSHR = libperl$(LIB_EXT) + +$(LIBPERL_NONSHR): $(obj) + $(RMS) $(LIBPERL_NONSHR) + $(AR) rcu $(LIBPERL_NONSHR) $(obj) + +!NO!SUBS! + ;; esac -if test -r $Makefile_s ; then +if test -s $Makefile_s ; then . $Makefile_s $spitshell >>Makefile <>Makefile <>Makefile <>Makefile <<'!NO!SUBS!' -cwobj = $(obj) - -# override default rule (NB: make croaks!) to force dll usage -perlmain$(OBJ_EXT): perlmain.c - $(CCCMD) $(PLDLFLAGS) -DUSEIMPORTLIB $*.c - -# library used to make statically linked executables -# miniperl is linked against it to avoid libperl.dll locking -$(LIBPERL)$(LIB_EXT): $& $(cwobj) - $(AR) rcu $@ $(cwobj) - -# dll and import library -$(LIBPERL).dll$(LIB_EXT): $& $(cwobj) - $(LDLIBPTH) $(CC) $(SHRPLDFLAGS) -o $(DLLNAME)$(DLSUFFIX) -Wl,--out-implib=$@ \ - $(cwobj) $(libs) - -# How to build executables. - -# The miniperl -w -MExporter line is a basic cheap test to catch errors -# before make goes on to run preplibrary and then MakeMaker on extensions. -# This is very handy because later errors are often caused by miniperl -# build problems but that's not obvious to the novice. -# The Module used here must not depend on Config or any extensions. - -miniperl.exe \ -miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) opmini$(OBJ_EXT) - $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(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! - ;; -*) -$spitshell >>Makefile <<'!NO!SUBS!' -cwobj = $(obj) - -# perl library -$(LIBPERL)$(LIB_EXT): $& $(cwobj) - $(AR) rcu $@ $(cwobj) - -# How to build executables. - -# The miniperl -w -MExporter line is a basic cheap test to catch errors -# before make goes on to run preplibrary and then MakeMaker on extensions. -# This is very handy because later errors are often caused by miniperl -# build problems but that's not obvious to the novice. -# The Module used here must not depend on Config or any extensions. - -miniperl.exe \ -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 - -# libperl.a is _the_ library both in dll and static cases -# $(LIBPERL)$(LIB_EXT) expands to this name dependless of build model -# -# NOTE: The "-Wl,-Bstatic $(LLIBPERL) -Wl,-Bdynamic" is required to give -# the import library linking priority over the dynamic library, since both -# the .dll and .a are in the same directory. When the new standard for -# naming import/dynamic/static libraries emerges this should be updated. -# -$spitshell >>Makefile <<'!NO!SUBS!' - - -!NO!SUBS! - -# suid perl is removed - i've never seen suid scripts for win32 - -############################################## -# additional targets - -$spitshell >>Makefile <<'!NO!SUBS!' - -DIST_DIRECTORY = .dist - -distdir: miniperl - -mkdir $(DIST_DIRECTORY) - ./miniperl -Ilib '-MExtUtils::Manifest' \ - -e "ExtUtils::Manifest::manicopy(ExtUtils::Manifest::maniread(),'$(DIST_DIRECTORY)')" - -test_prep: - -!NO!SUBS! diff --git a/installperl b/installperl index 623034e..c717750 100755 --- a/installperl +++ b/installperl @@ -253,11 +253,8 @@ if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) { if ($Is_Cygwin) { $perldll = $libperl; - my $v_e_r_s = substr($ver,0,-2); $v_e_r_s =~ tr/./_/; - $perldll =~ s/(\..*)?$/$v_e_r_s.$dlext/; - $perldll =~ s/^lib/cyg/; } else { - $perldll = 'perl511.' . $dlext; + $perldll = 'perl5'.$Config{patchlevel}.'.'.$dlext; } if ($dlsrc ne "dl_none.xs") { @@ -338,7 +335,7 @@ if ($d_dosuid) { # Install library files. my ($do_installarchlib, $do_installprivlib) = (0, 0); -my $vershort = $Is_Cygwin ? substr($ver,0,-2) : $ver; +my $vershort = ($Is_Cygwin and !$Config{usedevel}) ? substr($ver,0,-2) : $ver; mkpath($installprivlib, $opts{verbose}, 0777); mkpath($installarchlib, $opts{verbose}, 0777); diff --git a/lib/ExtUtils/CBuilder/Platform/cygwin.pm b/lib/ExtUtils/CBuilder/Platform/cygwin.pm index 186bf7f..f72f5f7 100644 --- a/lib/ExtUtils/CBuilder/Platform/cygwin.pm +++ b/lib/ExtUtils/CBuilder/Platform/cygwin.pm @@ -10,17 +10,16 @@ $VERSION = '0.23'; sub link_executable { my $self = shift; - # $Config{ld} is set up as a special script for building - # perl-linkable libraries. We don't want that here. - local $self->{config}{ld} = 'gcc'; + # $Config{ld} is okay. revert the stupid Unix cc=ld override + local $self->{config}{cc} = $self->{config}{ld}; return $self->SUPER::link_executable(@_); } sub link { my ($self, %args) = @_; - + # libperl.dll.a fails with -Uusedl. -L../CORE -lperl is better $args{extra_linker_flags} = [ - File::Spec->catdir($self->perl_inc(), 'libperl.dll.a'), + '-L'.$self->perl_inc().' -lperl', $self->split_like_shell($args{extra_linker_flags}) ]; diff --git a/lib/ExtUtils/t/Embed.t b/lib/ExtUtils/t/Embed.t index 79f6dbc..b9e954b 100644 --- a/lib/ExtUtils/t/Embed.t +++ b/lib/ExtUtils/t/Embed.t @@ -105,11 +105,6 @@ if ($^O eq 'VMS') { s!-bE:(\S+)!-bE:$perl_exp!; } } - elsif ($^O eq 'cygwin') { # Cygwin needs the shared libperl copied - my $v_e_r_s = substr($Config{version},0,-2); - $v_e_r_s =~ tr/./_/; - 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'. $testlib = $Config{'libperl'}; @@ -137,7 +132,7 @@ print "# $_\n" foreach @out; if ($^O eq 'VMS' && !$status) { print "# @cmd2\n"; - $status = system(join(' ',@cmd2)); + $status = system(join(' ',@cmd2)); } print (($status? 'not ': '')."ok 1\n");