diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-01-29 16:16:16 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-01-29 16:16:16 (GMT) |
commit | a458d61af6c5586bdf154ca81963aa4aaa40caa3 (patch) | |
tree | b122437b91e71e26217aa84acb11350f9186d773 /win | |
parent | c22482e6b68702c023d6c7ddf0f0935e97edd6f7 (diff) | |
parent | 1ee8159bc5bdcbf5785cab15202d946f861a2fd1 (diff) | |
download | tk-a458d61af6c5586bdf154ca81963aa4aaa40caa3.zip tk-a458d61af6c5586bdf154ca81963aa4aaa40caa3.tar.gz tk-a458d61af6c5586bdf154ca81963aa4aaa40caa3.tar.bz2 |
More progress in TIP #430 for Tk: zip file is now attached to the shared library, cannot be used by Wish yet.
Diffstat (limited to 'win')
-rw-r--r-- | win/Makefile.in | 74 | ||||
-rwxr-xr-x | win/configure | 181 | ||||
-rw-r--r-- | win/configure.ac | 46 |
3 files changed, 300 insertions, 1 deletions
diff --git a/win/Makefile.in b/win/Makefile.in index 07c2bea..a02dbc2 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -129,6 +129,10 @@ EXESUFFIX = @EXESUFFIX@ VER = @TK_MAJOR_VERSION@@TK_MINOR_VERSION@ DOTVER = @TK_MAJOR_VERSION@.@TK_MINOR_VERSION@ +TK_ZIP_FILE = @TK_ZIP_FILE@ +TK_VFS_PATH = libtk.vfs/tk_library +TK_VFS_ROOT = libtk.vfs + TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@ TK_LIB_FILE = @TK_LIB_FILE@ TK_DLL_FILE = @TK_DLL_FILE@ @@ -195,6 +199,7 @@ MKDIR = mkdir -p SHELL = @SHELL@ RM = rm -f COPY = cp +LN = ln BUILD_TCLSH = @BUILD_TCLSH@ @@ -212,6 +217,45 @@ NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED TCL_EXE = @TCLSH_PROG@ WINE = @WINE@ +### +# Tip 430 - ZipFS Modifications +### + +TK_ZIP_FILE = @TK_ZIP_FILE@ +TK_VFS_PATH = libtk.vfs/tk_library +TK_VFS_ROOT = libtk.vfs + +HOST_CC = @CC_FOR_BUILD@ +HOST_EXEEXT = @EXEEXT_FOR_BUILD@ +HOST_OBJEXT = @OBJEXT_FOR_BUILD@ +ZIPFS_BUILD = @ZIPFS_BUILD@ +NATIVE_ZIP = @ZIP_PROG@ +ZIP_PROG_OPTIONS = @ZIP_PROG_OPTIONS@ +ZIP_PROG_VFSSEARCH = @ZIP_PROG_VFSSEARCH@ +SHARED_BUILD = @SHARED_BUILD@ +INSTALL_MSGS = @INSTALL_MSGS@ +INSTALL_LIBRARIES = @INSTALL_LIBRARIES@ + +# 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) \ + iowin32.$(HOST_OBJEXT) \ + trees.$(HOST_OBJEXT) \ + uncompr.$(HOST_OBJEXT) \ + zip.$(HOST_OBJEXT) \ + zutil.$(HOST_OBJEXT) \ + minizip.$(HOST_OBJEXT) + +ZIP_INSTALL_OBJS = @ZIP_INSTALL_OBJS@ + CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \ -I"${GENERIC_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" \ -I"${XLIB_DIR_NATIVE}" -I"${BITMAP_DIR_NATIVE}" \ @@ -638,6 +682,29 @@ cat32.${OBJEXT}: $(TCL_SRC_DIR)/win/cat.c $(CAT32): cat32.${OBJEXT} $(CC) $(CFLAGS) cat32.$(OBJEXT) $(CC_EXENAME) $(LIBS) $(LDFLAGS_CONSOLE) +tkzipfile: ${TK_ZIP_FILE} + +${TK_ZIP_FILE}: ${ZIP_INSTALL_OBJS} + @rm -rf ${TK_VFS_ROOT} + @mkdir -p ${TK_VFS_PATH} + @echo "creating ${TK_VFS_PATH} (prepare compression)" + @( \ + $(LN) $$(find $(TOP_DIR)/library/* -maxdepth 0 -type f) ${TK_VFS_PATH}/ && \ + (for D in $$(find $(TOP_DIR)/library/* -maxdepth 0 -type d); do \ + mkdir -p "${TK_VFS_PATH}/$$(basename $$D)"; \ + $(LN) -s $$D/* ${TK_VFS_PATH}/$$(basename $$D)/; \ + done) \ + ) || ( \ + $(COPY) -a $(TOP_DIR)/library/* ${TK_VFS_PATH}; \ + ) + (zip=`(realpath '${NATIVE_ZIP}' || readlink -m '${NATIVE_ZIP}') 2>/dev/null || \ + (echo '${NATIVE_ZIP}' | sed "s?^\./?$$(pwd)/?")`; \ + cd ${TK_VFS_ROOT} && \ + $$zip ${ZIP_PROG_OPTIONS} ../${TK_ZIP_FILE} ${ZIP_PROG_VFSSEARCH} >/dev/null && \ + echo "${TK_ZIP_FILE} successful created with $$zip" && \ + cd ..) + + # The following targets are configured by autoconf to generate either # a shared library or static library @@ -646,10 +713,15 @@ ${TK_STUB_LIB_FILE}: ${STUB_OBJS} @MAKE_STUB_LIB@ ${STUB_OBJS} @POST_MAKE_LIB@ -${TK_DLL_FILE}: ${TK_OBJS} $(TK_RES) +${TK_DLL_FILE}: ${TK_OBJS} $(TK_RES) ${TK_ZIP_FILE} @$(RM) ${TK_DLL_FILE} @MAKE_DLL@ ${TK_OBJS} $(TK_RES) $(SHLIB_LD_LIBS) @VC_MANIFEST_EMBED_DLL@ + @if test "${ZIPFS_BUILD}" = "1" ; then \ + cat ${TK_ZIP_FILE} >> ${TK_DLL_FILE}; \ + ${NATIVE_ZIP} -A ${TK_DLL_FILE} \ + || echo 'ignore zip-error by adjust sfx process (not executable?)'; \ + fi ${TK_LIB_FILE}: ${TK_OBJS} @$(RM) ${TK_LIB_FILE} diff --git a/win/configure b/win/configure index 8eac969..dcbfede 100755 --- a/win/configure +++ b/win/configure @@ -706,6 +706,16 @@ TK_MAJOR_VERSION TK_VERSION MACHINE TK_WIN_VERSION +INSTALL_MSGS +INSTALL_LIBRARIES +TK_ZIP_FILE +ZIPFS_BUILD +ZIP_INSTALL_OBJS +ZIP_PROG_VFSSEARCH +ZIP_PROG_OPTIONS +ZIP_PROG +EXEEXT_FOR_BUILD +CC_FOR_BUILD TCLSH_PROG BUILD_TCLSH VC_MANIFEST_EMBED_EXE @@ -794,6 +804,7 @@ with_tcl enable_64bit enable_symbols enable_embedded_manifest +enable_zipfs ' ac_precious_vars='build_alias host_alias @@ -1427,6 +1438,7 @@ Optional Features: --enable-symbols build with debugging symbols (default: off) --enable-embedded-manifest embed manifest if possible (default: yes) + --enable-zipfs build with Zipfs support (default: on) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -5577,6 +5589,175 @@ printf "%s\n" "No tclsh found on PATH" >&6; } +#-------------------------------------------------------------------- +# Zipfs support - Tip 430 +#-------------------------------------------------------------------- +# Check whether --enable-zipfs was given. +if test ${enable_zipfs+y} +then : + enableval=$enable_zipfs; tcl_ok=$enableval +else $as_nop + tcl_ok=yes +fi + +if test "$tcl_ok" = "yes" ; then + # + # 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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gcc" >&5 +printf %s "checking for gcc... " >&6; } + if test ${ac_cv_path_cc+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + 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' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for build system executable suffix" >&5 +printf %s "checking for build system executable suffix... " >&6; } +if test ${bfd_cv_build_exeext+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_build_exeext" >&5 +printf "%s\n" "$bfd_cv_build_exeext" >&6; } + EXEEXT_FOR_BUILD="" + test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} +fi + + # + # Find a native zip implementation + # + + ZIP_PROG="" + ZIP_PROG_OPTIONS="" + ZIP_PROG_VFSSEARCH="" + ZIP_INSTALL_OBJS="" + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zip" >&5 +printf %s "checking for zip... " >&6; } + if test ${ac_cv_path_zip+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + 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" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5 +printf "%s\n" "$ZIP_PROG" >&6; } + ZIP_PROG_OPTIONS="-rq" + ZIP_PROG_VFSSEARCH="*" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Found INFO Zip in environment" >&5 +printf "%s\n" "Found INFO Zip in environment" >&6; } + # Use standard arguments for zip + else + # It is not an error if an installed version of Zip can't be located. + # We can use the locally distributed minizip instead + ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}" + ZIP_PROG_OPTIONS="-o -r" + ZIP_PROG_VFSSEARCH="*" + ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH building minizip" >&5 +printf "%s\n" "No zip found on PATH building minizip" >&6; } + fi + + + + + + ZIPFS_BUILD=1 + TK_ZIP_FILE=libtcl_${TK_MAJOR_VERSION}_${TK_MINOR_VERSION}_${TK_PATCH_LEVEL}.zip +else + ZIPFS_BUILD=0 + TCL_ZIP_FILE= +fi +# Do checking message here to not mess up interleaved configure output +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for building with zipfs" >&5 +printf %s "checking for building with zipfs... " >&6; } +if test "${ZIPFS_BUILD}" = 1; then + if test "${SHARED_BUILD}" = 0; then + ZIPFS_BUILD=2; + +printf "%s\n" "#define ZIPFS_BUILD 2" >>confdefs.h + + INSTALL_LIBRARIES=install-libraries-zipfs-static + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + +printf "%s\n" "#define ZIPFS_BUILD 1" >>confdefs.h +\ + INSTALL_LIBRARIES=install-libraries-zipfs-shared + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + fi +else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +INSTALL_LIBRARIES=install-libraries +INSTALL_MSGS=install-msgs +fi + + + + + + #------------------------------------------------------------------------ # tkConfig.sh refers to this by a different name #------------------------------------------------------------------------ diff --git a/win/configure.ac b/win/configure.ac index a71858e..2180b55 100644 --- a/win/configure.ac +++ b/win/configure.ac @@ -178,6 +178,52 @@ SC_EMBED_MANIFEST(wish.exe.manifest) SC_BUILD_TCLSH SC_PROG_TCLSH +#-------------------------------------------------------------------- +# Zipfs support - Tip 430 +#-------------------------------------------------------------------- +AC_ARG_ENABLE(zipfs, + AS_HELP_STRING([--enable-zipfs], + [build with Zipfs support (default: on)]), + [tcl_ok=$enableval], [tcl_ok=yes]) +if test "$tcl_ok" = "yes" ; then + # + # Find a native compiler + # + AX_CC_FOR_BUILD + # + # Find a native zip implementation + # + SC_ZIPFS_SUPPORT + ZIPFS_BUILD=1 + TK_ZIP_FILE=libtcl_${TK_MAJOR_VERSION}_${TK_MINOR_VERSION}_${TK_PATCH_LEVEL}.zip +else + ZIPFS_BUILD=0 + TCL_ZIP_FILE= +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(TK_ZIP_FILE) +AC_SUBST(INSTALL_LIBRARIES) +AC_SUBST(INSTALL_MSGS) + + #------------------------------------------------------------------------ # tkConfig.sh refers to this by a different name #------------------------------------------------------------------------ |