summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhypnotoad <yoda@etoyoc.com>2017-11-11 09:18:09 (GMT)
committerhypnotoad <yoda@etoyoc.com>2017-11-11 09:18:09 (GMT)
commit932afb01058a92816df27ea786c0a5c0cbd09290 (patch)
tree6b7a1ec1fe847b056ae344875a94dd9fa1822c4f
parentb2722c42b1a43b10ba1047b6be28d5b4663732b8 (diff)
downloadtcl-932afb01058a92816df27ea786c0a5c0cbd09290.zip
tcl-932afb01058a92816df27ea786c0a5c0cbd09290.tar.gz
tcl-932afb01058a92816df27ea786c0a5c0cbd09290.tar.bz2
Improvements to tip430 to embed the /library file system within a shared library
or as a zip archive with a canonical name matching the current patch level This new version also builds a native executable version of minizip to allow archive to be built within make, even when cross compiling Added a new function TclZipfs_AppHook which implements tip430 core behavior startups to stock tclsh Embedding the file system as a zip archive can be defeated with --enable-zipfs=no
-rw-r--r--generic/tcl.decls4
-rw-r--r--generic/tclDecls.h5
-rw-r--r--generic/tclInterp.c2
-rw-r--r--generic/tclPkgConfig.c2
-rw-r--r--generic/tclStubInit.c1
-rw-r--r--generic/tclZipfs.c73
-rw-r--r--unix/Makefile.in152
-rwxr-xr-xunix/configure178
-rw-r--r--unix/configure.ac61
-rw-r--r--unix/tcl.m4107
-rw-r--r--unix/tclAppInit.c2
-rw-r--r--unix/tclConfig.sh.in3
12 files changed, 582 insertions, 8 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls
index c19bf68..fcc6235 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -2343,7 +2343,9 @@ declare 632 {
declare 633 {
int TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname)
}
-
+declare 634 {
+ int TclZipfs_AppHook(int *argc, char ***argv)
+}
##############################################################################
# Define the platform specific public Tcl interface. These functions are only
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 24a22c3..c7cac7c 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -1838,6 +1838,8 @@ EXTERN int TclZipfs_Mount(Tcl_Interp *interp,
/* 633 */
EXTERN int TclZipfs_Unmount(Tcl_Interp *interp,
const char *zipname);
+/* 634 */
+EXTERN int TclZipfs_AppHook(int *argc, char ***argv);
typedef struct {
const struct TclPlatStubs *tclPlatStubs;
@@ -2507,6 +2509,7 @@ typedef struct TclStubs {
Tcl_Channel (*tcl_OpenTcpServerEx) (Tcl_Interp *interp, const char *service, const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 631 */
int (*tclZipfs_Mount) (Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd); /* 632 */
int (*tclZipfs_Unmount) (Tcl_Interp *interp, const char *zipname); /* 633 */
+ int (*tclZipfs_AppHook) (int *argc, char ***argv); /* 634 */
} TclStubs;
extern const TclStubs *tclStubsPtr;
@@ -3805,6 +3808,8 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tclZipfs_Mount) /* 632 */
#define TclZipfs_Unmount \
(tclStubsPtr->tclZipfs_Unmount) /* 633 */
+#define TclZipfs_AppHook \
+ (tclStubsPtr->tclZipfs_AppHook) /* 634 */
#endif /* defined(USE_TCL_STUBS) */
diff --git a/generic/tclInterp.c b/generic/tclInterp.c
index d9dfd37..2b0582a 100644
--- a/generic/tclInterp.c
+++ b/generic/tclInterp.c
@@ -402,6 +402,8 @@ Tcl_Init(
" set scripts {{set tcl_library}}\n"
" } else {\n"
" set scripts {}\n"
+" lappend scripts {set temp zipfs:/lib/tcl/tcl_library}\n"
+" lappend scripts {set temp zipfs:/app/tcl_library}\n"
" if {[info exists env(TCL_LIBRARY)] && ($env(TCL_LIBRARY) ne {})} {\n"
" lappend scripts {set env(TCL_LIBRARY)}\n"
" lappend scripts {\n"
diff --git a/generic/tclPkgConfig.c b/generic/tclPkgConfig.c
index 466d535..53b7dbb 100644
--- a/generic/tclPkgConfig.c
+++ b/generic/tclPkgConfig.c
@@ -105,6 +105,8 @@ static Tcl_Config const cfg[] = {
{"scriptdir,runtime", CFG_RUNTIME_SCRDIR},
{"includedir,runtime", CFG_RUNTIME_INCDIR},
{"docdir,runtime", CFG_RUNTIME_DOCDIR},
+ {"dllfile,runtime", CFG_RUNTIME_DLLFILE},
+ {"zipfile,runtime", CFG_RUNTIME_ZIPFILE},
/* Installation paths to various stuff */
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index f251a57..16d5837 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -1538,6 +1538,7 @@ const TclStubs tclStubs = {
Tcl_OpenTcpServerEx, /* 631 */
TclZipfs_Mount, /* 632 */
TclZipfs_Unmount, /* 633 */
+ TclZipfs_AppHook, /* 634 */
};
/* !END!: Do not edit above this line. */
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c
index fe4553e..9dfca7a 100644
--- a/generic/tclZipfs.c
+++ b/generic/tclZipfs.c
@@ -28,7 +28,10 @@
#include "zlib.h"
#include "crypt.h"
-#define ZIPFS_VOLUME "zipfs:/"
+#define ZIPFS_VOLUME "zipfs:/"
+#define ZIPFS_APP_MOUNT "zipfs:/app"
+#define ZIPFS_ZIP_MOUNT "zipfs:/lib/tcl"
+
#define ZIPFS_VOLUME_LEN 7
/*
@@ -3807,7 +3810,7 @@ const Tcl_Filesystem zipfsFilesystem = {
*-------------------------------------------------------------------------
*/
-int
+MODULE_SCOPE int
TclZipfs_Init(Tcl_Interp *interp)
{
#ifdef HAVE_ZLIB
@@ -3877,6 +3880,72 @@ TclZipfs_Init(Tcl_Interp *interp)
return TCL_ERROR;
#endif
}
+
+static int TclZipfs_AppHook_FindTclInit(const char *archive){
+ Tcl_Obj *vfsinitscript;
+ int found;
+ if(TclZipfs_Mount(NULL, archive, ZIPFS_ZIP_MOUNT, NULL)) {
+ /* Either the file doesn't exist or it is not a zip archive */
+ return TCL_ERROR;
+ }
+ vfsinitscript=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT "/init.tcl",-1);
+ Tcl_IncrRefCount(vfsinitscript);
+ found=Tcl_FSAccess(vfsinitscript,F_OK);
+ if(found==0) {
+ return TCL_OK;
+ }
+ Tcl_DecrRefCount(vfsinitscript);
+ vfsinitscript=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT "/tcl_library/init.tcl",-1);
+ Tcl_IncrRefCount(vfsinitscript);
+ found=Tcl_FSAccess(vfsinitscript,F_OK);
+ if(found==0) {
+ return TCL_OK;
+ }
+ return TCL_ERROR;
+}
+
+int TclZipfs_AppHook(int *argc, char ***argv){
+ /*
+ * Tclkit_MainHook --
+ * Performs the argument munging for the shell
+ */
+
+ CONST char *archive;
+ Tcl_FindExecutable(*argv[0]);
+ archive=Tcl_GetNameOfExecutable();
+ TclZipfs_Init(NULL);
+ if(!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) {
+ int found;
+ Tcl_Obj *vfsinitscript;
+ vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/main.tcl",-1);
+ Tcl_IncrRefCount(vfsinitscript);
+ if(Tcl_FSAccess(vfsinitscript,F_OK)==0) {
+ /* Startup script should be set before calling Tcl_AppInit */
+ Tcl_SetStartupScript(vfsinitscript,NULL);
+ } else {
+ Tcl_DecrRefCount(vfsinitscript);
+ }
+ /* Set Tcl Encodings */
+ vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/tcl_library/init.tcl",-1);
+ Tcl_IncrRefCount(vfsinitscript);
+ found=Tcl_FSAccess(vfsinitscript,F_OK);
+ Tcl_DecrRefCount(vfsinitscript);
+ if(found==TCL_OK) {
+ return TCL_OK;
+ }
+ }
+ /* Mount zip file and dll before releasing to search */
+ if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_ZIPFILE)==TCL_OK) {
+ return TCL_OK;
+ }
+ if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) {
+ return TCL_OK;
+ }
+ if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_DLLFILE)==TCL_OK) {
+ return TCL_OK;
+ }
+ return TCL_OK;
+}
#ifndef HAVE_ZLIB
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 5f4e125..d7cc3c7 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -199,6 +199,10 @@ LD_SEARCH_FLAGS = @LD_SEARCH_FLAGS@
BUILD_DLTEST = @BUILD_DLTEST@
#BUILD_DLTEST =
+TCL_ZIP_FILE = @TCL_ZIP_FILE@
+TCL_VFS_PATH = libtcl.vfs/tcl_library
+TCL_VFS_ROOT = libtcl.vfs
+
TCL_LIB_FILE = @TCL_LIB_FILE@
#TCL_LIB_FILE = libtcl.a
@@ -242,6 +246,14 @@ ZLIB_DIR = ${COMPAT_DIR}/zlib
ZLIB_INCLUDE = @ZLIB_INCLUDE@
CC = @CC@
+OBJEXT = @OBJEXT@
+HOST_CC = @CC_FOR_BUILD@
+HOST_EXEEXT = @EXEEXT_FOR_BUILD@
+HOST_OBJEXT = @OBJEXT_FOR_BUILD@
+ZIPFS_BUILD = @ZIPFS_BUILD@
+NATIVE_ZIP = @ZIP_PROG@
+SHARED_BUILD = @SHARED_BUILD@
+
#CC = purify -best-effort @CC@ -DPURIFY
# Flags to be passed to installManPage to control how the manpages should be
@@ -251,6 +263,10 @@ MAN_FLAGS = @MAN_FLAGS@
# If non-empty, install the timezone files that are included with Tcl,
# otherwise use the ones that ship with the OS.
INSTALL_TZDATA = @INSTALL_TZDATA@
+INSTALL_LIBRARIES = @INSTALL_LIBRARIES@
+INSTALL_MSGS = @INSTALL_MSGS@
+
+
#--------------------------------------------------------------------------
# The information below is usually usable as is. The configure script won't
@@ -617,6 +633,26 @@ ZLIB_SRCS = \
SRCS = $(GENERIC_SRCS) $(TOMMATH_SRCS) $(UNIX_SRCS) $(NOTIFY_SRCS) \
$(OO_SRCS) $(STUB_SRCS) @PLAT_SRCS@ @ZLIB_SRCS@
+# Minizip
+MINIZIP_OBJS = \
+ adler32.$(HOST_OBJEXT) \
+ compress.$(HOST_OBJEXT) \
+ crc32.$(HOST_OBJEXT) \
+ deflate.$(HOST_OBJEXT) \
+ infback.$(HOST_OBJEXT) \
+ inffast.$(HOST_OBJEXT) \
+ inflate.$(HOST_OBJEXT) \
+ inftrees.$(HOST_OBJEXT) \
+ ioapi.$(HOST_OBJEXT) \
+ trees.$(HOST_OBJEXT) \
+ uncompr.$(HOST_OBJEXT) \
+ zip.$(HOST_OBJEXT) \
+ zutil.$(HOST_OBJEXT) \
+ minizip.$(HOST_OBJEXT)
+
+ZIP_INSTALL_OBJS = minizip${EXEEXT_FOR_BUILD}
+
+
#--------------------------------------------------------------------------
# Start of rules
#--------------------------------------------------------------------------
@@ -629,11 +665,23 @@ libraries:
doc:
+tclzipfile: ${TCL_ZIP_FILE}
+
+
+${TCL_ZIP_FILE}: ${ZIP_INSTALL_OBJS}
+ rm -rf ${TCL_VFS_ROOT}
+ mkdir -p ${TCL_VFS_PATH}
+ cp -a ../library/* ${TCL_VFS_PATH}
+ cd ${TCL_VFS_ROOT} ; ../minizip${EXEEXT_FOR_BUILD} -o ../${TCL_ZIP_FILE} `find . -type f`
+
# The following target is configured by autoconf to generate either a shared
# library or non-shared library for Tcl.
-${LIB_FILE}: ${STUB_LIB_FILE} ${OBJS}
+${LIB_FILE}: ${STUB_LIB_FILE} ${OBJS} ${TCL_ZIP_FILE}
rm -f $@
@MAKE_LIB@
+ifeq (${ZIPFS_BUILD},1)
+ cat ${TCL_ZIP_FILE} >> ${LIB_FILE}
+endif
${STUB_LIB_FILE}: ${STUB_LIB_OBJS}
@if test "x${LIB_FILE}" = "xlibtcl${MAJOR_VERSION}.${MINOR_VERSION}.dll"; then \
@@ -667,7 +715,8 @@ Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in
clean: clean-packages
rm -rf *.a *.o libtcl* core errs *~ \#* TAGS *.E a.out \
- errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl @DTRACE_HDR@
+ errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl @DTRACE_HDR@ \
+ minizip${EXEEXT_FOR_BUILD} *.${HOST_OBJEXT}
cd dltest ; $(MAKE) clean
distclean: distclean-packages clean
@@ -777,7 +826,7 @@ trace-test: ${TCLTEST_EXE}
# Installation rules
#--------------------------------------------------------------------------
-INSTALL_BASE_TARGETS = install-binaries install-libraries install-msgs $(INSTALL_TZDATA)
+INSTALL_BASE_TARGETS = install-binaries $(INSTALL_LIBRARIES) $(INSTALL_MSGS) $(INSTALL_TZDATA)
INSTALL_DOC_TARGETS = install-doc
INSTALL_PACKAGE_TARGETS = install-packages
INSTALL_DEV_TARGETS = install-headers
@@ -821,6 +870,25 @@ install-binaries: binaries
@$(INSTALL_DATA_DIR) $(LIB_INSTALL_DIR)/pkgconfig
@$(INSTALL_DATA) tcl.pc $(LIB_INSTALL_DIR)/pkgconfig/tcl.pc
+install-libraries-zipfs-shared: libraries
+ @for i in "$(SCRIPT_INSTALL_DIR)"; \
+ do \
+ if [ ! -d "$$i" ] ; then \
+ echo "Making directory $$i"; \
+ $(INSTALL_DATA_DIR) "$$i"; \
+ else true; \
+ fi; \
+ done;
+ @echo "Installing library files to $(SCRIPT_INSTALL_DIR)/";
+ @for i in \
+ $(UNIX_DIR)/tclAppInit.c @LDAIX_SRC@ @DTRACE_SRC@; \
+ do \
+ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"; \
+ done;
+
+install-libraries-zipfs-static: install-libraries-zipfs-shared
+ $(INSTALL_DATA) ${TCL_ZIP_FILE} "$(LIB_INSTALL_DIR)" ;\
+
install-libraries: libraries
@for i in "$(SCRIPT_INSTALL_DIR)"; \
do \
@@ -875,6 +943,7 @@ install-libraries: libraries
echo "if {![interp issafe]} { ::tcl::tm::roots {$(TCL_MODULE_PATH)} }" >> \
"$(SCRIPT_INSTALL_DIR)"/tm.tcl; \
fi
+ end
install-tzdata:
@for i in tzdata; \
@@ -1282,6 +1351,8 @@ tclPkgConfig.o: $(GENERIC_DIR)/tclPkgConfig.c
-DCFG_RUNTIME_SCRDIR="\"$(TCL_LIBRARY)\"" \
-DCFG_RUNTIME_INCDIR="\"$(includedir)\"" \
-DCFG_RUNTIME_DOCDIR="\"$(mandir)\"" \
+ -DCFG_RUNTIME_DLLFILE="\"$(TCL_LIB_FILE)\"" \
+ -DCFG_RUNTIME_ZIPFILE="\"$(TCL_ZIP_FILE)\"" \
\
$(GENERIC_DIR)/tclPkgConfig.c
@@ -1331,7 +1402,11 @@ tclZlib.o: $(GENERIC_DIR)/tclZlib.c
$(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) $(GENERIC_DIR)/tclZlib.c
tclZipfs.o: $(GENERIC_DIR)/tclZipfs.c
- $(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) -I$(ZLIB_DIR)/contrib/minizip $(GENERIC_DIR)/tclZipfs.c
+ $(CC) -c $(CC_SWITCHES) \
+ -DCFG_RUNTIME_DLLFILE="\"$(TCL_LIB_FILE)\"" \
+ -DCFG_RUNTIME_ZIPFILE="\"$(TCL_ZIP_FILE)\"" \
+ -DCFG_RUNTIME_PATH="\"$(DLL_INSTALL_DIR)\"" \
+ $(ZLIB_INCLUDE) -I$(ZLIB_DIR)/contrib/minizip $(GENERIC_DIR)/tclZipfs.c
tclTest.o: $(GENERIC_DIR)/tclTest.c $(IOHDR) $(TCLREHDRS)
$(CC) -c $(APP_CC_SWITCHES) $(GENERIC_DIR)/tclTest.c
@@ -1741,6 +1816,74 @@ tclOOStubLib.o: $(GENERIC_DIR)/tclOOStubLib.c
$(CC) -c $(CC_SWITCHES) $<
#--------------------------------------------------------------------------
+# Minizip implementation
+#--------------------------------------------------------------------------
+adler32.$(HOST_OBJEXT):
+ $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/adler32.c
+
+compress.$(HOST_OBJEXT):
+ $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/compress.c
+
+crc32.$(HOST_OBJEXT):
+ $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/crc32.c
+
+deflate.$(HOST_OBJEXT):
+ $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/deflate.c
+
+ioapi.$(HOST_OBJEXT):
+ $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/ioapi.c
+
+infback.$(HOST_OBJEXT):
+ $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/infback.c
+
+inffast.$(HOST_OBJEXT):
+ $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/inffast.c
+
+inflate.$(HOST_OBJEXT):
+ $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/inflate.c
+
+inftrees.$(HOST_OBJEXT):
+ $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/inftrees.c
+
+trees.$(HOST_OBJEXT):
+ $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/trees.c
+
+uncompr.$(HOST_OBJEXT):
+ $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/uncompr.c
+
+zip.$(HOST_OBJEXT):
+ $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/zip.c
+
+zutil.$(HOST_OBJEXT):
+ $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/zutil.c
+
+minizip.$(HOST_OBJEXT):
+ $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/minizip.c
+
+minizip${EXEEXT_FOR_BUILD}: $(MINIZIP_OBJS)
+ $(HOST_CC) -o $@ $(MINIZIP_OBJS)
+
+tclvfs.zip: minizip${EXEEXT_FOR_BUILD}
+ rm -rf $(TCL_VFS_ROOT)
+ mkdir -p $(TCL_VFS_PATH)
+ @for i in "$(TCL_VFS_PATH)"; \
+ do \
+ if [ ! -d "$$i" ] ; then \
+ echo "Making directory $$i"; \
+ $(INSTALL_DATA_DIR) "$$i"; \
+ else true; \
+ fi; \
+ done;
+ cp -a ../library/* $(TCL_VFS_PATH)
+ (cd $TCL_VFS ROOT ; ./minizip${EXEEXT_FOR_BUILD} -o ../tclvfs.zip `find . -type f`)
+
+zipsetupstub.$(HOST_OBJEXT): $(COMPAT_DIR)/zipsetupstub.c
+ $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(COMPAT_DIR)/zipsetupstub.c
+
+zipsetupstub${EXEEXT_FOR_BUILD}: zipsetupstub.$(HOST_OBJEXT)
+ $(HOST_CC) -o $@ zipsetupstub.$(HOST_OBJEXT)
+
+#--------------------------------------------------------------------------
# Bundled Package targets
#--------------------------------------------------------------------------
@@ -2148,6 +2291,7 @@ BUILD_HTML = \
.PHONY: install-tzdata install-msgs
.PHONY: packages configure-packages test-packages clean-packages
.PHONY: dist-packages distclean-packages install-packages
+.PHONY: iinstall-libraries-zipfs-shared install-libraries-zipfs-static tclzipfile
#--------------------------------------------------------------------------
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/unix/configure b/unix/configure
index 129c283..8e2ec0f 100755
--- a/unix/configure
+++ b/unix/configure
@@ -658,12 +658,16 @@ TCL_STUB_LIB_FILE
TCL_LIB_SPEC
TCL_LIB_FLAG
TCL_LIB_FILE
+TCL_ZIP_FILE
PKG_CFG_ARGS
TCL_YEAR
TCL_PATCH_LEVEL
TCL_MINOR_VERSION
TCL_MAJOR_VERSION
TCL_VERSION
+INSTALL_MSGS
+INSTALL_LIBRARIES
+ZIPFS_BUILD
DTRACE
LDFLAGS_DEFAULT
CFLAGS_DEFAULT
@@ -698,7 +702,11 @@ RANLIB
ZLIB_INCLUDE
ZLIB_SRCS
ZLIB_OBJS
+EXEEXT_FOR_BUILD
+CC_FOR_BUILD
+ZIP_PROG
TCLSH_PROG
+SHARED_BUILD
TCL_THREADS
EGREP
GREP
@@ -748,7 +756,8 @@ PACKAGE_VERSION
PACKAGE_TARNAME
PACKAGE_NAME
PATH_SEPARATOR
-SHELL'
+SHELL
+OBJEXT_FOR_BUILD'
ac_subst_files=''
ac_user_opts='
enable_option_checking
@@ -768,6 +777,7 @@ enable_langinfo
enable_dll_unloading
with_tzdata
enable_dtrace
+enable_zipfs
enable_framework
'
ac_precious_vars='build_alias
@@ -1408,6 +1418,7 @@ Optional Features:
startup, otherwise use old heuristic (default: on)
--enable-dll-unloading enable the 'unload' command (default: on)
--enable-dtrace build with DTrace support (default: off)
+ --enable-zipfs build with Zipfs support (default: on)
--enable-framework package shared libraries in MacOSX frameworks
(default: off)
@@ -2330,6 +2341,7 @@ VERSION=${TCL_VERSION}
EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"}
EXTRA_BUILD_HTML=${EXTRA_BUILD_HTML:-"@:"}
+TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip
#------------------------------------------------------------------------
# Setup configure arguments for bundled packages
@@ -3273,6 +3285,7 @@ _ACEOF
esac
+
#--------------------------------------------------------------------
# Supply substitutes for missing POSIX header files. Special notes:
# - stdlib.h doesn't define strtol, strtoul, or
@@ -4545,6 +4558,7 @@ $as_echo "#define STATIC_BUILD 1" >>confdefs.h
fi
+
#--------------------------------------------------------------------
# Look for a native installed tclsh binary (if available)
# If one cannot be found then use the binary we build (fails for
@@ -4590,6 +4604,120 @@ if test "$TCLSH_PROG" = ""; then
TCLSH_PROG='./${TCL_EXE}'
fi
+#
+# Check for --enable-zipfs flag
+#
+SC_ENABLE_ZIPFS
+
+#
+# Find a native zip implementation
+#
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zip" >&5
+$as_echo_n "checking for zip... " >&6; }
+ if ${ac_cv_path_zip+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/zip 2> /dev/null` \
+ `ls -r $dir/zip 2> /dev/null` ; do
+ if test x"$ac_cv_path_zip" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_zip=$j
+ break
+ fi
+ fi
+ done
+ done
+
+fi
+
+
+ if test -f "$ac_cv_path_zip" ; then
+ ZIP_PROG="$ac_cv_path_zip"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5
+$as_echo "$ZIP_PROG" >&6; }
+ else
+ # It is not an error if an installed version of Zip can't be located.
+ ZIP_PROG=""
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH" >&5
+$as_echo "No zip found on PATH" >&6; }
+ fi
+
+
+
+#
+# Find a native compiler
+#
+# Put a plausible default for CC_FOR_BUILD in Makefile.
+if test -z "$CC_FOR_BUILD"; then
+ if test "x$cross_compiling" = "xno"; then
+ CC_FOR_BUILD='$(CC)'
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc" >&5
+$as_echo_n "checking for gcc... " >&6; }
+ if ${ac_cv_path_cc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/gcc 2> /dev/null` \
+ `ls -r $dir/gcc 2> /dev/null` ; do
+ if test x"$ac_cv_path_cc" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_cc=$j
+ break
+ fi
+ fi
+ done
+ done
+
+fi
+
+ fi
+fi
+
+# Also set EXEEXT_FOR_BUILD.
+if test "x$cross_compiling" = "xno"; then
+ EXEEXT_FOR_BUILD='$(EXEEXT)'
+ OBJEXT_FOR_BUILD='$(OBJEXT)'
+else
+ OBJEXT_FOR_BUILD='.no'
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for build system executable suffix" >&5
+$as_echo_n "checking for build system executable suffix... " >&6; }
+if ${bfd_cv_build_exeext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.c
+ bfd_cv_build_exeext=
+ ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ rm -f conftest*
+ test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_build_exeext" >&5
+$as_echo "$bfd_cv_build_exeext" >&6; }
+ EXEEXT_FOR_BUILD=""
+ test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
+fi
+
+
+if test "$ZIP_PROG" = ""; then
+ ZIP_PROG='./minizip${EXEEXT_FOR_BUILD}'
+fi
+
+
+
+
#------------------------------------------------------------------------
# Add stuff for zlib
#------------------------------------------------------------------------
@@ -10151,6 +10279,53 @@ fi
$as_echo "$tcl_ok" >&6; }
#--------------------------------------------------------------------
+# Zipfs support
+#--------------------------------------------------------------------
+
+# Check whether --enable-zipfs was given.
+if test "${enable_zipfs+set}" = set; then :
+ enableval=$enable_zipfs; tcl_ok=$enableval
+else
+ tcl_ok=yes
+fi
+
+ if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
+ ZIPFS_BUILD=1
+ else
+ ZIPFS_BUILD=0
+ fi
+ # Do checking message here to not mess up interleaved configure output
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for building with zipfs" >&5
+$as_echo_n "checking for building with zipfs... " >&6; }
+ if test "${ZIPFS_BUILD}" = 1; then
+ if test "${SHARED_BUILD}" = 0; then
+ ZIPFS_BUILD=2;
+
+$as_echo "#define ZIPFS_BUILD 2" >>confdefs.h
+
+ INSTALL_LIBRARIES=install-libraries-zipfs-static
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+
+$as_echo "#define ZIPFS_BUILD 1" >>confdefs.h
+\
+ INSTALL_LIBRARIES=install-libraries-zipfs-shared
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ INSTALL_LIBRARIES=install-libraries
+ INSTALL_MSGS=install-msgs
+ fi
+
+
+
+
+
+#--------------------------------------------------------------------
# The check below checks whether the cpuid instruction is usable.
#--------------------------------------------------------------------
@@ -10436,6 +10611,7 @@ TCL_SHARED_BUILD=${SHARED_BUILD}
+
ac_config_files="$ac_config_files Makefile:../unix/Makefile.in dltest/Makefile:../unix/dltest/Makefile.in tclConfig.sh:../unix/tclConfig.sh.in tcl.pc:../unix/tcl.pc.in"
cat >confcache <<\_ACEOF
diff --git a/unix/configure.ac b/unix/configure.ac
index e14d85e..b2700cf 100644
--- a/unix/configure.ac
+++ b/unix/configure.ac
@@ -30,6 +30,7 @@ VERSION=${TCL_VERSION}
EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"}
EXTRA_BUILD_HTML=${EXTRA_BUILD_HTML:-"@:"}
+TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip
#------------------------------------------------------------------------
# Setup configure arguments for bundled packages
@@ -86,6 +87,7 @@ fi
AC_PROG_CC
AC_C_INLINE
+
#--------------------------------------------------------------------
# Supply substitutes for missing POSIX header files. Special notes:
# - stdlib.h doesn't define strtol, strtoul, or
@@ -153,6 +155,28 @@ if test "$TCLSH_PROG" = ""; then
TCLSH_PROG='./${TCL_EXE}'
fi
+#
+# Check for --enable-zipfs flag
+#
+SC_ENABLE_ZIPFS
+
+#
+# Find a native zip implementation
+#
+SC_PROG_ZIP
+
+#
+# Find a native compiler
+#
+AX_CC_FOR_BUILD
+
+if test "$ZIP_PROG" = ""; then
+ ZIP_PROG='./minizip${EXEEXT_FOR_BUILD}'
+fi
+
+
+
+
#------------------------------------------------------------------------
# Add stuff for zlib
#------------------------------------------------------------------------
@@ -791,6 +815,42 @@ fi
AC_MSG_RESULT([$tcl_ok])
#--------------------------------------------------------------------
+# Zipfs support
+#--------------------------------------------------------------------
+
+AC_ARG_ENABLE(zipfs,
+ AC_HELP_STRING([--enable-zipfs],
+ [build with Zipfs support (default: on)]),
+ [tcl_ok=$enableval], [tcl_ok=yes])
+ if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
+ ZIPFS_BUILD=1
+ else
+ ZIPFS_BUILD=0
+ fi
+ # Do checking message here to not mess up interleaved configure output
+ AC_MSG_CHECKING([for building with zipfs])
+ if test "${ZIPFS_BUILD}" = 1; then
+ if test "${SHARED_BUILD}" = 0; then
+ ZIPFS_BUILD=2;
+ AC_DEFINE(ZIPFS_BUILD, 2, [Are we building with zipfs enabled?])
+ INSTALL_LIBRARIES=install-libraries-zipfs-static
+ AC_MSG_RESULT([yes])
+ else
+ AC_DEFINE(ZIPFS_BUILD, 1, [Are we building with zipfs enabled?])\
+ INSTALL_LIBRARIES=install-libraries-zipfs-shared
+ AC_MSG_RESULT([yes])
+ fi
+ else
+ AC_MSG_RESULT([no])
+ INSTALL_LIBRARIES=install-libraries
+ INSTALL_MSGS=install-msgs
+ fi
+ AC_SUBST(ZIPFS_BUILD)
+ AC_SUBST(INSTALL_LIBRARIES)
+ AC_SUBST(INSTALL_MSGS)
+
+
+#--------------------------------------------------------------------
# The check below checks whether the cpuid instruction is usable.
#--------------------------------------------------------------------
@@ -960,6 +1020,7 @@ AC_SUBST(TCL_PATCH_LEVEL)
AC_SUBST(TCL_YEAR)
AC_SUBST(PKG_CFG_ARGS)
+AC_SUBST(TCL_ZIP_FILE)
AC_SUBST(TCL_LIB_FILE)
AC_SUBST(TCL_LIB_FLAG)
AC_SUBST(TCL_LIB_SPEC)
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 45922e0..132e602 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -276,6 +276,7 @@ AC_DEFUN([SC_PATH_TKCONFIG], [
# TCL_BIN_DIR
# TCL_SRC_DIR
# TCL_LIB_FILE
+# TCL_ZIP_FILE
#------------------------------------------------------------------------
AC_DEFUN([SC_LOAD_TCLCONFIG], [
@@ -289,6 +290,7 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [
fi
# eval is required to do the TCL_DBGX substitution
+ eval "TCL_ZIP_FILE=\"${TCL_ZIP_FILE}\""
eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
@@ -336,6 +338,7 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [
AC_SUBST(TCL_BIN_DIR)
AC_SUBST(TCL_SRC_DIR)
+ AC_SUBST(TCL_ZIP_FILE)
AC_SUBST(TCL_LIB_FILE)
AC_SUBST(TCL_LIB_FLAG)
AC_SUBST(TCL_LIB_SPEC)
@@ -542,6 +545,7 @@ AC_DEFUN([SC_ENABLE_SHARED], [
SHARED_BUILD=0
AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?])
fi
+ AC_SUBST(SHARED_BUILD)
])
#------------------------------------------------------------------------
@@ -3014,6 +3018,109 @@ if test "x$NEED_FAKE_RFC2553" = "x1"; then
AC_CHECK_FUNC(strlcpy)
fi
])
+
+#------------------------------------------------------------------------
+# SC_PROG_ZIP
+# Locate a zip encoder installed on the system path, or none.
+#
+# Arguments:
+# none
+#
+# Results:
+# Substitutes the following vars:
+# ZIP_PROG
+#------------------------------------------------------------------------
+
+AC_DEFUN([SC_PROG_ZIP], [
+ AC_MSG_CHECKING([for zip])
+ AC_CACHE_VAL(ac_cv_path_zip, [
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/zip 2> /dev/null` \
+ `ls -r $dir/zip 2> /dev/null` ; do
+ if test x"$ac_cv_path_zip" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_zip=$j
+ break
+ fi
+ fi
+ done
+ done
+ ])
+
+ if test -f "$ac_cv_path_zip" ; then
+ ZIP_PROG="$ac_cv_path_zip"
+ AC_MSG_RESULT([$ZIP_PROG])
+ else
+ # It is not an error if an installed version of Zip can't be located.
+ ZIP_PROG=""
+ AC_MSG_RESULT([No zip found on PATH])
+ fi
+ AC_SUBST(ZIP_PROG)
+])
+
+#------------------------------------------------------------------------
+# SC_CC_FOR_BUILD
+# For cross compiles, locate a C compiler that can generate native binaries.
+#
+# Arguments:
+# none
+#
+# Results:
+# Substitutes the following vars:
+# CC_FOR_BUILD
+# EXEEXT_FOR_BUILD
+#------------------------------------------------------------------------
+
+dnl Get a default for CC_FOR_BUILD to put into Makefile.
+AC_DEFUN([AX_CC_FOR_BUILD],
+[# Put a plausible default for CC_FOR_BUILD in Makefile.
+if test -z "$CC_FOR_BUILD"; then
+ if test "x$cross_compiling" = "xno"; then
+ CC_FOR_BUILD='$(CC)'
+ else
+ AC_MSG_CHECKING([for gcc])
+ AC_CACHE_VAL(ac_cv_path_cc, [
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/gcc 2> /dev/null` \
+ `ls -r $dir/gcc 2> /dev/null` ; do
+ if test x"$ac_cv_path_cc" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_cc=$j
+ break
+ fi
+ fi
+ done
+ done
+ ])
+ fi
+fi
+AC_SUBST(CC_FOR_BUILD)
+# Also set EXEEXT_FOR_BUILD.
+if test "x$cross_compiling" = "xno"; then
+ EXEEXT_FOR_BUILD='$(EXEEXT)'
+ OBJEXT_FOR_BUILD='$(OBJEXT)'
+else
+ OBJEXT_FOR_BUILD='.no'
+ AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
+ [rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.c
+ bfd_cv_build_exeext=
+ ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ rm -f conftest*
+ test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
+ EXEEXT_FOR_BUILD=""
+ test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
+fi
+AC_SUBST(EXEEXT_FOR_BUILD)])dnl
+AC_SUBST(OBJEXT_FOR_BUILD)])dnl
# Local Variables:
# mode: autoconf
# End:
diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c
index 9bbc88b..3587f35 100644
--- a/unix/tclAppInit.c
+++ b/unix/tclAppInit.c
@@ -79,6 +79,8 @@ main(
#ifdef TCL_LOCAL_MAIN_HOOK
TCL_LOCAL_MAIN_HOOK(&argc, &argv);
+#else
+ TclZipfs_AppHook(&argc, &argv);
#endif
Tcl_Main(argc, argv, TCL_LOCAL_APPINIT);
diff --git a/unix/tclConfig.sh.in b/unix/tclConfig.sh.in
index fdc56b7..3da4afd 100644
--- a/unix/tclConfig.sh.in
+++ b/unix/tclConfig.sh.in
@@ -39,6 +39,9 @@ TCL_SHARED_BUILD=@TCL_SHARED_BUILD@
# The name of the Tcl library (may be either a .a file or a shared library):
TCL_LIB_FILE='@TCL_LIB_FILE@'
+# The name of a zip containing the /library and /encodings (may be either a .zip file or a shared library):
+TCL_ZIP_FILE='@TCL_ZIP_FILE@'
+
# Additional libraries to use when linking Tcl.
TCL_LIBS='@TCL_LIBS@'