Differences From
Artifact [74d986fc51]:
10 10
11 11 exit 1
12 12 fi
13 13
14 14 SRC="src/tk${TCLVERS}.tar.gz"
15 15 SRCURL="http://prdownloads.sourceforge.net/tcl/tk${TCLVERS}-src.tar.gz"
16 16 BUILDDIR="$(pwd)/build/tk${TCLVERS}"
17 +PATCHDIR="$(pwd)/patches"
17 18 OUTDIR="$(pwd)/out"
18 19 INSTDIR="$(pwd)/inst"
19 -export SRC SRCURL BUILDDIR OUTDIR INSTDIR
20 +export SRC SRCURL BUILDDIR PATCHDIR OUTDIR INSTDIR
20 21
21 22 rm -rf 'build' 'out' 'inst'
22 23 mkdir 'build' 'out' 'inst' || exit 1
24 +
25 +# Determine Tcl version
26 +TCL_VERSION="unknown"
27 +if [ -f "${TCLCONFIGDIR}/tclConfig.sh" ]; then
28 + source "${TCLCONFIGDIR}/tclConfig.sh"
29 +fi
30 +export TCL_VERSION
31 +
23 32
24 33 if [ ! -f "${SRC}" ]; then
25 34 mkdir 'src' >/dev/null 2>/dev/null
26 35
27 36 if echo "${TCLVERS}" | grep '^cvs_' >/dev/null; then
28 37 CVSTAG=$(echo "${TCLVERS}" | sed 's/^cvs_//g')
29 38 export CVSTAG
................................................................................
50 59 if [ ! -d '../buildsrc' ]; then
51 60 gzip -dc "../${SRC}" | tar -xf -
52 61 else
53 62 cp -rp ../buildsrc/* './'
54 63 fi
55 64
56 65 cd "${BUILDDIR}" || exit 1
66 +
67 + # Determine Tk version
68 + TK_VERSION="$(grep '^#.*define.*TK_VERSION' generic/tk.h 2>/dev/null | sed 's@^# *define[[:space:]][[:space:]]*TK_VERSION[[:space:]][[:space:]]*\"@@;s@\"$@@' 2>/dev/null | head -n 1)"
69 + if [ -z "${TK_VERSION}" ]; then
70 + TK_VERSION="unknown"
71 + fi
72 + export TK_VERSION
73 +
74 + echo "Note: TCL_VERSION=\"${TCL_VERSION}\""
75 + echo "Note: TK_VERSION=\"${TK_VERSION}\""
76 +
77 + (
78 + # Apply required patches
79 + cd "${BUILDDIR}" || exit 1
80 + for patch in "${PATCHDIR}/all"/tk-${TK_VERSION}-*.diff "${PATCHDIR}/${TCL_VERSION}"/tk-${TK_VERSION}-*.diff; do
81 + if [ ! -f "${patch}" ]; then
82 + continue
83 + fi
84 +
85 + echo "Applying: ${patch}"
86 + ${PATCH:-patch} -p1 < "${patch}"
87 + done
88 + )
89 +
57 90 for dir in unix win macosx win64 __fail__; do
58 91 if [ "${dir}" = "__fail__" ]; then
59 92 exit 1
60 93 fi
61 94
62 95 # Windows/amd64 workarounds
63 96 win64="0"