Discussion:
[perl.git] branch maint-5.10, updated. GitLive-maint-5.10-687-g64604a1
(too old to reply)
David Mitchell
2009-04-12 21:49:45 UTC
Permalink
In perl.git, the branch maint-5.10 has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/64604a1c7ae112882e4c5e1266c57b716b27f18b?hp=52e8d4b4f3f92acb393c9b02f85028f175bd9be6>

- Log -----------------------------------------------------------------
commit 64604a1c7ae112882e4c5e1266c57b716b27f18b
Author: Nicholas Clark <***@ccl4.org>
Date: Wed Feb 4 20:46:25 2009 +0000

When normalising @extspec, use the result of s/// in if() rather than m//

(cherry picked from commit 7ad017a8809c03aa288ac99952c8d4599b17f858)

M make_ext.pl

commit 92fdf73fdb1c593db613ca737c0cf395cd9c7298
Author: Nicholas Clark <***@ccl4.org>
Date: Wed Feb 4 19:52:00 2009 +0000

Remove the / from the end of the extension directory. Change the quantifiers on
the regexp from * to +.

(cherry picked from commit c5aac6ab2185ab7d2daf43bdd9b22939121004c6)

M make_ext.pl

commit e2df16a280c942b32b4f9fb4c0a582e4f2bafd3e
Author: Nicholas Clark <***@ccl4.org>
Date: Wed Feb 4 19:28:06 2009 +0000

Some refactoring in the loop that constructs parameters for build_extension().

(cherry picked from commit e08c66ce3962dd9ec38a7094a11b5e4bc2376c00)

M make_ext.pl

commit f86b2c7b3dcc561d54453b5dab32af400f004959
Author: Nicholas Clark <***@ccl4.org>
Date: Wed Feb 4 17:13:30 2009 +0000

Also cope with extension directory names of the form ext/Data-Dumper/...

(cherry picked from commit f44bdceebeee2f09fe107f15d8b99b0280171932)

M win32/FindExt.pm

commit cef0e1ceb848a75fdf716b1f4152eea0b5d4e9eb
Author: Nicholas Clark <***@ccl4.org>
Date: Wed Feb 4 12:15:19 2009 +0000

Clearer variable names. Add a mode line coda.
Because a substantial amount of this file is about to be refactored, I decided
that we should expand tabs to spaces.

(cherry picked from commit 3380c781dc67e9bba70bd5913c7f0f3aa2274bf3)

M win32/FindExt.pm

commit ea8de6047254a5bccea39b45f5ed72c98fd91c7b
Author: Nicholas Clark <***@ccl4.org>
Date: Wed Feb 4 10:08:11 2009 +0000

A test for FindExt, not run by make test. (Useful for refactoring FindExt.)

(cherry picked from commit 0598b5ab3697b872539de6ed6dc1522b873602e1)

M MANIFEST
A win32/FindExt.t

commit 691e3bbaacba5d7e982513a9c0915231ae3d4797
Author: Nicholas Clark <***@ccl4.org>
Date: Tue Feb 3 23:07:36 2009 +0000

Refactor to avoid changing directory, and avoid needing getcwd().

(cherry picked from commit d57db09df25bb4fb2f5080ca37abbbfa49f1e8cf)

M win32/FindExt.pm

commit abd37de5d463e9c466551cd28fd8d9cfcb5a92c5
Author: Nicholas Clark <***@ccl4.org>
Date: Mon Feb 2 21:56:38 2009 +0000

Convert the last few references from buildext.pl to make_ext.pl

(cherry picked from commit d1b150139f0ad72cafb2f34ffb678473d2a2bb86)

M win32/Makefile.ce

commit 802011950e890ed9ca24524de30461299cf00433
Author: Nicholas Clark <***@ccl4.org>
Date: Mon Feb 2 21:42:33 2009 +0000

Fold win32/buildext.pl into make_ext.pl

(cherry picked from commit 286d62c215d35caf69b83afb884cdaa350bd6aa3)

M MANIFEST
M make_ext.pl
M win32/Makefile
D win32/buildext.pl
M win32/makefile.mk

commit b62f0173180a9522ac96ec4c39f8d28c7ed3aa3a
Author: Steve Hay <***@planit.com>
Date: Mon Feb 2 13:18:34 2009 +0000

Restore broken clean target in win32/makefile.mk

Commit aaaf44d72fce5980564533b9072da6e594d91d81 accidentally missed a --all
argument for buildext.pl, which resulted in the extensions not getting
"dmake realclean" run in them.

(cherry picked from commit 421926c2f211043ade7c80ffab00d5afd74d01e0)

M win32/makefile.mk

commit d8d086f48d056dbfe32767f023a936f2d3389dfa
Author: Nicholas Clark <***@ccl4.org>
Date: Sun Feb 1 14:37:21 2009 +0000

Replacing system $scalar with system @list requires splitting $MAKE on spaces.

(cherry picked from commit eb1f8df73c921226b177e96f1b82371e5ad0d13d)

M make_ext.pl
M win32/buildext.pl

commit 0bbf9e47539a9bb99caa9f54be5258666d059f15
Author: Nicholas Clark <***@ccl4.org>
Date: Sun Feb 1 11:38:31 2009 +0000

Loop over @extspec, calling build_extension() on each.

(cherry picked from commit ca5de986dd6a53bf639708f4ed28e2bdeb1b3aa8)

M make_ext.pl

commit 39f5de204cc49e729bf0c70e7a303b4c1a678a60
Author: Nicholas Clark <***@ccl4.org>
Date: Sun Feb 1 10:23:54 2009 +0000

The $@ was actually a botched conversion from $make $targ, rather than an
attempt to output a literal $

(cherry picked from commit a79902b1d0b468e362397e28e43f88461a199d89)

M make_ext.pl
M win32/buildext.pl

commit a13b0402bb5178da0bb45f07b9f8a3633c110037
Author: Rafael Garcia-Suarez <***@gmail.com>
Date: Sun Feb 1 10:53:25 2009 +0100

Correctly escape $ in debug statement

(cherry picked from commit 11f6a7695ebcf15317229951065014e277bc2048)

M make_ext.pl

commit 3bfd6acbb2ece8d604cb9c576dcf72f18ce59cfd
Author: Nicholas Clark <***@ccl4.org>
Date: Sat Jan 31 21:34:49 2009 +0000

Update Makefile-cross-SH with 07f3cc2a611daebb9d83f869d36ef63cf4fa2565 and
61edc68382f612a884a3181266d6220ea3a727eb

(cherry picked from commit 3b333d01f6cf16e8f1bdf597e6dd0845cd7e18f3)

M Cross/Makefile-cross-SH

commit 2ab2bac4000afd05435c0ce9d77ee4bff21bdd29
Author: Nicholas Clark <***@ccl4.org>
Date: Sat Jan 31 20:16:43 2009 +0000

Move the static/dynamic/nonxs LINKTYPE logic from make_ext.pl to Makefile.SH
This simplifies make_ext.pl considerably. Given that the first use of 'passthru'
was in 40000a8c37c35cc00114329ca0add46bca36a0ec in 1995, possibly we should have
done this particular refactoring a little while ago.

(cherry picked from commit 07f3cc2a611daebb9d83f869d36ef63cf4fa2565)

M Makefile.SH
M make_ext.pl

commit bd813f2729f23545f9b76333be24b03296d5877b
Author: Nicholas Clark <***@ccl4.org>
Date: Sat Jan 31 17:16:21 2009 +0000

Use the build_extension() routine from win32/buildext.pl
Swap from $passthru to @pass_through, and $run to @run.
Use the list form of system everywhere.
Hard code 'Makefile' as it does not vary.
Correct the perlism 'chdir' in the *clean.sh writing code.

(cherry picked from commit fc6784129696c3d1b807ce356dbd42133b41d86a)

M make_ext.pl

commit 1037bce806f5718b3674b211f8fc224a3d130ec8
Author: Nicholas Clark <***@ccl4.org>
Date: Sat Jan 31 17:12:40 2009 +0000

Create build_extension() to encapsulate the per-extension logic.
Use @pass_through to hold extra VARIABLE=value assignments.
Add @run to hold optional build-time run prefix.
Use the list form of system for everything.
Always call a target - default to 'all' if not is passed in.
Merge the alternate logic for selecting -MCross from make_ext.pl

(cherry picked from commit 484c6321d917c74a4d18b8f71229767b9bf43983)

M win32/buildext.pl

commit 7d52e702fcf7789cfd90757adf37581207b2f450
Author: Nicholas Clark <***@ccl4.org>
Date: Sat Jan 31 13:56:28 2009 +0000

Make dir and target --options to buildext.pl. Update the documentation.

(cherry picked from commit 1a76ca1adb00f0a79fbb2893732a88fcd33fce31)

M win32/Makefile
M win32/buildext.pl
M win32/makefile.mk

commit 30a887e4ace3b640a79814c6f7b2be21ce515acf
Author: Nicholas Clark <***@ccl4.org>
Date: Sat Jan 31 13:39:04 2009 +0000

Make lib/Config_heavy.pl part of $(CONFIGPM) as the build ordering is now sane.
Effectively $(CONFIGPM_EXTRA) becomes $(CONFIGPM) and $(CONFIGPM) becomes
$(CONFIGPM_FROM_CONFIG_SH). Mention lib/Config_heavy.pl as something that
is built by running make_patchnum.pl
Hopefully this avoids warnings from Config.pm during the build.

(cherry picked from commit 744ac0eac539aead596d9fa09cc15a20b09a5884)

M Makefile.SH

commit 0e0d4ea811d222bf86d5e59ca1f6c3c3448434e0
Author: Nicholas Clark <***@ccl4.org>
Date: Sat Jan 31 12:20:26 2009 +0000

The hack to write out realclean.sh and veryclean.sh is for Unix only.

(cherry picked from commit e3b840254a3d07c933fa6f645bc19cbb9b1ae7c0)

M make_ext.pl

commit e330b02f7943cdcb03a31b603ae753703c3a30f4
Author: Nicholas Clark <***@ccl4.org>
Date: Fri Jan 30 23:39:15 2009 +0000

Move the target generic logic above the extension specific logic.
This will make it easier to refactor to converge on the Win32 (and VMS)
equivalents, which set things up, then loop around all appropriate extensions.

(cherry picked from commit c337d41ae5b7ea3e2fe8b0bea5a5b578908a841b)

M make_ext.pl

commit 2cb3e55898d2f1b98780644b39fbf8fac5dbdd42
Author: Nicholas Clark <***@ccl4.org>
Date: Fri Jan 30 23:12:24 2009 +0000

The logic to set $makefile to 'Makefile.old' can't work, so remove it.
(Makefile.old is created by running make clean in an extension, and make clean
at the top level removes ./miniperl, so there won't be a miniperl to run
make_ext.pl. The Makefile.old logic was valid for the shell script version.
Remove $makeopts, which was missed from the make command in the transcription
from shell to Perl.

(cherry picked from commit d793a8a7f7f2bd8f80c6af1cbf5a405a3d09d08a)

M make_ext.pl

commit a022991a02da3fe6a37ab1c1e7c34de0e08b7fc1
Author: Nicholas Clark <***@ccl4.org>
Date: Fri Jan 30 22:52:50 2009 +0000

Eliminate $makeargs by prepending its contents to $passthru.

(cherry picked from commit 9822e6e0ce235da7838e955762323f2bb3477e07)

M make_ext.pl

commit 982a0f22b28c633b3a4887fae12c7425503ce1e6
Author: Nicholas Clark <***@ccl4.org>
Date: Fri Jan 30 20:45:48 2009 +0000

Use Config; rather than parsing config.sh and pushing it into %ENV, a literal
transcription of the make_ext shell script. (We'll soon see if anything we
called was using its environment rather than Config.pm)

(cherry picked from commit b8d39eba9160d9d827fe1bd336e755657f56fc04)

M make_ext.pl

commit 86364108abb66bf1fef02bd6717493db9bfde269
Author: Nicholas Clark <***@ccl4.org>
Date: Fri Jan 30 17:53:45 2009 +0000

Replace the one file timestamp dependency check with a call to 'make config'
The timestamp check was from the original checkin of buidlext.pl in 2001
(17af6fb0658e86e2f4a472e3392fc688e0c25b43) by Nick I-S.
The 'make config' approach of make_ext was in the 5.000 release.

(cherry picked from commit 42fe6305f0858c20b777cec2d43a7e452f8c6168)

M win32/Makefile
M win32/buildext.pl
M win32/makefile.mk

commit 6b225a392c303a0160463055f8c753a26b20089a
Author: Nicholas Clark <***@ccl4.org>
Date: Thu Jan 29 20:00:48 2009 +0000

win32/ext was removed by change 30379 in 2007, so no need to check for it in the
Makefiles.

(cherry picked from commit c15dd1a1b89f3a02cd9e0664b570f8e63090ef90)

M win32/Makefile
M win32/makefile.mk

commit abc25f93704e96e0ad8395435a979a746c1abbc4
Author: Nicholas Clark <***@ccl4.org>
Date: Thu Jan 29 21:13:01 2009 +0000

Add --options with arguments to make_ext.pl. Pass $target as --target=...
Treat all arguments that /=/ as passthrough, the rest being extensions.
This will converge the argument passing conventions for make_ext.pl and
win32/buildext.pl

(cherry picked from commit e2fabae1d9ef1c59ea9ada793c05d5b7452e27b6)

M Cross/Makefile-cross-SH
M Makefile.SH
M make_ext.pl

commit c28f13f8da77c548e721053a05af75b305c28d85
Author: Nicholas Clark <***@ccl4.org>
Date: Thu Jan 29 16:57:34 2009 +0000

Add an explicit --all option to buildext.pl, rather than defaulting to it if
--static and --dynamic are not present. Make it run under strict.

(cherry picked from commit aaaf44d72fce5980564533b9072da6e594d91d81)

M win32/Makefile
M win32/buildext.pl
M win32/makefile.mk

commit b4daec2089b40f0668d5b680a0cc1fdc9388f5c5
Author: Nicholas Clark <***@ccl4.org>
Date: Wed Jan 28 22:55:26 2009 +0000

Pass $(MAKE) as one quoted commandline argument, to converge with make_ext.pl

(cherry picked from commit 8ed969f8dc7e9744ad177a35c99ce43a1bcb63a6)

M win32/Makefile
M win32/buildext.pl
M win32/makefile.mk

commit 9c9feb850058a306eaf7a06a99217013213e4a6b
Author: Nicholas Clark <***@ccl4.org>
Date: Wed Jan 28 15:10:42 2009 +0000

Move ext/util/make_ext.pl to the top level.

(cherry picked from commit 3f3ffb6144f605cbf5773fd80fc9f5c2949f7d87)

M Cross/Makefile-cross-SH
M MANIFEST
M Makefile.SH
D ext/util/make_ext.pl
A make_ext.pl

commit 6b4f667af57dba306bf418c381d1da871049cdc4
Author: Nicholas Clark <***@ccl4.org>
Date: Wed Jan 28 14:33:34 2009 +0000

Fold ext/util/make_ext_cross into ext/util/make_ext.pl, and delete it.
Add --option argument parsing to make_ext.pl (swiped from buildext.pl).
Add a --cross option to add -MCross to the Makefile.PL line.
Change Cross/Makefile-cross-SH to call "ext/util/make_ext.pl --cross ..."

(cherry-picked from commit 97a26ad97b57719769c0df73f21ab399fc6ae981)

M Cross/Makefile-cross-SH
M MANIFEST
M ext/util/make_ext.pl
D ext/util/make_ext_cross

commit 0964a9fe07e84e298aab89374b1a45c9806d888c
Author: Nicholas Clark <***@ccl4.org>
Date: Sun Jan 25 16:45:04 2009 +0000

In the code for printing -v, replace longhand newSVpvn() with newSVpvs(), and
avoid needing a sv_catpvs().

(cherry picked from commit 23d483e2ac9eec5dd3415b4d8aad7ec7b0551ead)

M perl.c

commit d6ce117325515d3a56dde2c8f1dcd3fd3c196f3a
Author: Nicholas Clark <***@ccl4.org>
Date: Tue Jan 27 21:59:02 2009 +0000

In buildext.pl, refactor the @ARGV parsing into a single loop.

(cherry picked from commit 4feb7f09863104b519a817212830509fc1dd677e)

M win32/buildext.pl

commit b6bc15d644c3f69436f2effe656179f2c0f4d54e
Author: Nicholas Clark <***@ccl4.org>
Date: Mon Jan 26 22:49:19 2009 +0000

Break the --create-perllibst-h and --list-static-libs options out of buildext.pl
into separate scripts.

(cherry picked from commit c6d234b82f2f6387f4a8ddb73277519b5bca93fc)

M MANIFEST
M win32/Makefile
M win32/buildext.pl
A win32/create_perllibst_h.pl
A win32/list_static_libs.pl
M win32/makefile.mk
-----------------------------------------------------------------------

Summary of changes:
Cross/Makefile-cross-SH | 29 +++--
MANIFEST | 7 +-
Makefile.SH | 32 ++---
ext/util/make_ext.pl | 226 -----------------------------------
ext/util/make_ext_cross | 147 -----------------------
make_ext.pl | 275 +++++++++++++++++++++++++++++++++++++++++++
perl.c | 9 +-
win32/FindExt.pm | 65 +++++-----
win32/FindExt.t | 42 +++++++
win32/Makefile | 27 ++---
win32/Makefile.ce | 10 +-
win32/buildext.pl | 161 -------------------------
win32/create_perllibst_h.pl | 17 +++
win32/list_static_libs.pl | 17 +++
win32/makefile.mk | 27 ++---
15 files changed, 450 insertions(+), 641 deletions(-)
delete mode 100644 ext/util/make_ext.pl
delete mode 100644 ext/util/make_ext_cross
create mode 100644 make_ext.pl
create mode 100644 win32/FindExt.t
delete mode 100644 win32/buildext.pl
create mode 100644 win32/create_perllibst_h.pl
create mode 100644 win32/list_static_libs.pl

diff --git a/Cross/Makefile-cross-SH b/Cross/Makefile-cross-SH
index c6ecf41..70181b1 100755
--- a/Cross/Makefile-cross-SH
+++ b/Cross/Makefile-cross-SH
@@ -50,7 +50,7 @@ true)
esac

pldlflags="$cccdlflags"
- static_target='static_pic'
+ static_ldflags=''
case "${osname}${osvers}" in
next4*)
ld=libtool
@@ -151,7 +151,7 @@ EOT
;;

*) pldlflags=''
- static_target='static'
+ static_ldflags='CCCDLFLAGS='
;;
esac

@@ -237,8 +237,8 @@ SHRPENV = $shrpenv
# if building a shared libperl.so that might later be linked into
# another application, then it might be appropriate to also build static
# extensions (usually just DynaLoader) with relocatable code (e.g. -fPIC
-# for GNU cc). This is handled by ext/util/make_ext.
-STATIC = $static_target
+# for GNU cc).
+STATIC_LDFLAGS = $static_ldflags

# The following is used to include the current directory in
# the dynamic loader path you are building a shared libperl.
@@ -956,16 +956,16 @@ manicheck: FORCE


$(DYNALOADER): preplibrary FORCE
- @$(LDLIBPTH) sh ext/util/make_ext_cross $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+ @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)

d_dummy $(dynamic_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE
- @$(LDLIBPTH) sh ext/util/make_ext_cross dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+ @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic

s_dummy $(static_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE
- @$(LDLIBPTH) sh ext/util/make_ext_cross $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+ @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)

n_dummy $(nonxs_ext): miniperl$(EXE_EXT) preplibrary $(DYNALOADER) FORCE
- @$(LDLIBPTH) sh ext/util/make_ext_cross nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+ @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
!NO!SUBS!

$spitshell >>$Makefile <<EOF
@@ -1023,7 +1023,7 @@ _tidy:
-cd utils; $(LDLIBPTH) $(MAKE) clean
-cd x2p; $(LDLIBPTH) $(MAKE) clean
-@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
- $(LDLIBPTH) sh ext/util/make_ext clean $$x MAKE=$(MAKE) ; \
+ $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --target=clean $$x MAKE=$(MAKE) ; \
done

_cleaner1:
@@ -1031,9 +1031,14 @@ _cleaner1:
-cd pod; $(LDLIBPTH) $(MAKE) $(CLEAN)
-cd utils; $(LDLIBPTH) $(MAKE) $(CLEAN)
-cd x2p; $(LDLIBPTH) $(MAKE) $(CLEAN)
- -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
- $(LDLIBPTH) sh ext/util/make_ext $(CLEAN) $$x MAKE=$(MAKE) ; \
- done
+ -@if test -f miniperl$(EXE_EXT) ; then \
+ for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
+ $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --target=$(CLEAN) $$x MAKE=$(MAKE) ; \
+ done ; \
+ else \
+ sh $(CLEAN).sh ; \
+ fi
+ rm -f realclean.sh veryclean.sh
-@test ! -f ./miniperl$(EXE_EXT) || $(LDLIBPTH) ./miniperl$(EXE_EXT) -Ilib mkppport --clean

# Some systems do not support "?", so keep these files separate.
diff --git a/MANIFEST b/MANIFEST
index 4693140..932b2f0 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1400,8 +1400,6 @@ ext/Unicode/Normalize/t/proto.t Unicode::Normalize
ext/Unicode/Normalize/t/split.t Unicode::Normalize
ext/Unicode/Normalize/t/test.t Unicode::Normalize
ext/Unicode/Normalize/t/tie.t Unicode::Normalize
-ext/util/make_ext_cross Cross-compilation
-ext/util/make_ext.pl Used by Makefile to execute extension Makefiles
ext/Win32API/File/buffers.h Win32API::File extension
ext/Win32API/File/cFile.h Win32API::File extension
ext/Win32API/File/cFile.pc Win32API::File extension
@@ -3173,6 +3171,7 @@ Makefile.SH A script that generates Makefile
make_patchnum.pl Script to generate git_version.h and lib/Config_git.pl files for all OS'es
malloc.c A version of malloc you might not want
malloc_ctl.h A version of malloc you might not want
+make_ext.pl Used by Makefile to execute extension Makefiles
MANIFEST This list of files
mathoms.c A home for binary-compatible code artifacts
META.yml Distribution meta-data in YAML
@@ -4329,7 +4328,6 @@ win32/bin/perlglob.pl Win32 globbing
win32/bin/pl2bat.pl wrap perl scripts into batch files
win32/bin/runperl.pl run perl script via batch file namesake
win32/bin/search.pl Win32 port
-win32/buildext.pl Build extensions once miniperl is built
win32/ce-helpers/cecopy-lib.pl WinCE port
win32/ce-helpers/compile-all.bat WinCE port
win32/ce-helpers/compile.bat WinCE port
@@ -4348,15 +4346,18 @@ win32/config_H.vc64 Win64 config header (Visual C++ build)
win32/config_sh.PL Perl code to update Win32 config.sh from Makefile
win32/config.vc Win32 base line config.sh (Visual C++ build)
win32/config.vc64 Win64 base line config.sh (Visual C++ build)
+win32/create_perllibst_h.pl creates perllibst.h file for inclusion from perllib.c
win32/distclean.bat Remove _ALL_ files not listed here in MANIFEST
win32/dl_win32.xs Win32 port
win32/fcrypt.c crypt() implementation
win32/FindExt.pm Scan for extensions
+win32/FindExt.t Test FindExt.pm
win32/genmk95.pl Perl code to generate command.com-usable makefile.95
win32/include/arpa/inet.h Win32 port
win32/include/dirent.h Win32 port
win32/include/netdb.h Win32 port
win32/include/sys/socket.h Win32 port
+win32/list_static_libs.pl prints libraries for static linking
win32/Makefile Win32 makefile for NMAKE (Visual C++ build)
win32/Makefile.ce WinCE port
win32/makefile.mk Win32 makefile for DMAKE (BC++, VC++ builds)
diff --git a/Makefile.SH b/Makefile.SH
index 347fe94..0d9ffa4 100644
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -64,7 +64,7 @@ true)
esac

pldlflags="$cccdlflags"
- static_target='static_pic'
+ static_ldflags=''
case "${osname}${osvers}" in
next4*)
ld=libtool
@@ -180,7 +180,7 @@ EOT
;;

*) pldlflags=''
- static_target='static'
+ static_ldflags='CCCDLFLAGS='
;;
esac

@@ -277,8 +277,8 @@ SHRPENV = $shrpenv
# if building a shared libperl.so that might later be linked into
# another application, then it might be appropriate to also build static
# extensions (usually just DynaLoader) with relocatable code (e.g. -fPIC
-# for GNU cc). This is handled by ext/util/make_ext.pl.
-STATIC = $static_target
+# for GNU cc).
+STATIC_LDFLAGS = $static_ldflags

# The following is used to include the current directory in
# the dynamic loader path you are building a shared libperl.
@@ -372,10 +372,8 @@ CCCMD = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $@`

CCCMDSRC = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $<`

-# we dont include lib/Config_git.pl here, as it causes circular dependencies
-CONFIGPM = lib/Config.pm lib/Config_heavy.pl
-# so we add it here:
-CONFIGPM_EXTRA = $(CONFIGPM) lib/Config_git.pl
+CONFIGPM_FROM_CONFIG_SH = lib/Config.pm lib/Config_heavy.pl
+CONFIGPM = $(CONFIGPM_FROM_CONFIG_SH) lib/Config_git.pl

CONFIGPOD = lib/Config.pod

@@ -543,7 +541,7 @@ sperl.i: perl.c $(h)

.PHONY: all translators utilities

-git_version.h: miniperl$(EXE_EXT) make_patchnum.pl
+lib/Config_git.pl git_version.h: miniperl$(EXE_EXT) make_patchnum.pl
$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_patchnum.pl

# make sure that we recompile perl.c if the git version changes
@@ -983,11 +981,9 @@ preplibrary: miniperl$(EXE_EXT) $(CONFIGPM) lib/lib.pm $(PREPLIBRARY_LIBPERL)
$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib -MAutoSplit -MFile::Find -e 'find ({no_chdir=>1, wanted => sub {autosplit_lib_modules($$_) if /\.pm$$/}}, "lib")'
$(MAKE) lib/re.pm

-$(CONFIGPOD): config.sh miniperl$(EXE_EXT) configpm Porting/Glossary
+$(CONFIGPM_FROM_CONFIG_SH) $(CONFIGPOD): config.sh miniperl$(EXE_EXT) configpm Porting/Glossary
$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib configpm

-$(CONFIGPM): $(CONFIGPOD)
-
lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl$(EXE_EXT) minimod.pl $(CONFIGPM)
$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) minimod.pl > lib/ExtUtils/Miniperl.pm

@@ -1166,16 +1162,16 @@ manicheck: FORCE
# DynaLoader may be needed for extensions that use Makefile.PL.

$(DYNALOADER): miniperl$(EXE_EXT) preplibrary FORCE
- $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib ext/util/make_ext.pl $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+ $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)

d_dummy $(dynamic_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE
- $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib ext/util/make_ext.pl dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+ $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic

s_dummy $(static_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE
- $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib ext/util/make_ext.pl $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+ $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)

n_dummy $(nonxs_ext): miniperl$(EXE_EXT) preplibrary FORCE
- $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib ext/util/make_ext.pl nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+ $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
!NO!SUBS!

$spitshell >>$Makefile <<EOF
@@ -1235,7 +1231,7 @@ _tidy:
-cd x2p; $(LDLIBPTH) $(MAKE) clean
-rm -f lib/Config_git.pl git_version.h
-@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
- $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib ext/util/make_ext.pl clean $$x MAKE=$(MAKE) ; \
+ $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --target=clean $$x MAKE=$(MAKE) ; \
done

_cleaner1:
@@ -1245,7 +1241,7 @@ _cleaner1:
-cd x2p; $(LDLIBPTH) $(MAKE) $(CLEAN)
-@if test -f miniperl$(EXE_EXT) ; then \
for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
- $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib ext/util/make_ext.pl $(CLEAN) $$x MAKE=$(MAKE) ; \
+ $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --target=$(CLEAN) $$x MAKE=$(MAKE) ; \
done ; \
else \
sh $(CLEAN).sh ; \
diff --git a/ext/util/make_ext.pl b/ext/util/make_ext.pl
deleted file mode 100644
index 0f35ab4..0000000
--- a/ext/util/make_ext.pl
+++ /dev/null
@@ -1,226 +0,0 @@
-#!./miniperl
-use strict;
-use warnings;
-
-# This script acts as a simple interface for building extensions.
-# It primarily used by the perl Makefile:
-#
-# d_dummy $(dynamic_ext): miniperl preplibrary FORCE
-# @$(RUN) ./miniperl ext/util/make_ext.pl dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
-#
-# It may be deleted in a later release of perl so try to
-# avoid using it for other purposes.
-
-my $target = shift(@ARGV);
-my $extspec = shift(@ARGV);
-my $makecmd = shift(@ARGV); # Should be something like MAKE=make
-my $passthru = join(' ', @ARGV); # allow extra macro=value to be passed through
-print "\n";
-
-# Previously, $make was taken from config.sh. However, the user might
-# instead be running a possibly incompatible make. This might happen if
-# the user types "gmake" instead of a plain "make", for example. The
-# correct current value of MAKE will come through from the main perl
-# makefile as MAKE=/whatever/make in $makecmd. We'll be cautious in
-# case third party users of this script (are there any?) don't have the
-# MAKE=$(MAKE) argument, which was added after 5.004_03.
-my $make;
-if (defined($makecmd) and $makecmd =~ /^MAKE=(.*)$/) {
- $make = $1;
-}
-else {
- print "ext/util/make_ext: WARNING: Please include MAKE=\$(MAKE)\n";
- print "\tin your call to make_ext. See ext/util/make_ext for details.\n";
- exit(1);
-}
-
-# search config.sh for inclusion
-$ENV{CONFIG} = '' if not defined $ENV{CONFIG};
-if ($ENV{CONFIG} eq '') {
- my $config;
- foreach my $depth (0..4) {
- my $file = ('../' x $depth) . 'config.sh';
- $config = $file, last if -f $file;
- }
- print("Can't find config.sh generated by Configure"), exit(1)
- unless defined $config;
-
- load_config_sh($config);
-}
-
-# fallback to config.sh's MAKE
-$make ||= $ENV{make} || $ENV{MAKE};
-my $run = $ENV{run};
-$run = '' if not defined $run;
-$run .= ' ' if $run ne '';;
-
-if (!defined($extspec) or $extspec eq '') {
- print "make_ext: no extension specified\n";
- exit(1);
-}
-
-# The Perl Makefile.SH will expand all extensions to
-# lib/auto/X/X.a (or lib/auto/X/Y/Y.a if nested)
-# A user wishing to run make_ext might use
-# X (or X/Y or X::Y if nested)
-
-# canonise into X/Y form (pname)
-
-my $pname = $extspec;
-if ($extspec =~ /^lib/) {
- # Remove lib/auto prefix and /*.* suffix
- $pname =~ s{^lib/auto/}{};
- $pname =~ s{[^/]*\.[^/]*$}{};
-}
-elsif ($extspec =~ /^ext/) {
- # Remove ext/ prefix and /pm_to_blib suffix
- $pname =~ s{^ext/}{};
- $pname =~ s{/pm_to_blib$}{};
-}
-elsif ($extspec =~ /::/) {
- # Convert :: to /
- $pname =~ s{::}{\/}g;
-}
-elsif ($extspec =~ /\..*o$/) {
- $pname =~ s/\..*o//;
-}
-
-my $mname = $pname;
-$mname =~ s!/!::!g;
-my $depth = $pname;
-$depth =~ s![^/]+!..!g;
-my $makefile = "Makefile";
-my $makeargs = '';
-my $makeopts = '';
-
-if (not -d "ext/$pname") {
- print "\tSkipping $extspec (directory does not exist)\n";
- exit(0); # not an error ?
-}
-
-if ($ENV{osname} eq 'catamount') {
- # Snowball's chance of building extensions.
- print "This is $ENV{osname}, not building $mname, sorry.\n";
- exit(0);
-}
-
-print "\tMaking $mname ($target)\n";
-
-chdir("ext/$pname");
-
-# check link type and do any preliminaries. Valid link types are
-# 'dynamic', 'static', and 'static_pic' (the last one respects
-# CCCDLFLAGS such as -fPIC -- see static_target in the main Makefile.SH)
-if ($target eq 'dynamic') {
- $makeargs = "LINKTYPE=dynamic";
- $target = 'all';
-}
-elsif ($target eq 'static') {
- $makeargs = "LINKTYPE=static CCCDLFLAGS=";
- $target = 'all';
-}
-elsif ($target eq 'static_pic') {
- $makeargs = "LINKTYPE=static";
- $target = 'all';
-}
-elsif ($target eq 'nonxs') {
- $makeargs = "";
- $target = 'all';
-}
-elsif ($target =~ /clean$/) {
- # If Makefile has been moved to Makefile.old by a make clean
- # then use Makefile.old for realclean rather than rebuild it
- if (! -f $makefile and -f "Makefile.old") {
- $makefile = "Makefile.old";
- $makeopts = "-f $makefile";
- print "Note: Using Makefile.old\n";
- }
-}
-elsif ($target eq '') {
- print "make_ext: no make target specified (eg static or dynamic)\n";
- exit(1);
-}
-else {
- # for the time being we are strict about what make_ext is used for
- print "make_ext: unknown make target '$target'\n";
- exit(1);
-}
-
-
-if (not -f $makefile) {
- if (-f "Makefile.PL") {
- system("${run}../$depth/miniperl -I../$depth/lib Makefile.PL INSTALLDIRS=perl INSTALLMAN3DIR=none PERL_CORE=1 $passthru");
- }
- # Right. The reason for this little hack is that we're sitting inside
- # a program run by ./miniperl, but there are tasks we need to perform
- # when the 'realclean', 'distclean' or 'veryclean' targets are run.
- # Unfortunately, they can be run *after* 'clean', which deletes
- # ./miniperl
- # So we do our best to leave a set of instructions identical to what
- # we would do if we are run directly as 'realclean' etc
- # Whilst we're perfect, unfortunately the targets we call are not, as
- # some of them rely on a $(PERL) for their own distclean targets.
- # But this always used to be a problem with the old /bin/sh version of
- # this.
- my $suffix = '.sh';
- foreach my $clean_target ('realclean', 'veryclean') {
- my $file = "../$depth/$clean_target$suffix";
- open my $fh, '>>', $file or die "open $file: $!";
- # Quite possible that we're being run in parallel here.
- # Can't use Fcntl this early to get the LOCK_EX
- flock $fh, 2 or warn "flock $file: $!";
- if ($^O eq 'VMS') {
- # Write out DCL here
- } elsif ($^O eq 'MSWin32') {
- # Might not need anything here.
- } else {
- print $fh <<"EOS";
-chdir ext/$pname
-if test ! -f $makefile -a -f Makefile.old; then
- echo "Note: Using Makefile.old"
- make -f Makefile.old $clean_target MAKE=$make $passthru
-else
- if test ! -f $makefile ; then
- echo "Warning: No Makefile!"
- fi
- make $clean_target MAKE=$make $passthru
-fi
-chdir ../$depth
-EOS
- }
- close $fh or die "close $file: $!";
- }
-}
-
-if (not -f $makefile) {
- print "Warning: No Makefile!\n";
-}
-
-if ($target eq 'clean') {
-}
-elsif ($target eq 'realclean') {
-}
-else {
- # Give makefile an opportunity to rewrite itself.
- # reassure users that life goes on...
- system( "$run$make config MAKE=$make $passthru" )
- and print "$make config failed, continuing anyway...\n";
-}
-
-system(
- "$run$make $target MAKE=$make $makeargs $passthru"
-) or exit();
-
-exit($?);
-
-# read config.sh and add its keys to our %ENV
-sub load_config_sh {
- my $file = shift;
- open my $fh, '<', $file or die "Could not open file '$file' as a 'config.sh': $!";
- while (<$fh>) {
- chomp;
- next if /^\s*#/;
- $ENV{$1} = $3 if /^(?!:)([^\s=]+)=('?)(.*?)\2$/;
- }
- close $fh;
-}
diff --git a/ext/util/make_ext_cross b/ext/util/make_ext_cross
deleted file mode 100644
index b89c8e7..0000000
--- a/ext/util/make_ext_cross
+++ /dev/null
@@ -1,147 +0,0 @@
-#!/bin/sh
-
-# This script acts as a simple interface for building extensions.
-# (borrowed from make_ext; but it will be deleted in future versions)
-# It primarily used by the perl Makefile:
-#
-# d_dummy $(dynamic_ext): miniperl preplibrary FORCE
-# @sh ext/util/make_ext dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
-#
-# It may be deleted in a later release of perl so try to
-# avoid using it for other purposes.
-
-target=$1; shift
-extspec=$1; shift
-makecmd=$1; shift # Should be something like MAKE=make
-passthru="$*" # allow extra macro=value to be passed through
-echo ""
-
-# Previously, $make was taken from config.sh. However, the user might
-# instead be running a possibly incompatible make. This might happen if
-# the user types "gmake" instead of a plain "make", for example. The
-# correct current value of MAKE will come through from the main perl
-# makefile as MAKE=/whatever/make in $makecmd. We'll be cautious in
-# case third party users of this script (are there any?) don't have the
-# MAKE=$(MAKE) argument, which was added after 5.004_03.
-case "$makecmd" in
-MAKE=*)
- eval $makecmd
- ;;
-*) echo 'ext/util/make_ext: WARNING: Please include MAKE=$(MAKE)'
- echo ' in your call to make_ext. See ext/util/make_ext for details.'
- exit 1
- ;;
-esac
-
-
-case $CONFIG in
-'')
- if test -f config.sh; then TOP=.;
- elif test -f ../config.sh; then TOP=..;
- elif test -f ../../config.sh; then TOP=../..;
- elif test -f ../../../config.sh; then TOP=../../..;
- elif test -f ../../../../config.sh; then TOP=../../../..;
- else
- echo "Can't find config.sh generated by Configure"; exit 1
- fi
- . $TOP/config.sh
- ;;
-esac
-
-if test "X$extspec" = X; then
- echo "make_ext: no extension specified"
- exit 1;
-fi
-
-# The Perl Makefile.SH will expand all extensions to
-# lib/auto/X/X.a (or lib/auto/X/Y/Y.a if nested)
-# A user wishing to run make_ext might use
-# X (or X/Y or X::Y if nested)
-
-# canonise into X/Y form (pname)
-case "$extspec" in
-lib*) # Remove lib/auto prefix and /*.* suffix
- pname=`echo "$extspec" | sed -e 's:^lib/auto/::' -e 's:/[^/]*\.[^/]*$::' ` ;;
-ext*) # Remove ext/ prefix and /pm_to_blib suffix
- pname=`echo "$extspec" | sed -e 's:^ext/::' -e 's:/pm_to_blib$::' ` ;;
-*::*) # Convert :: to /
- pname=`echo "$extspec" | sed -e 's/::/\//g' ` ;;
-*.*o) pname=`echo "$extspec" | sed -e 's/\..*o//'` ;;
-*) pname="$extspec" ;;
-esac
-# echo "Converted $extspec to $pname"
-
-mname=`echo "$pname" | sed -e 's!/!::!g'`
-depth=`echo "$pname" | sed -e 's![^/][^/]*!..!g'`
-makefile=Makefile
-makeargs=''
-makeopts=''
-
-if test ! -d "ext/$pname"; then
- echo " Skipping $extspec (directory does not exist)"
- exit 0 # not an error ?
-fi
-
-case "$osname" in
-catamount) # Snowball's chance of building extensions.
- echo "This is $osname, not building $mname, sorry."
- exit 0
- ;;
-esac
-
-echo " Making $mname ($target)"
-
-cd ext/$pname
-
-# check link type and do any preliminaries. Valid link types are
-# 'dynamic', 'static', and 'static_pic' (the last one respects
-# CCCDLFLAGS such as -fPIC -- see static_target in the main Makefile.SH)
-case "$target" in
-dynamic) makeargs="LINKTYPE=dynamic";
- target=all
- ;;
-static) makeargs="LINKTYPE=static CCCDLFLAGS="
- target=all
- ;;
-static_pic) makeargs="LINKTYPE=static"
- target=all
- ;;
-nonxs) makeargs="";
- target=all
- ;;
-
-*clean) # If Makefile has been moved to Makefile.old by a make clean
- # then use Makefile.old for realclean rather than rebuild it
- if test ! -f $makefile -a -f Makefile.old; then
- makefile=Makefile.old
- makeopts="-f $makefile"
- echo "Note: Using Makefile.old"
- fi
- ;;
-
-*) # for the time being we are strict about what make_ext is used for
- echo "make_ext: unknown make target '$target'"; exit 1
- ;;
-'') echo "make_ext: no make target specified (eg static or dynamic)"; exit 1
- ;;
-esac
-
-if test ! -f $makefile ; then
- test -f Makefile.PL && $run ../$depth/miniperl -I../$depth/lib -MCross Makefile.PL INSTALLDIRS=perl INSTALLMAN3DIR=none PERL_CORE=1 $passthru
-fi
-if test ! -f $makefile ; then
- echo "Warning: No Makefile!"
-fi
-
-case "$target" in
-clean) ;;
-realclean) ;;
-*) # Give makefile an opportunity to rewrite itself.
- # reassure users that life goes on...
- $MAKE config MAKE=$MAKE $passthru || echo "$MAKE config failed, continuing anyway..."
- ;;
-esac
-
-$MAKE $makeopts $target MAKE=$MAKE $makeargs $passthru || exit
-
-exit $?
diff --git a/make_ext.pl b/make_ext.pl
new file mode 100644
index 0000000..2875422
--- /dev/null
+++ b/make_ext.pl
@@ -0,0 +1,275 @@
+#!./miniperl
+use strict;
+use warnings;
+use Config;
+use Cwd;
+
+# This script acts as a simple interface for building extensions.
+
+# It's actually a cut and shut of the Unix version ext/utils/makeext and the
+# Windows version win32/build_ext.pl hence the two invocation styles.
+
+# On Unix, it primarily used by the perl Makefile one extention at a time:
+#
+# d_dummy $(dynamic_ext): miniperl preplibrary FORCE
+# @$(RUN) ./miniperl make_ext.pl --target=dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+#
+# On Windows,
+# If '--static' is specified, static extensions will be built.
+# If '--dynamic' is specified, dynamic (and nonxs) extensions will be built.
+# If '--all' is specified, all extensions will be built.
+#
+# make_ext.pl "MAKE=make [-make_opts]" --dir=directory [--target=target] [--static|--dynamic|--all] +ext2 !ext1
+#
+# E.g.
+#
+# make_ext.pl "MAKE=nmake -nologo" --dir=..\ext
+#
+# make_ext.pl "MAKE=nmake -nologo" --dir=..\ext --target=clean
+#
+# make_ext.pl MAKE=dmake --dir=..\ext
+#
+# make_ext.pl MAKE=dmake --dir=..\ext --target=clean
+#
+# Will skip building extensions which are marked with an '!' char.
+# Mostly because they still not ported to specified platform.
+#
+# If any extensions are listed with a '+' char then only those
+# extensions will be built, but only if they arent countermanded
+# by an '!ext' and are appropriate to the type of building being done.
+
+# It may be deleted in a later release of perl so try to
+# avoid using it for other purposes.
+
+my $is_Win32 = $^O eq 'MSWin32';
+my $is_VMS = $^O eq 'VMS';
+my $is_Unix = !$is_Win32 && !$is_VMS;
+
+require FindExt if $is_Win32;
+
+my (%excl, %incl, %opts, @extspec, @pass_through);
+
+foreach (@ARGV) {
+ if (/^!(.*)$/) {
+ $excl{$1} = 1;
+ } elsif (/^\+(.*)$/) {
+ $incl{$1} = 1;
+ } elsif (/^--([\w\-]+)$/) {
+ $opts{$1} = 1;
+ } elsif (/^--([\w\-]+)=(.*)$/) {
+ $opts{$1} = $2;
+ } elsif (/=/) {
+ push @pass_through, $_;
+ } elsif (length) {
+ push @extspec, $_;
+ }
+}
+
+my $static = $opts{static} || $opts{all};
+my $dynamic = $opts{dynamic} || $opts{all};
+
+# The Perl Makefile.SH will expand all extensions to
+# lib/auto/X/X.a (or lib/auto/X/Y/Y.a if nested)
+# A user wishing to run make_ext might use
+# X (or X/Y or X::Y if nested)
+
+# canonise into X/Y form (pname)
+
+foreach (@extspec) {
+ if (s{^lib/auto/}{}) {
+ # Remove lib/auto prefix and /*.* suffix
+ s{/[^/]+\.[^/]+$}{};
+ } elsif (s{^ext/}{}) {
+ # Remove ext/ prefix and /pm_to_blib suffix
+ s{/pm_to_blib$}{};
+ } elsif (s{::}{\/}g) {
+ # Convert :: to /
+ } else {
+ s/\..*o//;
+ }
+}
+
+my $makecmd = shift @pass_through; # Should be something like MAKE=make
+unshift @pass_through, 'PERL_CORE=1';
+
+my $dir = $opts{dir} || 'ext';
+my $target = $opts{target};
+$target = 'all' unless defined $target;
+
+# Previously, $make was taken from config.sh. However, the user might
+# instead be running a possibly incompatible make. This might happen if
+# the user types "gmake" instead of a plain "make", for example. The
+# correct current value of MAKE will come through from the main perl
+# makefile as MAKE=/whatever/make in $makecmd. We'll be cautious in
+# case third party users of this script (are there any?) don't have the
+# MAKE=$(MAKE) argument, which was added after 5.004_03.
+unless(defined $makecmd and $makecmd =~ /^MAKE=(.*)$/) {
+ die "$0: WARNING: Please include MAKE=\$(MAKE) in \@ARGV\n";
+}
+
+# This isn't going to cope with anything fancy, such as spaces inside command
+# names, but neither did what it replaced. Once there is a use case that needs
+# it, please supply patches. Until then, I'm sticking to KISS
+my @make = split ' ', $1 || $Config{make} || $ENV{MAKE};
+# Using an array of 0 or 1 elements makes the subsequent code simpler.
+my @run = $Config{run};
+@run = () if not defined $run[0] or $run[0] eq '';
+
+
+if ($target eq '') {
+ die "make_ext: no make target specified (eg all or clean)\n";
+} elsif ($target !~ /(?:^all|clean)$/) {
+ # for the time being we are strict about what make_ext is used for
+ die "$0: unknown make target '$target'\n";
+}
+
+if (!@extspec and !$static and !$dynamic) {
+ die "$0: no extension specified\n";
+}
+
+my $perl;
+my %extra_passthrough;
+
+if ($is_Win32) {
+ (my $here = getcwd()) =~ s{/}{\\}g;
+ $perl = $^X;
+ if ($perl =~ m#^\.\.#) {
+ $perl = "$here\\$perl";
+ }
+ (my $topdir = $perl) =~ s/\\[^\\]+$//;
+ # miniperl needs to find perlglob and pl2bat
+ $ENV{PATH} = "$topdir;$topdir\\win32\\bin;$ENV{PATH}";
+ my $pl2bat = "$topdir\\win32\\bin\\pl2bat";
+ unless (-f "$pl2bat.bat") {
+ my @args = ($perl, ("$pl2bat.pl") x 2);
+ print "@args\n";
+ system(@args) unless defined $::Cross::platform;
+ }
+
+ print "In ", getcwd();
+ chdir($dir) || die "Cannot cd to $dir\n";
+ (my $ext = getcwd()) =~ s{/}{\\}g;
+ FindExt::scan_ext($ext);
+ FindExt::set_static_extensions(split ' ', $Config{static_ext});
+
+ my @ext;
+ push @ext, FindExt::static_ext() if $static;
+ push @ext, FindExt::dynamic_ext(), FindExt::nonxs_ext() if $dynamic;
+
+ foreach (sort @ext) {
+ if (%incl and !exists $incl{$_}) {
+ #warn "Skipping extension $ext\\$_, not in inclusion list\n";
+ next;
+ }
+ if (exists $excl{$_}) {
+ warn "Skipping extension $ext\\$_, not ported to current platform";
+ next;
+ }
+ push @extspec, $_;
+ if(FindExt::is_static($_)) {
+ push @{$extra_passthrough{$_}}, 'LINKTYPE=static';
+ }
+ }
+ chdir '..'; # now in the Perl build directory
+}
+
+foreach my $spec (@extspec) {
+ my $mname = $spec;
+ $mname =~ s!/!::!g;
+ my $ext_pathname = "ext/$spec";
+ my $up = $ext_pathname;
+ $up =~ s![^/]+!..!g;
+
+ if ($Config{osname} eq 'catamount') {
+ # Snowball's chance of building extensions.
+ die "This is $Config{osname}, not building $mname, sorry.\n";
+ }
+
+ print "\tMaking $mname ($target)\n";
+
+ build_extension('ext', $ext_pathname, $up, $perl || "$up/miniperl",
+ "$up/lib",
+ [@pass_through, @{$extra_passthrough{$spec} || []}]);
+}
+
+sub build_extension {
+ my ($ext, $ext_dir, $return_dir, $perl, $lib_dir, $pass_through) = @_;
+ unless (chdir "$ext_dir") {
+ warn "Cannot cd to $ext_dir: $!";
+ return;
+ }
+
+ if (!-f 'Makefile') {
+ print "\nRunning Makefile.PL in $ext_dir\n";
+
+ # Presumably this can be simplified
+ my @cross;
+ if (defined $::Cross::platform) {
+ # Inherited from win32/buildext.pl
+ @cross = "-MCross=$::Cross::platform";
+ } elsif ($opts{cross}) {
+ # Inherited from make_ext.pl
+ @cross = '-MCross';
+ }
+
+ my @perl = (@run, $perl, "-I$lib_dir", @cross, 'Makefile.PL',
+ 'INSTALLDIRS=perl', 'INSTALLMAN3DIR=none',
+ @$pass_through);
+ print join(' ', @perl), "\n";
+ my $code = system @perl;
+ warn "$code from $ext_dir\'s Makefile.PL" if $code;
+
+ # Right. The reason for this little hack is that we're sitting inside
+ # a program run by ./miniperl, but there are tasks we need to perform
+ # when the 'realclean', 'distclean' or 'veryclean' targets are run.
+ # Unfortunately, they can be run *after* 'clean', which deletes
+ # ./miniperl
+ # So we do our best to leave a set of instructions identical to what
+ # we would do if we are run directly as 'realclean' etc
+ # Whilst we're perfect, unfortunately the targets we call are not, as
+ # some of them rely on a $(PERL) for their own distclean targets.
+ # But this always used to be a problem with the old /bin/sh version of
+ # this.
+ if ($is_Unix) {
+ my $suffix = '.sh';
+ foreach my $clean_target ('realclean', 'veryclean') {
+ my $file = "$return_dir/$clean_target$suffix";
+ open my $fh, '>>', $file or die "open $file: $!";
+ # Quite possible that we're being run in parallel here.
+ # Can't use Fcntl this early to get the LOCK_EX
+ flock $fh, 2 or warn "flock $file: $!";
+ print $fh <<"EOS";
+cd $ext_dir
+if test ! -f Makefile -a -f Makefile.old; then
+ echo "Note: Using Makefile.old"
+ make -f Makefile.old $clean_target MAKE='@make' @pass_through
+else
+ if test ! -f Makefile ; then
+ echo "Warning: No Makefile!"
+ fi
+ make $clean_target MAKE='@make' @pass_through
+fi
+cd $return_dir
+EOS
+ close $fh or die "close $file: $!";
+ }
+ }
+ }
+
+ if (not -f 'Makefile') {
+ print "Warning: No Makefile!\n";
+ }
+
+ if (!$target or $target !~ /clean$/) {
+ # Give makefile an opportunity to rewrite itself.
+ # reassure users that life goes on...
+ my @config = (@run, @make, 'config', @$pass_through);
+ system @config and print "@config failed, continuing anyway...\n";
+ }
+ my @targ = (@run, @make, $target, @$pass_through);
+ print "Making $target in $ext_dir\***@targ\n";
+ my $code = system @targ;
+ die "Unsuccessful make($ext_dir): code=$code" if $code != 0;
+
+ chdir $return_dir || die "Cannot cd to $return_dir: $!";
+}
diff --git a/perl.c b/perl.c
index dbf0b2d..5987899 100644
--- a/perl.c
+++ b/perl.c
@@ -3345,10 +3345,11 @@ Perl_moreswitches(pTHX_ const char *s)
{
SV* level= vstringify(PL_patchlevel);
#ifdef PERL_PATCHNUM
- SV* num= newSVpvn(PERL_PATCHNUM,sizeof(PERL_PATCHNUM)-1);
-#ifdef PERL_GIT_UNCOMMITTED_CHANGES
- sv_catpvs(num, "*");
-#endif
+# ifdef PERL_GIT_UNCOMMITTED_CHANGES
+ SV *num = newSVpvs(PERL_PATCHNUM "*");
+# else
+ SV *num = newSVpvs(PERL_PATCHNUM);
+# endif

if (sv_len(num)>=sv_len(level) && strnEQ(SvPV_nolen(num),SvPV_nolen(level),sv_len(level))) {
SvREFCNT_dec(level);
diff --git a/win32/FindExt.pm b/win32/FindExt.pm
index 4038017..9ba18b6 100644
--- a/win32/FindExt.pm
+++ b/win32/FindExt.pm
@@ -10,16 +10,8 @@ my $no = join('|',qw(GDBM_File ODBM_File NDBM_File DB_File
$no = qr/^(?:$no)$/i;

my %ext;
-my $ext;
my %static;

-sub getcwd {
- $_ = `cd`;
- chomp;
- s:\\:/:g ;
- return $ENV{'PWD'} = $_;
-}
-
sub set_static_extensions {
# adjust results of scan_ext, and also save
# statics in case scan_ext hasn't been called yet.
@@ -39,13 +31,9 @@ sub set_static_extensions {

sub scan_ext
{
- my $here = getcwd();
- my $dir = shift;
- chdir($dir) || die "Cannot cd to $dir\n";
- ($ext = getcwd()) =~ s,/,\\,g;
- find_ext('');
- chdir($here) || die "Cannot cd to $here\n";
- my @ext = extensions();
+ my $dir = shift;
+ find_ext("$dir/", '');
+ extensions();
}

sub dynamic_ext
@@ -83,24 +71,29 @@ sub is_static
# NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
sub find_ext
{
- opendir my $dh, '.';
- my @items = grep { !/^\.\.?$/ } readdir $dh;
- closedir $dh;
- for my $xxx (@items) {
- if ($xxx ne "DynaLoader") {
- if (-f "$xxx/$xxx.xs" || -f "$xxx/$xxx.c" ) {
- $ext{"$_[0]$xxx"} = $static{"$_[0]$xxx"} ? 'static' : 'dynamic';
- } elsif (-f "$xxx/Makefile.PL") {
- $ext{"$_[0]$xxx"} = 'nonxs';
- } else {
- if (-d $xxx && @_ < 10) {
- chdir $xxx;
- find_ext("$_[0]$xxx/", @_);
- chdir "..";
- }
+ my $ext_dir = shift;
+ my $prefix = shift;
+ opendir my $dh, "$ext_dir$prefix";
+ while (defined (my $item = readdir $dh)) {
+ next if $item =~ /^\.\.?$/;
+ next if $item eq "DynaLoader";
+ my $this_ext = my $this_ext_dir = "$prefix$item";
+ my $leaf = $item;
+
+ $this_ext =~ s!-!/!g;
+ $leaf =~ s/.*-//;
+
+ if (-f "$ext_dir$this_ext_dir/$leaf.xs" || -f "$ext_dir$this_ext_dir/$leaf.c" ) {
+ $ext{$this_ext} = $static{$this_ext} ? 'static' : 'dynamic';
+ } elsif (-f "$ext_dir$this_ext_dir/Makefile.PL") {
+ $ext{$this_ext} = 'nonxs';
+ } else {
+ # It's not actually an extension. So recurse into it.
+ if (-d "$ext_dir$this_ext_dir" && $prefix =~ tr#/## < 10) {
+ find_ext($ext_dir, "$this_ext_dir/");
}
- $ext{"$_[0]$xxx"} = 'known' if $ext{"$_[0]$xxx"} && $xxx =~ $no;
}
+ $ext{$this_ext} = 'known' if $ext{$this_ext} && $item =~ $no;
}

# Special case: Add in modules that nest beyond the first level.
@@ -109,12 +102,18 @@ sub find_ext
# recursive finding breaks SDBM_File/sdbm).
# A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)

- if (!$_[0] && -d "threads/shared") {
+ if (!$prefix && -d "${ext_dir}threads/shared") {
$ext{"threads/shared"} = 'dynamic';
}
- if (!$_[0] && -d "Hash/Util/FieldHash") {
+ if (!$prefix && -d "${ext_dir}Hash/Util/FieldHash") {
$ext{"Hash/Util/FieldHash"} = 'dynamic';
}
}

1;
+# Local variables:
+# cperl-indent-level: 4
+# indent-tabs-mode: nil
+# End:
+#
+# ex: set ts=8 sts=4 sw=4 et:
diff --git a/win32/FindExt.t b/win32/FindExt.t
new file mode 100644
index 0000000..cb4de81
--- /dev/null
+++ b/win32/FindExt.t
@@ -0,0 +1,42 @@
+#!../miniperl -w
+
+BEGIN {
+ @INC = qw(../win32 ../lib);
+}
+use strict;
+
+use Test::More tests => 10;
+use FindExt;
+use Config;
+
+FindExt::scan_ext('../ext');
+
+# Config.pm and FindExt.pm make different choices about what should be built
+my @config_built;
+my @found_built;
+{
+ foreach my $type (qw(static dynamic nonxs)) {
+ push @found_built, eval "FindExt::${type}_ext()";
+ push @config_built, split ' ', $Config{"${type}_ext"};
+ }
+}
+@config_built = sort @config_built;
+@found_built = sort @found_built;
+
+foreach (['static_ext',
+ [FindExt::static_ext()], $Config{static_ext}],
+ ['nonxs_ext',
+ [FindExt::nonxs_ext()], $Config{nonxs_ext}],
+ ['known_extensions',
+ [FindExt::known_extensions()], $Config{known_extensions}],
+ ['"config" dynamic + static + nonxs',
+ \@config_built, $Config{extensions}],
+ ['"found" dynamic + static + nonxs',
+ \@found_built, join " ", FindExt::extensions()],
+ ) {
+ my ($type, $found, $config) = @$_;
+ my @config = sort split ' ', $config;
+ is (scalar @$found, scalar @config,
+ "We find the same number of $type");
+ is_deeply($found, \@config, "We find the same");
+}
diff --git a/win32/Makefile b/win32/Makefile
index 7fabc2b..bbea30b 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -950,8 +950,8 @@ $(CORE_OBJ) : $(CORE_H)
$(DLL_OBJ) : $(CORE_H)
$(X2P_OBJ) : $(CORE_H)

-perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym ..\pp.sym ..\makedef.pl
- $(MINIPERL) -I..\lib buildext.pl --create-perllibst-h
+perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym ..\pp.sym ..\makedef.pl create_perllibst_h.pl
+ $(MINIPERL) -I..\lib create_perllibst_h.pl
$(MINIPERL) -w ..\makedef.pl PLATFORM=win32 $(OPTIMIZE) $(DEFINES) $(BUILDOPT) \
CCTYPE=$(CCTYPE) > perldll.def

@@ -1061,29 +1061,24 @@ MakePPPort_clean:
-if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\mkppport --clean

#-------------------------------------------------------------------------------
-Extensions: buildext.pl $(PERLDEP) $(CONFIGPM)
+Extensions: ..\make_ext.pl $(PERLDEP) $(CONFIGPM)
$(XCOPY) ..\*.h $(COREDIR)\*.*
- $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --dynamic
- -if exist ext $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --dynamic
+ $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynamic

-Extensions_reonly: buildext.pl $(PERLDEP) $(CONFIGPM)
+Extensions_reonly: ..\make_ext.pl $(PERLDEP) $(CONFIGPM)
$(XCOPY) ..\*.h $(COREDIR)\*.*
- $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --dynamic +re
- -if exist ext $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --dynamic +re
+ $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynamic +re

-Extensions_static : buildext.pl $(PERLDEP) $(CONFIGPM)
+Extensions_static : ..\make_ext.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM)
$(XCOPY) ..\*.h $(COREDIR)\*.*
- $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --static
- -if exist ext $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --static
- $(MINIPERL) -I..\lib buildext.pl --list-static-libs > Extensions_static
+ $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --static
+ $(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static

Extensions_clean:
- -if exist $(MINIPERL) $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) clean
- -if exist $(MINIPERL) if exist ext $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext clean
+ -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --all --target=clean

Extensions_realclean:
- -if exist $(MINIPERL) $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) realclean
- -if exist $(MINIPERL) if exist ext $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext realclean
+ -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --all --target=realclean

#-------------------------------------------------------------------------------

diff --git a/win32/Makefile.ce b/win32/Makefile.ce
index c5bef57..8d74a4b 100644
--- a/win32/Makefile.ce
+++ b/win32/Makefile.ce
@@ -759,12 +759,12 @@ NOT_COMPILE_EXT = $(NOT_COMPILE_EXT) !XS/Typemap
NOT_COMPILE_EXT = $(NOT_COMPILE_EXT) !XS/Typemap
!endif

-Extensions: .\buildext.pl $(PERLDEP) $(CONFIGPM)
- $(HPERL) -I..\lib -I. -MCross=$(CROSS_NAME) .\buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) \
+Extensions: ..\make_ext.pl $(PERLDEP) $(CONFIGPM)
+ $(HPERL) -I..\lib -I. -MCross=$(CROSS_NAME) ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --all \
!POSIX $(NOT_COMPILE_EXT)

Extensions_clean:
- -if exist $(MINIPERL) $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) clean
+ -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --all --target=clean

#----------------------------------------------------------------------------------

@@ -851,8 +851,8 @@ $(DLLDIR)\perllib$(o) : perllib.c .\perlhost.h .\vdir.h .\vmem.h
rem (frustrated) mv perllib.obj $(DLLDIR)
!ENDIF

-perldll.def : $(HPERL) $(CONFIGPM) ..\global.sym ..\pp.sym ..\makedef.pl
- $(HPERL) -MCross -I..\lib buildext.pl --create-perllibst-h
+perldll.def : $(HPERL) $(CONFIGPM) ..\global.sym ..\pp.sym ..\makedef.pl create_perllibst_h.pl
+ $(HPERL) -MCross -I..\lib create_perllibst_h.pl
$(HPERL) -w ..\makedef.pl PLATFORM=wince $(OPTIMIZE) $(DEFINES) $(BUILDOPT) \
CCTYPE=$(CCTYPE) -DPERL_DLL=$(PERLDLL) > perldll.def

diff --git a/win32/buildext.pl b/win32/buildext.pl
deleted file mode 100644
index ea5f57f..0000000
--- a/win32/buildext.pl
+++ /dev/null
@@ -1,161 +0,0 @@
-=head1 NAME
-
-buildext.pl - build extensions
-
-=head1 SYNOPSIS
-
- buildext.pl make [-make_opts] dep directory [target] [--static|--dynamic] +ext2 !ext1
-
-E.g.
-
- buildext.pl nmake -nologo perldll.def ..\ext
-
- buildext.pl nmake -nologo perldll.def ..\ext clean
-
- buildext.pl dmake perldll.def ..\ext
-
- buildext.pl dmake perldll.def ..\ext clean
-
-Will skip building extensions which are marked with an '!' char.
-Mostly because they still not ported to specified platform.
-
-If any extensions are listed with a '+' char then only those
-extensions will be built, but only if they arent countermanded
-by an '!ext' and are appropriate to the type of building being done.
-
-If '--static' specified, only static extensions will be built.
-If '--dynamic' specified, only dynamic extensions will be built.
-
---create-perllibst-h
- creates perllibst.h file for inclusion from perllib.c
---list-static-libs:
- prints libraries for static linking and exits
-
-=cut
-
-use Cwd;
-use FindExt;
-use Config;
-
-# @ARGV with '!' at first position are exclusions
-my %excl = map {$_=>1} map {/^!(.*)$/} @ARGV;
-@ARGV = grep {!/^!/} @ARGV;
-# @ARGV with '+' at first position are inclusions
-my %incl = map {$_=>1} map {/^\+(.*)$/} @ARGV;
-@ARGV = grep {!/^\+/} @ARGV;
-
-# --static/--dynamic
-my %opts = map {$_=>1} map {/^--([\w\-]+)$/} @ARGV;
-@ARGV = grep {!/^--([\w\-]+)$/} @ARGV;
-my ($static,$dynamic) = ((exists $opts{static}?1:0),(exists $opts{dynamic}?1:0));
-if ("$static,$dynamic" eq "0,0") {
- ($static,$dynamic) = (1,1);
-}
-if ($opts{'list-static-libs'} || $opts{'create-perllibst-h'}) {
- my @statics = split /\s+/, $Config{static_ext};
- if ($opts{'create-perllibst-h'}) {
- open my $fh, ">perllibst.h"
- or die "Failed to write to perllibst.h:$!";
- my @statics1 = map {local $_=$_;s/\//__/g;$_} @statics;
- my @statics2 = map {local $_=$_;s/\//::/g;$_} @statics;
- print $fh "/*DO NOT EDIT\n this file is included from perllib.c to init static extensions */\n";
- print $fh "#ifdef STATIC1\n",(map {" \"$_\",\n"} @statics),"#undef STATIC1\n#endif\n";
- print $fh "#ifdef STATIC2\n",(map {" EXTERN_C void boot_$_ (pTHX_ CV* cv);\n"} @statics1),"#undef STATIC2\n#endif\n";
- print $fh "#ifdef STATIC3\n",(map {" newXS(\"$statics2[$_]::bootstrap\", boot_$statics1[$_], file);\n"} 0 .. $#statics),"#undef STATIC3\n#endif\n";
- close $fh;
- } else {
- my %extralibs;
- for (@statics) {
- open my $fh, "<..\\lib\\auto\\$_\\extralibs.ld" or die "can't open <..\\lib\\auto\\$_\\extralibs.ld: $!";
- $extralibs{$_}++ for grep {/\S/} split /\s+/, join '', <$fh>;
- }
- print map {s|/|\\|g;m|([^\\]+)$|;"..\\lib\\auto\\$_\\$1$Config{_a} "} @statics;
- print map {"$_ "} sort keys %extralibs;
- }
- exit(0);
-}
-
-(my $here = getcwd()) =~ s{/}{\\}g;
-my $perl = $^X;
-if ($perl =~ m#^\.\.#) {
- $perl = "$here\\$perl";
-}
-(my $topdir = $perl) =~ s/\\[^\\]+$//;
-# miniperl needs to find perlglob and pl2bat
-$ENV{PATH} = "$topdir;$topdir\\win32\\bin;$ENV{PATH}";
-my $pl2bat = "$topdir\\win32\\bin\\pl2bat";
-unless (-f "$pl2bat.bat") {
- my @args = ($perl, ("$pl2bat.pl") x 2);
- print "@args\n";
- system(@args) unless defined $::Cross::platform;
-}
-my $make = shift;
-$make .= " ".shift while $ARGV[0]=~/^-/;
-my $dep = shift;
-my $dmod = -M $dep;
-my $dir = shift;
-chdir($dir) || die "Cannot cd to $dir\n";
-my $targ = shift;
-(my $ext = getcwd()) =~ s{/}{\\}g;
-my $code;
-FindExt::scan_ext($ext);
-FindExt::set_static_extensions(split ' ', $Config{static_ext}) if $ext ne "ext";
-
-my @ext;
-push @ext, FindExt::static_ext() if $static;
-push @ext, FindExt::dynamic_ext(), FindExt::nonxs_ext() if $dynamic;
-
-
-foreach $dir (sort @ext)
- {
- if (%incl and !exists $incl{$dir}) {
- #warn "Skipping extension $ext\\$dir, not in inclusion list\n";
- next;
- }
- if (exists $excl{$dir}) {
- warn "Skipping extension $ext\\$dir, not ported to current platform";
- next;
- }
- if (chdir("$ext\\$dir"))
- {
- my $mmod = -M 'Makefile';
- if (!(-f 'Makefile') || $mmod > $dmod)
- {
- print "\nRunning Makefile.PL in $dir\n";
- my @perl = ($perl, "-I$here\\..\\lib", 'Makefile.PL',
- 'INSTALLDIRS=perl', 'PERL_CORE=1',
- (FindExt::is_static($dir)
- ? ('LINKTYPE=static') : ()), # if ext is static
- );
- if (defined $::Cross::platform) {
- @perl = (@perl[0,1],"-MCross=$::Cross::platform",@perl[2..$#perl]);
- }
- print join(' ', @perl), "\n";
- $code = system(@perl);
- warn "$code from $dir\'s Makefile.PL" if $code;
- $mmod = -M 'Makefile';
- if ($mmod > $dmod)
- {
- warn "Makefile $mmod > $dmod ($dep)\n";
- }
- }
- if ($targ)
- {
- print "Making $targ in $dir\n$make $targ\n";
- $code = system("$make $targ");
- die "Unsuccessful make($dir): code=$code" if $code!=0;
- }
- else
- {
- print "Making $dir\n$make\n";
- $code = system($make);
- die "Unsuccessful make($dir): code=$code" if $code!=0;
- }
- chdir($here) || die "Cannot cd to $here:$!";
- }
- else
- {
- warn "Cannot cd to $ext\\$dir:$!";
- }
- }
-
diff --git a/win32/create_perllibst_h.pl b/win32/create_perllibst_h.pl
new file mode 100644
index 0000000..37fd3a4
--- /dev/null
+++ b/win32/create_perllibst_h.pl
@@ -0,0 +1,17 @@
+#!perl -w
+use strict;
+
+# creates perllibst.h file for inclusion from perllib.c
+
+use Config;
+
+my @statics = split /\s+/, $Config{static_ext};
+open my $fh, '>', 'perllibst.h' or die "Failed to write to perllibst.h:$!";
+
+my @statics1 = map {local $_=$_;s/\//__/g;$_} @statics;
+my @statics2 = map {local $_=$_;s/\//::/g;$_} @statics;
+print $fh "/*DO NOT EDIT\n this file is included from perllib.c to init static extensions */\n";
+print $fh "#ifdef STATIC1\n",(map {" \"$_\",\n"} @statics),"#undef STATIC1\n#endif\n";
+print $fh "#ifdef STATIC2\n",(map {" EXTERN_C void boot_$_ (pTHX_ CV* cv);\n"} @statics1),"#undef STATIC2\n#endif\n";
+print $fh "#ifdef STATIC3\n",(map {" newXS(\"$statics2[$_]::bootstrap\", boot_$statics1[$_], file);\n"} 0 .. $#statics),"#undef STATIC3\n#endif\n";
+close $fh;
diff --git a/win32/list_static_libs.pl b/win32/list_static_libs.pl
new file mode 100644
index 0000000..4b63d90
--- /dev/null
+++ b/win32/list_static_libs.pl
@@ -0,0 +1,17 @@
+#!perl -w
+use strict;
+
+# prints libraries for static linking and exits
+
+use Config;
+
+my @statics = split /\s+/, $Config{static_ext};
+
+my %extralibs;
+for (@statics) {
+ my $file = "..\\lib\\auto\\$_\\extralibs.ld";
+ open my $fh, '<', $file or die "can't open $file for reading: $!";
+ $extralibs{$_}++ for grep {/\S/} split /\s+/, join '', <$fh>;
+}
+print map {s|/|\\|g;m|([^\\]+)$|;"..\\lib\\auto\\$_\\$1$Config{_a} "} @statics;
+print map {"$_ "} sort keys %extralibs;
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 2199c61..1c56617 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -1210,8 +1210,8 @@ $(DLL_OBJ) : $(CORE_H)

$(X2P_OBJ) : $(CORE_H)

-perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym ..\pp.sym ..\makedef.pl
- $(MINIPERL) -I..\lib buildext.pl --create-perllibst-h
+perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym ..\pp.sym ..\makedef.pl create_perllibst_h.pl
+ $(MINIPERL) -I..\lib create_perllibst_h.pl
$(MINIPERL) -w ..\makedef.pl PLATFORM=win32 $(OPTIMIZE) $(DEFINES) \
$(BUILDOPT) CCTYPE=$(CCTYPE) > perldll.def

@@ -1387,29 +1387,24 @@ MakePPPort_clean:
-if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\mkppport --clean

#-------------------------------------------------------------------------------
-Extensions : buildext.pl $(PERLDEP) $(CONFIGPM)
+Extensions : ..\make_ext.pl $(PERLDEP) $(CONFIGPM)
$(XCOPY) ..\*.h $(COREDIR)\*.*
- $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --dynamic
- -if exist ext $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --dynamic
+ $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynamic

-Extensions_reonly : buildext.pl $(PERLDEP) $(CONFIGPM)
+Extensions_reonly : ..\make_ext.pl $(PERLDEP) $(CONFIGPM)
$(XCOPY) ..\*.h $(COREDIR)\*.*
- $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --dynamic +re
- -if exist ext $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --dynamic +re
+ $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynamic +re

-Extensions_static : buildext.pl $(PERLDEP) $(CONFIGPM)
+Extensions_static : ..\make_ext.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM)
$(XCOPY) ..\*.h $(COREDIR)\*.*
- $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --static
- -if exist ext $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --static
- $(MINIPERL) -I..\lib buildext.pl --list-static-libs > Extensions_static
+ $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --static
+ $(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static

Extensions_clean :
- -if exist $(MINIPERL) $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) clean
- -if exist $(MINIPERL) if exist ext $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext clean
+ -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --all --target=clean

Extensions_realclean :
- -if exist $(MINIPERL) $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) realclean
- -if exist $(MINIPERL) if exist ext $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext realclean
+ -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --all --target=realclean

#-------------------------------------------------------------------------------


--
Perl5 Master Repository
Nicholas Clark
2009-04-12 23:22:53 UTC
Permalink
Post by David Mitchell
Cross/Makefile-cross-SH | 29 +++--
MANIFEST | 7 +-
Makefile.SH | 32 ++---
ext/util/make_ext.pl | 226 -----------------------------------
ext/util/make_ext_cross | 147 -----------------------
make_ext.pl | 275 +++++++++++++++++++++++++++++++++++++++++++
perl.c | 9 +-
win32/FindExt.pm | 65 +++++-----
win32/FindExt.t | 42 +++++++
win32/Makefile | 27 ++---
win32/Makefile.ce | 10 +-
win32/buildext.pl | 161 -------------------------
win32/create_perllibst_h.pl | 17 +++
win32/list_static_libs.pl | 17 +++
win32/makefile.mk | 27 ++---
15 files changed, 450 insertions(+), 641 deletions(-)
^^^ ^^^ Net win. :-)

Nicholas Clark

Loading...