Diff

Differences From Artifact [a9ff88ca8e]:

To Artifact [c2e5b35e3d]:


     1      1   #! /usr/bin/env bash
     2      2   
     3      3   # BuildCompatible: KitCreator
     4      4   
     5      5   version='3.1.18.1'
     6      6   url="http://github.com/andreas-kupries/critcl/tarball/${version}/critcl-${version}.tar.gz"
     7      7   sha256='c26893bda46dfda332d2e7d7410ae998eafda697169ea25b4256295d293089de'
            8  +deps_dir="$(pwd)/deps"
     8      9   
     9     10   function configure() {
    10     11   	:
    11     12   }
    12     13   
    13     14   function build() {
    14     15   	:
    15     16   }
    16     17   
    17     18   function install() {
    18     19   	local tclmajminvers
    19     20   	local critcl_cdir
           21  +	local critcl_target_info
           22  +
           23  +	# Setup cross-compilation in the way Critcl expects, as best as possible
           24  +	if [ "${KC_CROSSCOMPILE}" = '0' ]; then
           25  +		critcl_target_info=()
           26  +	else
           27  +		critcl_target_info=(-target)
           28  +		case "${KC_CROSSCOMPILE_HOST_OS}" in
           29  +			aarch64-*-linux|aarch64-*-linux-*)
           30  +				critcl_target_info+=('linux-64-aarch64')
           31  +				;;
           32  +			arm-*-linux-*|arm-*-linux)
           33  +				critcl_target_info+=('linux-arm')
           34  +				;;
           35  +			i?86-*-linux-*|i?86-*-linux)
           36  +				critcl_target_info+=('linux-32-x86')
           37  +				;;
           38  +			hppa64-*-hpux*)
           39  +				critcl_target_info+=('hpux-parisc64-cc')
           40  +				;;
           41  +			i?86-*-solaris2.*)
           42  +				critcl_target_info+=('solaris-ix86-cc')
           43  +				#critcl_target_info+=('solaris-x86_64-cc')
           44  +				;;
           45  +			i?86-*-mingw32*)
           46  +				critcl_target_info+=('mingw32')
           47  +				;;
           48  +			x86_64-*-mingw32*)
           49  +				critcl_target_info+=('mingw32')
           50  +				;;
           51  +			mips-*-linux-*|mips-*-linux|mipsel-*-linux-*|mipsel-*-linux|mipseb-*-linux-*|mipseb-*-linux)
           52  +				critcl_target_info+=('linux-32-mips')
           53  +				;;
           54  +			powerpc-*-aix*)
           55  +				critcl_target_info+=('aix-powerpc-cc')
           56  +				;;
           57  +			sparc-*-solaris2.*)
           58  +				critcl_target_info+=('solaris-sparc-cc')
           59  +				#critcl_target_info+=('solaris-sparc64-cc')
           60  +				;;
           61  +			x86_64-*-linux-*|x86_64-*-linux)
           62  +				critcl_target_info+=('linux-64-x86_64')
           63  +				;;
           64  +			*)
           65  +				echo "error: Critcl does not support cross-compiling to ${KC_CROSSCOMPILE_HOST_OS}" >&2
           66  +				return 1
           67  +				;;
           68  +		esac
           69  +	fi
           70  +
           71  +	# Include our Tcl packages directory, to ensure Critcl can be run
           72  +	export TCLLIBPATH="${deps_dir}"
    20     73   
           74  +	# Call the Critcl installer
    21     75   	mkdir -p "${installdir}/lib" || return 1
           76  +	"${TCLSH_NATIVE}" ./build.tcl install "${critcl_target_info[@]}" "${installdir}/lib" || return 1
    22     77   
    23         -	tclmajminvers="$(echo "${TCLVERS}" | cut -f 1-2 -d .)"
           78  +	# Critcl returns success even if it fails, so we need to double-check its work
           79  +	if [ "${KC_CROSSCOMPILE}" = '0' ]; then
           80  +		if [ ! -d "$(echo "${installdir}"/lib/*md5c*/)" ]; then
           81  +			return 1
           82  +		fi
           83  +	fi
    24     84   
    25         -	"${TCLSH_NATIVE}" ./build.tcl install "${installdir}/lib" || return 1
    26         -
           85  +	# We only need to keep headers for a single version of Tcl, the one the kit was compiled
           86  +	# for
           87  +	tclmajminvers="$(echo "${TCLVERS}" | cut -f 1-2 -d .)"
    27     88   	critcl_cdir="$(echo "${installdir}/lib"/critcl*/critcl_c)"
    28     89   
    29     90   	mv "${critcl_cdir}/tcl${tclmajminvers}" "${critcl_cdir}/.keep-tcl" || return 1
    30     91   	rm -rf "${critcl_cdir}"/tcl*/
    31     92   	mv "${critcl_cdir}/.keep-tcl" "${critcl_cdir}/tcl${tclmajminvers}" || return 1
    32     93   
    33     94   	return 0
    34     95   }