Diff

Differences From Artifact [0d543b9c73]:

To Artifact [7fff79d460]:


     1      1   #! /usr/bin/env bash
     2      2   
     3         -if [ ! -f 'build.sh' ]; then
     4         -	echo 'ERROR: This script must be run from the directory it is in' >&2
            3  +# BuildCompatible: KitCreator
     5      4   
     6         -	exit 1
     7         -fi
     8         -if [ -z "${TCLVERS}" ]; then
     9         -	echo 'ERROR: The TCLVERS environment variable is not set' >&2
    10         -
    11         -	exit 1
    12         -fi
    13         -
    14         -TCLXVERS="8.4.1"
    15         -SRC="src/tclx${TCLXVERS}.tar.bz2"
    16         -SRCURL="http://sourceforge.net/projects/tclx/files/TclX/${TCLXVERS}/tclx${TCLXVERS}.tar.bz2/download"
    17         -SRCHASH='-'
    18         -BUILDDIR="$(pwd)/build/tclx8.4"
    19         -OUTDIR="$(pwd)/out"
    20         -INSTDIR="$(pwd)/inst"
    21         -PATCHDIR="$(pwd)/patches"
    22         -export TCLXVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR
    23         -
    24         -# Set configure options for this sub-project
    25         -LDFLAGS="${LDFLAGS} ${KC_TCLX_LDFLAGS}"
    26         -CFLAGS="${CFLAGS} ${KC_TCLX_CFLAGS}"
    27         -CPPFLAGS="${CPPFLAGS} ${KC_TCLX_CPPFLAGS}"
    28         -LIBS="${LIBS} ${KC_TCLX_LIBS}"
    29         -export LDFLAGS CFLAGS CPPFLAGS LIBS
    30         -
    31         -rm -rf 'build' 'out' 'inst'
    32         -mkdir 'build' 'out' 'inst' || exit 1
    33         -
    34         -TCL_VERSION="unknown"
    35         -if [ -f "${TCLCONFIGDIR}/tclConfig.sh" ]; then
    36         -        source "${TCLCONFIGDIR}/tclConfig.sh"
    37         -fi
    38         -export TCL_VERSION
    39         -
    40         -if [ ! -f "${SRC}" ]; then
    41         -	mkdir 'src' >/dev/null 2>/dev/null
    42         -
    43         -	if [ ! -d 'buildsrc' ]; then
    44         -		download "${SRCURL}" "${SRC}" "${SRCHASH}" || exit 1
    45         -	fi
    46         -fi
    47         -
    48         -(
    49         -	cd 'build' || exit 1
    50         -
    51         -	if [ ! -d '../buildsrc' ]; then
    52         -		bzip2 -dc "../${SRC}" | tar -xf -
    53         -	else    
    54         -		cp -rp ../buildsrc/* './'
    55         -	fi
    56         -
    57         -	# Apply required patches
    58         -	cd "${BUILDDIR}" || exit 1
    59         -	for patch in "${PATCHDIR}/all"/tclx-${TCLXVERS}-*.diff "${PATCHDIR}/${TCL_VERSION}"/tclx-${TCLXVERS}-*.diff; do
    60         -		if [ ! -f "${patch}" ]; then
    61         -			continue
    62         -		fi
    63         -
    64         -		echo "Applying: ${patch}"
    65         -		${PATCH:-patch} -p1 < "${patch}"
    66         -	done
    67         -
    68         -	cd "${BUILDDIR}" || exit 1
    69         -
    70         -	# Try to build as a shared object if requested
    71         -	if [ "${STATICTCLX}" = "0" ]; then
    72         -		tryopts="--enable-shared --disable-shared"
    73         -	elif [ "${STATICTCLX}" = "-1" ]; then
    74         -		tryopts="--enable-shared"
    75         -	else
    76         -		tryopts="--disable-shared"
    77         -	fi
    78         -
    79         -	SAVE_CFLAGS="${CFLAGS}"
    80         -	for tryopt in $tryopts __fail__; do
    81         -		# Clean up, if needed
    82         -		make distclean >/dev/null 2>/dev/null
    83         -		rm -rf "${INSTDIR}"
    84         -		mkdir "${INSTDIR}"
    85         -
    86         -		if [ "${tryopt}" = "__fail__" ]; then
    87         -			exit 1
    88         -		fi
    89         -
    90         -		if [ "${tryopt}" == "--enable-shared" ]; then
    91         -			isshared="1"
    92         -		else
    93         -			isshared="0"
    94         -		fi
    95         -
    96         -		# If build a static TclX for KitDLL, ensure that we use PIC
    97         -		# so that it can be linked into the shared object
    98         -		if [ "${isshared}" = "0" -a "${KITTARGET}" = "kitdll" ]; then
    99         -			CFLAGS="${SAVE_CFLAGS} -fPIC"
   100         -		else
   101         -			CFLAGS="${SAVE_CFLAGS}"
   102         -		fi
   103         -		export CFLAGS
   104         -
   105         -		if [ "${isshared}" = '0' ]; then
   106         -			sed 's@USE_TCL_STUBS@XXX_TCL_STUBS@g' configure > configure.new
   107         -		else
   108         -			sed 's@XXX_TCL_STUBS@USE_TCL_STUBS@g' configure > configure.new
   109         -		fi
   110         -		cat configure.new > configure
   111         -		rm -f configure.new
   112         -
   113         -		(
   114         -			echo "Running: ./configure $tryopt --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --with-tcl=\"${TCLCONFIGDIR}\" ${CONFIGUREEXTRA}"
   115         -			./configure $tryopt --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" ${CONFIGUREEXTRA}
   116         -
   117         -			echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\""
   118         -			${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" || exit 1
   119         -
   120         -			echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\" install"
   121         -			${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" install || exit 1
   122         -		) || continue
   123         -
   124         -		break
   125         -	done
   126         -
   127         -	if [ ! -e "${INSTDIR}/lib/tclx8.4/pkgIndex.tcl" ]; then
   128         -		cat << _EOF_ > "${INSTDIR}/lib/tclx8.4/pkgIndex.tcl"
   129         -package ifneeded Tclx 8.4 [list load {} Tclx]
   130         -_EOF_
   131         -        fi
   132         -
   133         -	# Install files needed by installation
   134         -	cp -r "${INSTDIR}/lib" "${OUTDIR}" || exit 1
   135         -	find "${OUTDIR}" -name '*.a' -type f | xargs -n 1 rm -f --
   136         -
   137         -	exit 0
   138         -) || exit 1
   139         -
   140         -exit 0
            5  +version="8.4.1"
            6  +url="http://sourceforge.net/projects/tclx/files/TclX/${version}/tclx${version}.tar.bz2"
            7  +sha256='a9b41f606ec6c1268b9c78512e6e1cb533bd9ae3e786e650d111fc16ffe758ec'
            8  +tclpkg='Tclx'
            9  +tclpkgversion='8.4'