Diff

Differences From Artifact [4d38f54be3]:

To Artifact [9154479c58]:


26
27
28
29
30
31
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
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
133
134
135
136
137
138
139
140
141
142
143

144
145
146
147
148
149
150
26
27
28
29
30
31
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


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
133
134
135
136
137
138
139
140
141
142
143
144
145

146
147
148
149
150
151
152
153







+
+
-
-
+
+
+
+
-
-
-
+
+

-
+

-
-
-
-
+
+
+
+

-
-
-
-
-
+
+
+
+
+

-
-
-
+
+
+

-
-
+
+

-
-
+
+

+
-
-
+
+
+
+

-
-
-
+
+
+

-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+

-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
-
-
-
+
+
+
+
+
-
-
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+

-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+

-
-
-
+
+
+
+
+
+
+
+
+
+
+
















-
+







rm -rf tcl/build tcl/inst
rm -f platform.magic.*
if [ "${DISTCLEAN}" = "1" ]; then
	rm -rf tcl
fi

if [ "${CLEANONLY}" = "0" ]; then
	PROJROOTDIR="$(pwd)"
	export PROJROOTDIR
	TCLVERS="8.5.9"
	TCLPRIVATE="$(pwd)/tcl/build/tcl${TCLVERS}"

	for TCLVERS in 8.5.9 8.4.19; do
		TCLSHORTVERS="$(echo "${TCLVERS}" | cut -f 1-2 -d '.')"
		TCLPRIVATE="$(pwd)/tcl/build/tcl${TCLVERS}"
	PROJROOTDIR="$(pwd)"
	TCLINSTDIR="$(pwd)/tcl/inst"
	export TCLVERS TCLPRIVATE PROJROOTDIR TCLINSTDIR
		TCLINSTDIR="$(pwd)/tcl/inst-${TCLSHORTVERS}"
		export TCLVERS TCLPRIVATE TCLINSTDIR

	mkdir tcl tcl/build >/dev/null 2>/dev/null
		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
		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 -
		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"
			# 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
			for dir in unix win macosx; do
				cd "${TCLPRIVATE}/${dir}" || exit 1

			echo " Executing: ./configure ${CONFIGUREEXTRA}"
			./configure --disable-threads ${CONFIGUREEXTRA} --prefix="${TCLINSTDIR}"
				echo " Executing: ./configure --enable-threads ${CONFIGUREEXTRA} --prefix=\"${TCLINSTDIR}\""
				./configure --enable-threads ${CONFIGUREEXTRA} --prefix="${TCLINSTDIR}"

				echo " Executing: ${MAKE:-make}"
			${MAKE:-make} || continue
			${MAKE:-make} install || break
				${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
				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
				echo 'puts "$::tcl_platform(os)"' | ./tclsh*.exe > "${PROJROOTDIR}/platform.magic.os" 2>/dev/null
			else
				echo 'puts "$::tcl_platform(os)"' | ./tclsh > "${PROJROOTDIR}/platform.magic.os" 2>/dev/null
			fi
			echo "${dir}" > "${PROJROOTDIR}/platform.magic.platform"
			pwd > "${PROJROOTDIR}/platform.magic.dir"
				file tclsh tclsh*.exe 2>/dev/null | grep -iv 'No such file' > "${PROJROOTDIR}/platform.magic.file"
				if [ -f tclsh*.exe ]; then
					echo 'puts "$::tcl_platform(os)"' | ./tclsh*.exe > "${PROJROOTDIR}/platform.magic.os" 2>/dev/null
				else
					echo 'puts "$::tcl_platform(os)"' | ./tclsh > "${PROJROOTDIR}/platform.magic.os" 2>/dev/null
				fi
				echo "${dir}" > "${PROJROOTDIR}/platform.magic.platform"
				pwd > "${PROJROOTDIR}/platform.magic.dir"

			break
		done
	) > "tcl/build/build.log" 2>&1 || (
		echo 'Failed to build Tcl.  See "./tcl/build/build.log"'
		echo 'Proceeding with system Tcl.  Building might fail.'
	)

	TCLBUILDDIR="$(cat "${PROJROOTDIR}/platform.magic.dir")"
	export TCLBUILDDIR
				break
			done

			exit 0
		) > "tcl/build/build-${TCLVERS}.log" 2>&1 || (
			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
			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
		unset TCLPRIVATE

				echo 'Unable to find appropriate tclConfig.sh, aborting' >&2
		TCLCONFIGDIR=$(
			(

				echo "${LD_LIBRARY_PATH}" | tr ':' "\n"
				cat /etc/ld.so.conf 2>/dev/null
				crle 2>/dev/null | grep '^ *Default Library Path' | sed 's@^ *Default Library Path[^:]*:[^:]*/@/@' | tr ':' "\n"
			) | grep '^/' | while read chklibdir; do
				if [ -f "${chklibdir}/tclConfig.sh" ]; then
					echo "${chklibdir}"
					break
				fi
			done
		)
		if [ -z "${TCLCONFIGDIR}" ]; then
			TCLCONFIGDIR="/usr/lib"
		fi

				exit 1
		TCLPRIVATE="$(dirname "${TCLCONFIGDIR}")/include/tcl-private"
	fi
			fi

	ADDFLAGS=""
	if [ -n "${TCLPRIVATE}" ]; then
		ADDFLAGS="${ADDFLAGS} -I${TCLPRIVATE} -I${TCLPRIVATE}/generic"
	fi
	if [ -n "${TCLBUILDDIR}" ]; then
		ADDFLAGS="${ADDFLAGS} -I${TCLBUILDDIR}"
	fi
	CFLAGS="${ADDFLAGS} ${CFLAGS}"
	CPPFLAGS="${ADDFLAGS} ${CPPFLAGS}"
			ADDFLAGS=""
			if [ -n "${TCLPRIVATE}" ]; then
				ADDFLAGS="${ADDFLAGS} -I${TCLPRIVATE} -I${TCLPRIVATE}/generic"
			fi
			if [ -n "${TCLBUILDDIR}" ]; then
				ADDFLAGS="${ADDFLAGS} -I${TCLBUILDDIR}"
			fi
			CFLAGS="${ADDFLAGS} ${CFLAGS}"
			CPPFLAGS="${ADDFLAGS} ${CPPFLAGS}"

	unset TCLVERS
	unset ADDFLAGS
	export TCLBUILDDIR TCLCONFIGDIR TCLPRIVATE CFLAGS CPPFLAGS
			unset TCLVERS
			unset ADDFLAGS
			export TCLBUILDDIR TCLCONFIGDIR TCLPRIVATE CFLAGS CPPFLAGS

			rm -f "${PROJROOTDIR}/platform.magic.env-${TCLSHORTVERS}"
			set > "${PROJROOTDIR}/platform.magic.env-${TCLSHORTVERS}"
			export >> "${PROJROOTDIR}/platform.magic.env-${TCLSHORTVERS}"
		)
	done

	rm -f "${PROJROOTDIR}/platform.magic.dir"
fi

# Determine platform
if [ -z "${FORCE_PLATFORM}" ]; then
	PLATFORM="$(./platform)"
else
	PLATFORM="${FORCE_PLATFORM}"
fi
export PLATFORM

# Build all appropriate directories
faileddirs=""
if [ -z "${DIRS}" ]; then
	DIRS="`echo */`"
	PKGHASHCODE=''
else
	PKGHASHCODE="$(echo "${DIRS}" | sed 's@[/ ]@@g' | openssl sha1 | awk '{ print $1 }')"
	PKGHASHCODE="$((echo "${DIRS}" | tr ' ' "\n" | sort | tr "\n" ' '; echo ) | sed 's@[/ ]@@g' | openssl sha1 | awk '{ print $1 }')"
fi
for dir in ${DIRS}; do
	export dir

	if [ ! -f "${dir}/build.sh" ]; then
		continue
	fi
175
176
177
178
179
180
181



182
183
184
185
186
187
188
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194







+
+
+







		cp "${dir}/out/${PLATFORM}/build.log" "${dir}/failed-${PLATFORM}-`hostname`.log"

		rm -rf "${dir}/out"
		faileddirs="${faileddirs} ${dir}"
		echo "Failed to build ${dir}"
	fi
done

# Clean magic-related files
rm -f platform.magic.*

# Cleanup is done at this point
if [ "${CLEANONLY}" = "1" ]; then
	exit 0
fi

# Let the user know what failed to build