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
|
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
-
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
-
+
-
-
-
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
|
# If we are building for Win32, we need to define "BUILD_tcl" so that
# TCL_STORAGE_CLASS gets defined as DLLEXPORT, to make static linking
# work
BUILDTYPE="$(basename "${TCLCONFIGDIR}")"
if [ "${BUILDTYPE}" = "win" ]; then
CPPFLAGS="${CPPFLAGS} -DBUILD_tcl=1"
export CPPFLAGS
fi
if [ "${STATICMK4}" != "-1" ]; then
if [ "${STATICMK4}" = "0" ]; then
echo 'Warning: Metakit4 fails to build shared on Win32, converting to static linking'
# If we are building for KitDLL, compile as shared
isshared="0"
if [ "${KITTARGET}" = "kitdll" ]; then
isshared="1"
STATICMK4="1"
fi
else
STATICMK4="0"
fi
export STATICMK4
fi
# Try to build as a shared object if requested
if [ "${STATICMK4}" = "0" ]; then
echo "Running: ./configure --enable-shared --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --with-tcl=\"${TCLCONFIGDIR}/../generic\" ${CONFIGUREEXTRA}"
./configure --enable-shared --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --with-tcl="${TCLCONFIGDIR}/../generic" ${CONFIGUREEXTRA}
tryopts="--enable-shared --disable-shared"
elif [ "${STATICMK4}" = "-1" ]; then
tryopts="--enable-shared"
else
echo "Running: ./configure --disable-shared --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --with-tcl=\"${TCLCONFIGDIR}/../generic\" ${CONFIGUREEXTRA}"
./configure --disable-shared --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --with-tcl="${TCLCONFIGDIR}/../generic" ${CONFIGUREEXTRA}
tryopts="--disable-shared"
fi
echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\""
${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" && \
${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" install || (
for tryopt in $tryopts __fail__; do
# Clean up, if needed
make distclean >/dev/null 2>/dev/null
rm -rf "${INSTDIR}"
mkdir "${INSTDIR}"
if [ "${tryopt}" = "__fail__" ]; then
exit 1
) || exit 1
exit 1
fi
if [ "${tryopt}" == "--enable-shared" ]; then
isshared="1"
else
isshared="0"
fi
(
echo "Running: ./configure $tryopt --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --with-tcl=\"${TCLCONFIGDIR}/../generic\" ${CONFIGUREEXTRA}"
./configure $tryopt --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --with-tcl="${TCLCONFIGDIR}/../generic" ${CONFIGUREEXTRA}
echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\""
${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" || exit 1
echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\" install"
${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" install || exit 1
) || continue
break
done
if [ "${isshared}" = "1" ]; then
# If we are building a shared version of Mk4tcl, put it in the VFS directory
# Clean up "libmk4.*", it's not needed
rm -f "${INSTDIR}/lib"/libmk4.*
# If we are building a shared version of Mk4tcl, put it in the VFS directory
if [ "${isshared}" = "1" ]; then
cp -r "${INSTDIR}/lib" "${OUTDIR}"
fi
exit 0
) || exit 1
exit 0
|