32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
rm -rf tcl
fi
if [ "${CLEANONLY}" = "0" ]; then
PROJROOTDIR="$(pwd)"
export PROJROOTDIR
for TCLVERS in 8.5.9 8.4.19; do
TCLSHORTVERS="$(echo "${TCLVERS}" | cut -f 1-2 -d '.')"
TCLPRIVATE="$(pwd)/tcl/build/tcl${TCLVERS}"
TCLINSTDIR="$(pwd)/tcl/inst-${TCLSHORTVERS}"
export TCLVERS TCLPRIVATE TCLINSTDIR
if [ -f "${TCLINSTDIR}/lib/tclConfig.sh" ]; then
echo "Skipping build of Tcl ${TCLVERS} (already found)"
continue
fi
mkdir tcl tcl/build >/dev/null 2>/dev/null
if [ ! -f "tcl/src/tcl${TCLVERS}.tar.gz" ]; then
mkdir tcl/src >/dev/null 2>/dev/null
wget -o /dev/null -O "tcl/src/tcl${TCLVERS}.tar.gz" "http://prdownloads.sourceforge.net/tcl/tcl${TCLVERS}-src.tar.gz"
fi
echo "Building Tcl ${TCLVERS}"
(
mkdir tcl/build >/dev/null 2>/dev/null
cd tcl/build || exit 1
gzip -dc "../src/tcl${TCLVERS}.tar.gz" | tar -xf -
# DDE and Reg can fail to compile, but we don't care
echo '' > "${TCLPRIVATE}/win/tclWinDde.c"
echo '' > "${TCLPRIVATE}/win/tclWinReg.c"
for dir in unix win macosx; do
cd "${TCLPRIVATE}/${dir}" || exit 1
echo " Executing: ./configure --enable-threads ${CONFIGUREEXTRA} --prefix=\"${TCLINSTDIR}\""
./configure --enable-threads ${CONFIGUREEXTRA} --prefix="${TCLINSTDIR}"
echo " Executing: ${MAKE:-make}"
${MAKE:-make} || continue
echo " Executing: ${MAKE:-make} install"
${MAKE:-make} install || break
LD_LIBRARY_PATH=".:${LD_LIBRARY_PATH}"
LD_RUN_PATH=".:${LD_RUN_PATH}"
export LD_LIBRARY_PATH LD_RUN_PATH
file tclsh tclsh*.exe 2>/dev/null | grep -iv 'No such file' > "${PROJROOTDIR}/platform.magic.file"
if [ -f tclsh*.exe ]; then
|
|
>
>
>
>
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
|
|
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
rm -rf tcl
fi
if [ "${CLEANONLY}" = "0" ]; then
PROJROOTDIR="$(pwd)"
export PROJROOTDIR
for TCLVERS in 8.5.10 8.4.19; do
TCLSHORTVERS="$(echo "${TCLVERS}" | cut -f 1-2 -d '.')"
TCLPRIVATE="$(pwd)/tcl/build/tcl${TCLVERS}"
TCLINSTDIR="$(pwd)/tcl/inst-${TCLSHORTVERS}"
export TCLVERS TCLPRIVATE TCLINSTDIR
if [ -f "${TCLINSTDIR}/lib/tclConfig.sh" ]; then
echo "Skipping build of Tcl ${TCLVERS} (already found)"
continue
fi
mkdir tcl tcl/build >/dev/null 2>/dev/null
# Clean this up so that other platforms don't use it
rm -f "${PROJROOTDIR}/platform.magic.dir"
if [ ! -f "tcl/src/tcl${TCLVERS}.tar.gz" ]; then
mkdir tcl/src >/dev/null 2>/dev/null
wget -o /dev/null -O "tcl/src/tcl${TCLVERS}.tar.gz" "http://prdownloads.sourceforge.net/tcl/tcl${TCLVERS}-src.tar.gz"
fi
echo "Building Tcl ${TCLVERS}"
(
mkdir tcl/build >/dev/null 2>/dev/null
cd tcl/build || exit 1
gzip -dc "../src/tcl${TCLVERS}.tar.gz" | tar -xf -
# Source fix-ups
## DDE and Reg can fail to compile, but we don't care
echo '' > "${TCLPRIVATE}/win/tclWinDde.c"
echo '' > "${TCLPRIVATE}/win/tclWinReg.c"
## Long-standing bug in Tcl
echo '#undef strtod' > "${TCLPRIVATE}/compat/strtod.c.new"
cat "${TCLPRIVATE}/compat/strtod.c" >> "${TCLPRIVATE}/compat/strtod.c.new"
cat "${TCLPRIVATE}/compat/strtod.c.new" > "${TCLPRIVATE}/compat/strtod.c"
rm -f "${TCLPRIVATE}/compat/strtod.c.new"
for dir in unix win macosx; do
cd "${TCLPRIVATE}/${dir}" || exit 1
echo " Executing: ./configure --enable-threads ${CONFIGUREEXTRA} --prefix=\"${TCLINSTDIR}\""
./configure --enable-threads ${CONFIGUREEXTRA} --prefix="${TCLINSTDIR}"
echo " Executing: ${MAKE:-make}"
${MAKE:-make} || (
rm -f tclConfig.sh
exit 1
) || continue
## Kludge to make Tcl install when cross-compiling.
sed 's@^${TCL_EXE}@blah@' Makefile > Makefile.new
cat Makefile.new > Makefile
rm -f Makefile.new
echo " Executing: ${MAKE:-make} install"
${MAKE:-make} install TCL_EXE="../../../../../../../../../../../../../../../../../$(which "${TCLSH_NATIVE:-tclsh}")" || break
LD_LIBRARY_PATH=".:${LD_LIBRARY_PATH}"
LD_RUN_PATH=".:${LD_RUN_PATH}"
export LD_LIBRARY_PATH LD_RUN_PATH
file tclsh tclsh*.exe 2>/dev/null | grep -iv 'No such file' > "${PROJROOTDIR}/platform.magic.file"
if [ -f tclsh*.exe ]; then
|
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
echo "Failed to build Tcl. See \"./tcl/build/build-${TCLVERS}.log\"" >&2
echo 'Aborting.' >&2
exit 1
) || exit 1
(
TCLBUILDDIR="$(cat "${PROJROOTDIR}/platform.magic.dir")"
export TCLBUILDDIR
if [ -d "${TCLINSTDIR}" -a -f "${TCLINSTDIR}/lib/tclConfig.sh" ]; then
TCLCONFIGDIR="${TCLINSTDIR}/lib"
elif [ -d "${TCLBUILDDIR}" -a -f "${TCLBUILDDIR}/tclConfig.sh" ]; then
TCLCONFIGDIR="${TCLBUILDDIR}"
else
echo 'Unable to find appropriate tclConfig.sh, aborting' >&2
|
>
>
>
>
>
>
|
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
echo "Failed to build Tcl. See \"./tcl/build/build-${TCLVERS}.log\"" >&2
echo 'Aborting.' >&2
exit 1
) || exit 1
(
rm -f "${PROJROOTDIR}/platform.magic.env-${TCLSHORTVERS}"
TCLBUILDDIR="$(cat "${PROJROOTDIR}/platform.magic.dir")"
export TCLBUILDDIR
if [ -z "${TCLBUILDDIR}" ]; then
TCLBUILDDIR="/dev/null"
fi
if [ -d "${TCLINSTDIR}" -a -f "${TCLINSTDIR}/lib/tclConfig.sh" ]; then
TCLCONFIGDIR="${TCLINSTDIR}/lib"
elif [ -d "${TCLBUILDDIR}" -a -f "${TCLBUILDDIR}/tclConfig.sh" ]; then
TCLCONFIGDIR="${TCLBUILDDIR}"
else
echo 'Unable to find appropriate tclConfig.sh, aborting' >&2
|