summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorVadim Konovalov <vkonovalov@lucent.com>2006-11-13 20:45:05 +0100
committerSteve Hay <SteveHay@planit.com>2006-11-15 18:07:44 +0000
commit4e036e4bbba6d063b01c50038bdc634716ef4439 (patch)
tree2671504d6781e575f75eafe62af7bb938cc84dad /win32
parentff66e7137572bbed913f898be5a54a3383bf19d2 (diff)
downloadperl-4e036e4bbba6d063b01c50038bdc634716ef4439.tar.gz
Add support for building a perl-static.exe that doesn't depend on
the perl59.dll. It currently can't load DLL extension modules, so any that are required must be statically linked too. This may be fixed sometime. Changes to win32/makefile.mk also to follow. Subject: RE: [PATCH@29224] RE: [patch-at-29217] static linkage for perl.exe fo r win32 From: "Konovalov, Vadim Vladimirovich (Vadim)** CTR **" <vkonovalov@Lucent.com> Message-ID: <E3FB32585BF1D411B9E900805FF51A080207FA41@ru0022exch001u.ru.lucent.com> (with minor tweaks for cleanup and embedding manifest file) p4raw-id: //depot/perl@29285
Diffstat (limited to 'win32')
-rw-r--r--win32/Makefile54
1 files changed, 48 insertions, 6 deletions
diff --git a/win32/Makefile b/win32/Makefile
index a8d1af14ab..094117c118 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -163,6 +163,15 @@ CRYPT_SRC = fcrypt.c
#DEBUG_MSTATS = define
#
+# set this to additionally provide a statically linked perl-static.exe.
+# Note that dynamic loading will not work with this perl, so you must
+# include required modules statically using STATIC_EXT variable below.
+# A static library perl59s.lib will also be created.
+# Ordinary perl.exe is not affected by this option.
+#
+#BUILD_STATIC = define
+
+#
#
# set the install locations of the compiler include/libraries
# Running VCVARS32.BAT is *required* when using Visual C.
@@ -478,6 +487,7 @@ CFLAGS = $(EXTRACFLAGS) $(INCLUDES) $(DEFINES) $(LOCDEFS) \
LINK_FLAGS = -nologo -nodefaultlib $(LINK_DBG) \
-libpath:"$(INST_COREDIR)" \
-machine:$(PROCESSOR_ARCHITECTURE)
+LIB_FLAGS = -nologo
OBJOUT_FLAG = -Fo
EXEOUT_FLAG = -Fe
@@ -515,16 +525,23 @@ $(o).dll:
# makedef.pl must be updated if this changes, and this should normally
# only change when there is an incompatible revision of the public API.
PERLIMPLIB = ..\perl59.lib
+PERLSTATICLIB = ..\perl59s.lib
PERLDLL = ..\perl59.dll
MINIPERL = ..\miniperl.exe
MINIDIR = .\mini
PERLEXE = ..\perl.exe
WPERLEXE = ..\wperl.exe
+PERLEXESTATIC = ..\perl-static.exe
GLOBEXE = ..\perlglob.exe
CONFIGPM = ..\lib\Config.pm ..\lib\Config_heavy.pl
MINIMOD = ..\lib\ExtUtils\Miniperl.pm
X2P = ..\x2p\a2p.exe
+!IF "$(BUILD_STATIC)" == "define"
+PERLSTATIC = static
+!ELSE
+PERLSTATIC =
+!ENDIF
# Unicode data files generated by mktables
FIRSTUNIFILE = ..\lib\unicore\Canonical.pl
@@ -739,16 +756,16 @@ X2P_OBJ = $(X2P_SRC:.c=.obj)
PERLDLL_OBJ = $(CORE_OBJ)
PERLEXE_OBJ = perlmain$(o)
+PERLEXEST_OBJ = perlmainst$(o)
PERLDLL_OBJ = $(PERLDLL_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
-#PERLEXE_OBJ = $(PERLEXE_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
!IF "$(USE_SETARGV)" != ""
SETARGV_OBJ = setargv$(o)
!ENDIF
# specify static extensions here
-#STATIC_EXT = Cwd Compress/Zlib
+#STATIC_EXT = Cwd Compress/Raw/Zlib
STATIC_EXT =
DYNALOADER = $(EXTDIR)\DynaLoader\DynaLoader
@@ -932,7 +949,7 @@ CFG_VARS = \
#
all : .\config.h $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE) \
- $(X2P) MakePPPort Extensions
+ $(X2P) MakePPPort Extensions $(PERLSTATIC)
@echo Everything is up to date. '$(MAKE_BARE) test' to run test suite.
..\regnodes.h : ..\regcomp.sym
@@ -948,6 +965,8 @@ reonly : regnodes .\config.h $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(UNIDATAFILES) $
$(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
+static: $(PERLEXESTATIC)
+
#------------------------------------------------------------
$(GLOBEXE) : perlglob$(o)
@@ -1036,6 +1055,12 @@ $(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES) Extensions_static
$(EMBED_DLL_MANI)
$(XCOPY) $(PERLIMPLIB) $(COREDIR)
+$(PERLSTATICLIB): Extensions_static
+ $(LIB32) $(LIB_FLAGS) -out:$@ @Extensions_static @<<
+ $(PERLDLL_OBJ)
+<<
+ $(XCOPY) $(PERLSTATICLIB) $(COREDIR)
+
$(PERLEXE_ICO): $(MINIPERL) makeico.pl
$(MINIPERL) makeico.pl > $@
@@ -1075,6 +1100,12 @@ perlmain.c : runperl.c
perlmain$(o) : perlmain.c
$(CC) $(CFLAGS_O) -UPERLDLL $(OBJOUT_FLAG)$@ -c perlmain.c
+perlmainst.c : runperl.c
+ copy runperl.c perlmainst.c
+
+perlmainst$(o) : perlmainst.c
+ $(CC) $(CFLAGS_O) -DPERLDLL $(OBJOUT_FLAG)$@ -c perlmainst.c
+
$(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES)
$(LINK32) -subsystem:console -out:$@ -stack:0x1000000 $(LINK_FLAGS) \
$(LIBFILES) $(PERLEXE_OBJ) $(SETARGV_OBJ) $(PERLIMPLIB) $(PERLEXE_RES)
@@ -1084,6 +1115,12 @@ $(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES)
copy splittree.pl ..
$(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR)
+$(PERLEXESTATIC): $(PERLSTATICLIB) $(CONFIGPM) $(PERLEXEST_OBJ) $(PERLEXE_RES)
+ $(LINK32) -subsystem:console -out:$@ -stack:0x1000000 $(LINK_FLAGS) \
+ @Extensions_static $(PERLSTATICLIB) \
+ $(LIBFILES) $(PERLEXEST_OBJ) $(SETARGV_OBJ) $(PERLEXE_RES)
+ $(EMBED_EXE_MANI)
+
$(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM)
if not exist $(AUTODIR) mkdir $(AUTODIR)
cd $(EXTDIR)\$(*B)
@@ -1116,7 +1153,7 @@ Extensions_reonly: buildext.pl $(PERLDEP) $(CONFIGPM)
$(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --dynamic +re
$(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --dynamic +re
-Extensions_static : buildext.pl
+Extensions_static : MakePPPort buildext.pl
$(XCOPY) ..\*.h $(COREDIR)\*.*
$(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --static
$(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --static
@@ -1197,7 +1234,8 @@ utils: $(PERLEXE) $(X2P)
distclean: realclean
-del /f $(MINIPERL) $(PERLEXE) $(PERLDLL) $(GLOBEXE) \
- $(PERLIMPLIB) ..\miniperl.lib $(MINIMOD)
+ $(PERLIMPLIB) ..\miniperl.lib $(MINIMOD) \
+ $(PERLEXESTATIC) $(PERLSTATICLIB)
-del /f *.def *.map
-del /f $(EXTENSION_DLL)
-del /f $(EXTENSION_C) $(DYNALOADER).c $(ERRNO).pm
@@ -1265,7 +1303,8 @@ distclean: realclean
perldoc perlivp dprofpp libnetcfg enc2xs piconv cpan *.bat \
xsubpp instmodsh prove ptar ptardiff shasum corelist config_data
-cd ..\x2p && del /f find2perl s2p psed *.bat
- -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c config.h.new
+ -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c config.h.new \
+ perlmainst.c
-del /f $(CONFIGPM)
-del /f bin\*.bat
-del /f perllibst.h
@@ -1351,11 +1390,14 @@ _clean :
-@$(DEL) $(MINIPERL)
-@$(DEL) perlglob$(o)
-@$(DEL) perlmain$(o)
+ -@$(DEL) perlmainst$(o)
-@$(DEL) config.w32
-@$(DEL) config.h
-@$(DEL) $(GLOBEXE)
-@$(DEL) $(PERLEXE)
-@$(DEL) $(WPERLEXE)
+ -@$(DEL) $(PERLEXESTATIC)
+ -@$(DEL) $(PERLSTATICLIB)
-@$(DEL) $(PERLDLL)
-@$(DEL) $(CORE_OBJ)
-if exist $(MINIDIR) rmdir /s /q $(MINIDIR)