From: Nicholas Clark Date: Thu, 17 Sep 2009 10:35:14 +0000 (+0100) Subject: Convert win32 to build DynaLoader with EU::MM in ext/DynaLoader X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=281da5eaa82c5522;p=p5sagit%2Fp5-mst-13.2.git Convert win32 to build DynaLoader with EU::MM in ext/DynaLoader With help from Steve Hay. This converges the win32 build process with the ./Configure-based approach. --- diff --git a/MANIFEST b/MANIFEST index 2b3f3e0..347c600 100644 --- a/MANIFEST +++ b/MANIFEST @@ -855,6 +855,7 @@ ext/DynaLoader/dl_symbian.xs Symbian implementation ext/DynaLoader/dlutils.c Dynamic loader utilities for dl_*.xs files ext/DynaLoader/dl_vmesa.xs VM/ESA implementation ext/DynaLoader/dl_vms.xs VMS implementation +ext/DynaLoader/dl_win32.xs Win32 implementation ext/DynaLoader/DynaLoader_pm.PL Dynamic Loader perl module ext/DynaLoader/hints/aix.pl Hint for DynaLoader for named architecture ext/DynaLoader/hints/gnukfreebsd.pl Hint for DynaLoader for named architecture @@ -4595,7 +4596,6 @@ 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 diff --git a/win32/dl_win32.xs b/ext/DynaLoader/dl_win32.xs similarity index 100% rename from win32/dl_win32.xs rename to ext/DynaLoader/dl_win32.xs diff --git a/make_ext.pl b/make_ext.pl index fa12621..1cb5c1b 100644 --- a/make_ext.pl +++ b/make_ext.pl @@ -33,6 +33,7 @@ my @toolchain = qw(ext/constant/lib ext/Cwd ext/ExtUtils-Command/lib # If '--static' is specified, static extensions will be built. # If '--dynamic' is specified, dynamic extensions will be built. # If '--nonxs' is specified, nonxs extensions will be built. +# If '--dynaloader' is specificied, DynaLoader 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 @@ -84,6 +85,7 @@ foreach (@ARGV) { my $static = $opts{static} || $opts{all}; my $dynamic = $opts{dynamic} || $opts{all}; my $nonxs = $opts{nonxs} || $opts{all}; +my $dynaloader = $opts{dynaloader} || $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) @@ -143,7 +145,7 @@ if ($target eq '') { die "$0: unknown make target '$target'\n"; } -if (!@extspec and !$static and !$dynamic and !$nonxs) { +if (!@extspec and !$static and !$dynamic and !$nonxs and !$dynaloader) { die "$0: no extension specified\n"; } @@ -176,6 +178,7 @@ if ($is_Win32) { push @ext, FindExt::static_ext() if $static; push @ext, FindExt::dynamic_ext() if $dynamic; push @ext, FindExt::nonxs_ext() if $nonxs; + push @ext, 'DynaLoader' if $dynaloader; foreach (sort @ext) { if (%incl and !exists $incl{$_}) { @@ -187,7 +190,10 @@ if ($is_Win32) { next; } push @extspec, $_; - if(FindExt::is_static($_)) { + if($_ eq 'DynaLoader') { + # No, we don't know why nmake can't work out the dependency chain + push @{$extra_passthrough{$_}}, 'DynaLoader.c'; + } elsif(FindExt::is_static($_)) { push @{$extra_passthrough{$_}}, 'LINKTYPE=static'; } } @@ -198,6 +204,7 @@ elsif ($is_VMS) { push @extspec, (split ' ', $Config{static_ext}) if $static; push @extspec, (split ' ', $Config{dynamic_ext}) if $dynamic; push @extspec, (split ' ', $Config{nonxs_ext}) if $nonxs; + push @extspec, 'DynaLoader' if $dynaloader; } { diff --git a/win32/Makefile b/win32/Makefile index d4eb178..fa02e3b 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -713,8 +713,6 @@ WIN32_SRC = $(WIN32_SRC) .\win32io.c WIN32_SRC = $(WIN32_SRC) .\$(CRYPT_SRC) !ENDIF -DLL_SRC = $(DYNALOADER).c - X2P_SRC = \ ..\x2p\a2p.c \ ..\x2p\hash.c \ @@ -775,7 +773,7 @@ MINICORE_OBJ = $(MICROCORE_OBJ:..\=.\mini\) \ $(MINIDIR)\perlio$(o) MINIWIN32_OBJ = $(WIN32_OBJ:.\=.\mini\) MINI_OBJ = $(MINICORE_OBJ) $(MINIWIN32_OBJ) -DLL_OBJ = $(DLL_SRC:.c=.obj) +DLL_OBJ = $(DYNALOADER) X2P_OBJ = $(X2P_SRC:.c=.obj) GENUUDMAP_OBJ = $(GENUUDMAP:.exe=.obj) @@ -801,7 +799,7 @@ STATIC_EXT = * !Win32 !SDBM_File !Encode STATIC_EXT = Win32CORE !ENDIF -DYNALOADER = $(EXTDIR)\DynaLoader\DynaLoader +DYNALOADER = ..\DynaLoader$(o) CFG_VARS = \ "INST_DRV=$(INST_DRV)" \ @@ -856,8 +854,6 @@ reonly : regnodes .\config.h ..\git_version.h $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE) $(X2P) Extensions_reonly @echo Perl and 're' are up to date. -$(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c - static: $(PERLEXESTATIC) #------------------------------------------------------------ @@ -1035,21 +1031,6 @@ $(PERLEXESTATIC): $(PERLSTATICLIB) $(CONFIGPM) $(PERLEXEST_OBJ) $(PERLEXE_RES) $(LIBFILES) $(PERLEXEST_OBJ) $(SETARGV_OBJ) $(PERLEXE_RES) $(EMBED_EXE_MANI) -$(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM) Extensions_nonxs - if not exist $(AUTODIR) mkdir $(AUTODIR) - cd $(EXTDIR)\$(*B) - ..\$(MINIPERL) -I..\..\lib $(*B)_pm.PL - ..\$(MINIPERL) -I..\..\lib XSLoader_pm.PL - cd ..\..\win32 - $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL) - $(XCOPY) $(EXTDIR)\$(*B)\XSLoader.pm $(LIBDIR)\$(NULL) - cd $(EXTDIR)\$(*B) - $(XSUBPP) dl_win32.xs > $(*B).c - cd ..\..\win32 - -$(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs - copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs - MakePPPort: $(MINIPERL) $(CONFIGPM) Extensions_nonxs $(MINIPERL) -I..\lib $(ICWD) ..\mkppport @@ -1057,14 +1038,13 @@ MakePPPort_clean: -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\mkppport --clean #------------------------------------------------------------------------------- -# The rule for $(DYNALOADER).c makes DynaLoader.pm, and that is needed for -# ExtUtils::Mkbootstrap. There's no direct way to mark a dependency on +# There's no direct way to mark a dependency on # DynaLoader.pm, so this will have to do -Extensions: ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER).c +Extensions: ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER) $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynamic -Extensions_reonly: ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER).c +Extensions_reonly: ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER) $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynamic +re @@ -1077,6 +1057,10 @@ Extensions_nonxs: ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --nonxs +$(DYNALOADER) : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs + $(XCOPY) ..\*.h $(COREDIR)\*.* + $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynaloader + Extensions_clean: -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --all --target=clean @@ -1155,10 +1139,6 @@ distclean: realclean $(PERLIMPLIB) ..\miniperl.lib $(MINIMOD) \ $(PERLEXESTATIC) $(PERLSTATICLIB) -del /f *.def *.map - -del /f $(DYNALOADER).c - -del /f $(EXTDIR)\DynaLoader\dl_win32.xs - -del /f $(EXTDIR)\DynaLoader\DynaLoader.pm - -del /f $(EXTDIR)\DynaLoader\XSLoader.pm -del /f $(LIBDIR)\Encode.pm $(LIBDIR)\encoding.pm $(LIBDIR)\Errno.pm -del /f $(LIBDIR)\Config.pod $(LIBDIR)\POSIX.pod $(LIBDIR)\threads.pm -del /f $(LIBDIR)\.exists $(LIBDIR)\attributes.pm $(LIBDIR)\DynaLoader.pm diff --git a/win32/makefile.mk b/win32/makefile.mk index a4dc36a..af0cb3f 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -874,8 +874,6 @@ WIN32_SRC += .\win32io.c WIN32_SRC += .\$(CRYPT_SRC) .ENDIF -DLL_SRC = $(DYNALOADER).c - X2P_SRC = \ ..\x2p\a2p.c \ ..\x2p\hash.c \ @@ -934,7 +932,7 @@ WIN32_OBJ = $(WIN32_SRC:db:+$(o)) MINICORE_OBJ = $(MINIDIR)\{$(MICROCORE_OBJ:f) miniperlmain$(o) perlio$(o)} MINIWIN32_OBJ = $(MINIDIR)\{$(WIN32_OBJ:f)} MINI_OBJ = $(MINICORE_OBJ) $(MINIWIN32_OBJ) -DLL_OBJ = $(DLL_SRC:db:+$(o)) +DLL_OBJ = $(DYNALOADER) X2P_OBJ = $(X2P_SRC:db:+$(o)) GENUUDMAP_OBJ = $(GENUUDMAP:db:+$(o)) @@ -960,7 +958,7 @@ STATIC_EXT = * !Win32 !SDBM_File !Encode STATIC_EXT = Win32CORE .ENDIF -DYNALOADER = $(EXTDIR)\DynaLoader\DynaLoader +DYNALOADER = ..\DynaLoader$(o) # vars must be separated by "\t+~\t+", since we're using the tempfile # version of config_sh.pl (we were overflowing someone's buffer by @@ -1044,8 +1042,6 @@ reonly : regnodes .\config.h ..\git_version.h $(GLOBEXE) $(MINIPERL) $(MK2) \ $(RIGHTMAKE) $(MINIMOD) $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE) \ $(X2P) Extensions_reonly -$(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c - static: $(PERLEXESTATIC) #---------------------------------------------------------------- @@ -1367,18 +1363,6 @@ $(PERLEXESTATIC): $(PERLSTATICLIB) $(CONFIGPM) $(PERLEXEST_OBJ) $(PERLEXE_RES) $(EMBED_EXE_MANI) .ENDIF -$(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM) Extensions_nonxs - if not exist $(AUTODIR) mkdir $(AUTODIR) - cd $(EXTDIR)\$(*B) && ..\$(MINIPERL) -I..\..\lib $(*B)_pm.PL - cd $(EXTDIR)\$(*B) && ..\$(MINIPERL) -I..\..\lib XSLoader_pm.PL - $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL) - $(XCOPY) $(EXTDIR)\$(*B)\XSLoader.pm $(LIBDIR)\$(NULL) - cd $(EXTDIR)\$(*B) && $(XSUBPP) dl_win32.xs > $(*B).c - $(XCOPY) $(EXTDIR)\$(*B)\dlutils.c . - -$(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs - copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs - MakePPPort: $(MINIPERL) $(CONFIGPM) Extensions_nonxs $(MINIPERL) -I..\lib $(ICWD) ..\mkppport @@ -1386,14 +1370,13 @@ MakePPPort_clean: -if exist $(MINIPERL) $(MINIPERL) -I..\lib $(ICWD) ..\mkppport --clean #------------------------------------------------------------------------------- -# The rule for $(DYNALOADER).c makes DynaLoader.pm, and that is needed for -# ExtUtils::Mkbootstrap. There's no direct way to mark a dependency on +# There's no direct way to mark a dependency on # DynaLoader.pm, so this will have to do -Extensions : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER).c +Extensions : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER) $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynamic -Extensions_reonly : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER).c +Extensions_reonly : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER) $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynamic +re @@ -1406,6 +1389,10 @@ Extensions_nonxs : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --nonxs +$(DYNALOADER) : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs + $(XCOPY) ..\*.h $(COREDIR)\*.* + $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynaloader + Extensions_clean : -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --all --target=clean @@ -1480,10 +1467,6 @@ distclean: realclean $(PERLIMPLIB) ..\miniperl$(a) $(MINIMOD) \ $(PERLEXESTATIC) $(PERLSTATICLIB) -del /f *.def *.map - -del /f $(DYNALOADER).c - -del /f $(EXTDIR)\DynaLoader\dl_win32.xs - -del /f $(EXTDIR)\DynaLoader\DynaLoader.pm - -del /f $(EXTDIR)\DynaLoader\XSLoader.pm -del /f $(LIBDIR)\Encode.pm $(LIBDIR)\encoding.pm $(LIBDIR)\Errno.pm -del /f $(LIBDIR)\Config.pod $(LIBDIR)\POSIX.pod $(LIBDIR)\threads.pm -del /f $(LIBDIR)\.exists $(LIBDIR)\attributes.pm $(LIBDIR)\DynaLoader.pm