@@ -15,11 +15,16 @@ SRCURL="http://prdownloads.sourceforge.net/tcl/tk${TCLVERS}-src.tar.gz" BUILDDIR="$(pwd)/build/tk${TCLVERS}" PATCHDIR="$(pwd)/patches" OUTDIR="$(pwd)/out" INSTDIR="$(pwd)/inst" -export SRC SRCURL BUILDDIR PATCHDIR OUTDIR INSTDIR +PATCHSCRIPTDIR="$(pwd)/patchscripts" +export SRC SRCURL BUILDDIR PATCHDIR OUTDIR INSTDIR PATCHSCRIPTDIR + +# Must be kept in-sync with "../tcl/build.sh" +TCLFOSSILDATE="../tcl/src/tcl${TCLVERS}.tar.gz.date" +export TCLFOSSILDATE rm -rf 'build' 'out' 'inst' mkdir 'build' 'out' 'inst' || exit 1 # Determine Tcl version @@ -31,22 +36,38 @@ if [ ! -f "${SRC}" ]; then mkdir 'src' >/dev/null 2>/dev/null + use_fossil='0' if echo "${TCLVERS}" | grep '^cvs_' >/dev/null; then - CVSTAG=$(echo "${TCLVERS}" | sed 's/^cvs_//g') - export CVSTAG + use_fossil='1' + elif echo "${TCLVERS}" | grep '^fossil_' >/dev/null; then + use_fossil='1' + fi + if [ "${use_fossil}" = "1" ]; then ( + FOSSILDATE="$(cat "${TCLFOSSILDATE}" 2>/dev/null)" + cd src || exit 1 - cvs -z3 -d:pserver:anonymous@tcl.cvs.sourceforge.net:/cvsroot/tktoolkit co -r "${CVSTAG}" -P tk + workdir="tmp-$$${RANDOM}${RANDOM}${RANDOM}" + rm -rf "${workdir}" + + mkdir "${workdir}" || exit 1 + cd "${workdir}" || exit 1 + + wget -O "tmp-tk.tar.gz" "http://core.tcl.tk/tk/tarball/tk-fossil.tar.gz?uuid=${FOSSILDATE}" || rm -f 'tmp-tk.tar.gz' + gzip -dc "tmp-tk.tar.gz" | tar -xf - - mv tk "tk${TCLVERS}" + mv "tk-fossil" "tk${TCLVERS}" + + tar -cf - "tk${TCLVERS}" | gzip -c > "../../${SRC}" - tar -cf - "tk${TCLVERS}" | gzip -c > "../${SRC}" + cd .. + rm -rf "${workdir}" ) else rm -f "${SRC}.tmp" wget -O "${SRC}.tmp" "${SRCURL}" || exit 1 mv "${SRC}.tmp" "${SRC}" @@ -84,10 +105,21 @@ echo "Applying: ${patch}" ${PATCH:-patch} -p1 < "${patch}" done ) + + # Apply patch scripts if needed + for patchscript in "${PATCHSCRIPTDIR}"/*.sh; do + if [ -f "${patchscript}" ]; then + echo "Running patch script: ${patchscript}" + + ( + . "${patchscript}" + ) + fi + done for dir in unix win macosx win64 __fail__; do if [ "${dir}" = "__fail__" ]; then exit 1 fi @@ -141,10 +173,16 @@ echo "Running: ${MAKE:-make} install" ${MAKE:-make} install || continue # Update to include resources, if found if [ "${dir}" = "win" ]; then + echo ' *** Importing user-specified icon' + cp "${KITCREATOR_ICON}" rc/tk.ico + + echo ' *** Importing user-specified resources' + cat "${KITCREATOR_RC}" | grep -v '^ *tclsh *ICON' >> "./rc/tk_base.rc" + echo ' *** Creating tkbase.res.o to support Windows build' echo "\"${RC:-windres}\" -o tkbase.res.o --define STATIC_BUILD --include \"./../generic\" --include \"${TCLCONFIGDIR}/../generic\" --include \"${TCLCONFIGDIR}\" --include \"./rc\" \"./rc/tk_base.rc\"" "${RC:-windres}" -o tkbase.res.o --define STATIC_BUILD --include "./../generic" --include "${TCLCONFIGDIR}/../generic" --include "${TCLCONFIGDIR}" --include "./rc" "./rc/tk_base.rc" if [ -f "tkbase.res.o" ]; then