From c1a56eb2d1e2e43e4b1e17aef5fd7f1a627db4e4 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 11 Feb 2021 16:30:11 +0000 Subject: Experiment: Integrate culler's "macher" tool. Only for thin binaries --- .github/workflows/mac-build.yml | 6 ++++++ unix/Makefile.in | 7 +++++++ unix/configure | 42 ++++++++++++++++++++++++++++++++++++----- unix/configure.ac | 10 +++++----- unix/tcl.m4 | 25 +++++++++++++++++++++++- 5 files changed, 79 insertions(+), 11 deletions(-) diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml index 7ca1817..c0add28 100644 --- a/.github/workflows/mac-build.yml +++ b/.github/workflows/mac-build.yml @@ -13,6 +13,9 @@ jobs: - name: Prepare run: | touch tclStubInit.c tclOOStubInit.c tclOOScript.h + wget https://github.com/culler/macher/releases/download/v1.0/macher + sudo cp macher /usr/local/bin + sudo chmod a+x /usr/local/bin/macher working-directory: generic - name: Build run: make all @@ -40,6 +43,9 @@ jobs: - name: Prepare run: | touch tclStubInit.c tclOOStubInit.c tclOOScript.h + wget https://github.com/culler/macher/releases/download/v1.0/macher + sudo cp macher /usr/local/bin + sudo chmod a+x /usr/local/bin/macher mkdir "$HOME/install dir" working-directory: generic - name: Configure ${{ matrix.cfgopt }} diff --git a/unix/Makefile.in b/unix/Makefile.in index 00e29be..7c87f07 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -727,6 +727,7 @@ HOST_CC = @CC_FOR_BUILD@ HOST_EXEEXT = @EXEEXT_FOR_BUILD@ HOST_OBJEXT = @OBJEXT_FOR_BUILD@ ZIPFS_BUILD = @ZIPFS_BUILD@ +MACHER = @MACHER_PROG@ NATIVE_ZIP = @ZIP_PROG@ ZIP_PROG_OPTIONS = @ZIP_PROG_OPTIONS@ ZIP_PROG_VFSSEARCH = @ZIP_PROG_VFSSEARCH@ @@ -792,7 +793,10 @@ ${LIB_FILE}: ${STUB_LIB_FILE} ${OBJS} ${TCL_ZIP_FILE} rm -f $@ @MAKE_LIB@ @if test "${ZIPFS_BUILD}" = "1" ; then \ + if test "x$(MACHER)" = "x" ; then \ cat ${TCL_ZIP_FILE} >> ${LIB_FILE}; \ + else $(MACHER) append ${TCL_ZIP_FILE} ${LIB_FILE}; \ + fi; \ ${NATIVE_ZIP} -A ${LIB_FILE} \ || echo 'ignore zip-error by adjust sfx process (not executable?)'; \ fi @@ -819,7 +823,10 @@ ${TCL_EXE}: ${TCLSH_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} ${TCL_ZIP_FILE} @TCL_BUILD_LIB_SPEC@ ${TCL_STUB_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ \ ${CC_SEARCH_FLAGS} -o ${TCL_EXE} @if test "${ZIPFS_BUILD}" = "2" ; then \ + if test "x$(MACHER)" = "x" ; then \ cat ${TCL_ZIP_FILE} >> ${TCL_EXE}; \ + else $(MACHER) append ${TCL_ZIP_FILE} ${TCL_EXE}; \ + fi; \ ${NATIVE_ZIP} -A ${TCL_EXE} \ || echo 'ignore zip-error by adjust sfx process (not executable?)'; \ fi diff --git a/unix/configure b/unix/configure index 50a035b..b59a888 100755 --- a/unix/configure +++ b/unix/configure @@ -698,6 +698,7 @@ ZIP_INSTALL_OBJS ZIP_PROG_VFSSEARCH ZIP_PROG_OPTIONS ZIP_PROG +MACHER_PROG EXEEXT_FOR_BUILD CC_FOR_BUILD DTRACE @@ -11028,7 +11029,7 @@ else $as_nop tcl_ok=yes fi -if test "$tcl_ok" = "yes" -a "x$enable_framework" != "xyes"; then +if test "$tcl_ok" = "yes"; then # # Find a native compiler # @@ -11097,11 +11098,41 @@ printf "%s\n" "$bfd_cv_build_exeext" >&6; } # Find a native zip implementation # + MACHER_PROG="" ZIP_PROG="" ZIP_PROG_OPTIONS="" ZIP_PROG_VFSSEARCH="" ZIP_INSTALL_OBJS="" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for macher" >&5 +printf %s "checking for macher... " >&6; } + if test ${ac_cv_path_macher+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/macher 2> /dev/null` \ + `ls -r $dir/macher 2> /dev/null` ; do + if test x"$ac_cv_path_macher" = x ; then + if test -f "$j" ; then + ac_cv_path_macher=$j + break + fi + fi + done + done + +fi + + if test -f "$ac_cv_path_macher" ; then + MACHER_PROG="$ac_cv_path_macher" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MACHER_PROG" >&5 +printf "%s\n" "$MACHER_PROG" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Found macher in environment" >&5 +printf "%s\n" "Found macher in environment" >&6; } + fi { 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} @@ -11148,11 +11179,12 @@ printf "%s\n" "No zip found on PATH. Building minizip" >&6; } - ZIPFS_BUILD=1 - TCL_ZIP_FILE=libtcl${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_PATCH_LEVEL}.zip + + ZIPFS_BUILD=1 + TCL_ZIP_FILE=libtcl${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_PATCH_LEVEL}.zip else - ZIPFS_BUILD=0 - TCL_ZIP_FILE= + 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 diff --git a/unix/configure.ac b/unix/configure.ac index edf5f6d..7c30667 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -878,7 +878,7 @@ 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" -a "x$enable_framework" != "xyes"; then +if test "$tcl_ok" = "yes"; then # # Find a native compiler # @@ -887,11 +887,11 @@ if test "$tcl_ok" = "yes" -a "x$enable_framework" != "xyes"; then # Find a native zip implementation # SC_ZIPFS_SUPPORT - ZIPFS_BUILD=1 - TCL_ZIP_FILE=libtcl${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_PATCH_LEVEL}.zip + ZIPFS_BUILD=1 + TCL_ZIP_FILE=libtcl${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_PATCH_LEVEL}.zip else - ZIPFS_BUILD=0 - TCL_ZIP_FILE= + 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]) diff --git a/unix/tcl.m4 b/unix/tcl.m4 index a8911f8..7fc696e 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -3011,18 +3011,40 @@ AC_DEFUN([AX_CC_FOR_BUILD],[# Put a plausible default for CC_FOR_BUILD in Makefi # # Results: # Substitutes the following vars: -# ZIP_PROG +# MACHER_PROG +# ZIP_PROG # ZIP_PROG_OPTIONS # ZIP_PROG_VFSSEARCH # ZIP_INSTALL_OBJS #------------------------------------------------------------------------ AC_DEFUN([SC_ZIPFS_SUPPORT], [ + MACHER_PROG="" ZIP_PROG="" ZIP_PROG_OPTIONS="" ZIP_PROG_VFSSEARCH="" ZIP_INSTALL_OBJS="" + AC_MSG_CHECKING([for macher]) + AC_CACHE_VAL(ac_cv_path_macher, [ + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/macher 2> /dev/null` \ + `ls -r $dir/macher 2> /dev/null` ; do + if test x"$ac_cv_path_macher" = x ; then + if test -f "$j" ; then + ac_cv_path_macher=$j + break + fi + fi + done + done + ]) + if test -f "$ac_cv_path_macher" ; then + MACHER_PROG="$ac_cv_path_macher" + AC_MSG_RESULT([$MACHER_PROG]) + AC_MSG_RESULT([Found macher in environment]) + fi AC_MSG_CHECKING([for zip]) AC_CACHE_VAL(ac_cv_path_zip, [ search_path=`echo ${PATH} | sed -e 's/:/ /g'` @@ -3054,6 +3076,7 @@ AC_DEFUN([SC_ZIPFS_SUPPORT], [ ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" AC_MSG_RESULT([No zip found on PATH. Building minizip]) fi + AC_SUBST(MACHER_PROG) AC_SUBST(ZIP_PROG) AC_SUBST(ZIP_PROG_OPTIONS) AC_SUBST(ZIP_PROG_VFSSEARCH) -- cgit v0.12