Diff

Differences From Artifact [a9ff88ca8e]:

To Artifact [c2e5b35e3d]:


1
2
3
4
5
6
7

8
9
10
11
12
13
14
15
16
17
18
19

20











































21




22
23


24


25

26










27
28
29
30
31
32
33
34
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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







+












+

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

-
+
+

+
+
-
+

+
+
+
+
+
+
+
+
+
+








#! /usr/bin/env bash

# BuildCompatible: KitCreator

version='3.1.18.1'
url="http://github.com/andreas-kupries/critcl/tarball/${version}/critcl-${version}.tar.gz"
sha256='c26893bda46dfda332d2e7d7410ae998eafda697169ea25b4256295d293089de'
deps_dir="$(pwd)/deps"

function configure() {
	:
}

function build() {
	:
}

function install() {
	local tclmajminvers
	local critcl_cdir
	local critcl_target_info

	# Setup cross-compilation in the way Critcl expects, as best as possible
	if [ "${KC_CROSSCOMPILE}" = '0' ]; then
		critcl_target_info=()
	else
		critcl_target_info=(-target)
		case "${KC_CROSSCOMPILE_HOST_OS}" in
			aarch64-*-linux|aarch64-*-linux-*)
				critcl_target_info+=('linux-64-aarch64')
				;;
			arm-*-linux-*|arm-*-linux)
				critcl_target_info+=('linux-arm')
				;;
			i?86-*-linux-*|i?86-*-linux)
				critcl_target_info+=('linux-32-x86')
				;;
			hppa64-*-hpux*)
				critcl_target_info+=('hpux-parisc64-cc')
				;;
			i?86-*-solaris2.*)
				critcl_target_info+=('solaris-ix86-cc')
				#critcl_target_info+=('solaris-x86_64-cc')
				;;
			i?86-*-mingw32*)
				critcl_target_info+=('mingw32')
				;;
			x86_64-*-mingw32*)
				critcl_target_info+=('mingw32')
				;;
			mips-*-linux-*|mips-*-linux|mipsel-*-linux-*|mipsel-*-linux|mipseb-*-linux-*|mipseb-*-linux)
				critcl_target_info+=('linux-32-mips')
				;;
			powerpc-*-aix*)
				critcl_target_info+=('aix-powerpc-cc')
				;;
			sparc-*-solaris2.*)
				critcl_target_info+=('solaris-sparc-cc')
				#critcl_target_info+=('solaris-sparc64-cc')
				;;
			x86_64-*-linux-*|x86_64-*-linux)
				critcl_target_info+=('linux-64-x86_64')
				;;
			*)
				echo "error: Critcl does not support cross-compiling to ${KC_CROSSCOMPILE_HOST_OS}" >&2
	mkdir -p "${installdir}/lib" || return 1
				return 1
				;;
		esac
	fi

	tclmajminvers="$(echo "${TCLVERS}" | cut -f 1-2 -d .)"
	# Include our Tcl packages directory, to ensure Critcl can be run
	export TCLLIBPATH="${deps_dir}"

	# Call the Critcl installer
	mkdir -p "${installdir}/lib" || return 1
	"${TCLSH_NATIVE}" ./build.tcl install "${installdir}/lib" || return 1
	"${TCLSH_NATIVE}" ./build.tcl install "${critcl_target_info[@]}" "${installdir}/lib" || return 1

	# Critcl returns success even if it fails, so we need to double-check its work
	if [ "${KC_CROSSCOMPILE}" = '0' ]; then
		if [ ! -d "$(echo "${installdir}"/lib/*md5c*/)" ]; then
			return 1
		fi
	fi

	# We only need to keep headers for a single version of Tcl, the one the kit was compiled
	# for
	tclmajminvers="$(echo "${TCLVERS}" | cut -f 1-2 -d .)"
	critcl_cdir="$(echo "${installdir}/lib"/critcl*/critcl_c)"

	mv "${critcl_cdir}/tcl${tclmajminvers}" "${critcl_cdir}/.keep-tcl" || return 1
	rm -rf "${critcl_cdir}"/tcl*/
	mv "${critcl_cdir}/.keep-tcl" "${critcl_cdir}/tcl${tclmajminvers}" || return 1

	return 0
}