Diff

Differences From Artifact [b9b3d01220]:

To Artifact [3c49d360c7]:


     5      5   
     6      6   	exit 1
     7      7   fi
     8      8   
     9      9   CLEANONLY=0
    10     10   DISTCLEAN=0
    11     11   if [ "$1" = "clean" ]; then
           12  +	shift
    12     13   	CLEANONLY=1
    13     14   fi
    14     15   if [ "$1" = "distclean" ]; then
           16  +	shift
    15     17   	CLEANONLY=1
    16     18   	DISTCLEAN=1
    17     19   fi
    18     20   export CLEANONLY DISTCLEAN
    19     21   
           22  +CONFIGUREEXTRA="$@"
           23  +export CONFIGUREEXTRA
           24  +
    20     25   # Determine path to "tclConfig.sh"
    21     26   rm -rf tcl/build
           27  +rm -f platform.magic.*
    22     28   if [ "${DISTCLEAN}" = "1" ]; then
    23     29   	rm -rf tcl
    24     30   fi
    25     31   
    26     32   if [ "${CLEANONLY}" = "0" ]; then
    27     33   	TCLVERS="8.4.19"
    28     34   	TCLPRIVATE="$(pwd)/tcl/build/tcl${TCLVERS}"
           35  +	PROJROOTDIR="$(pwd)"
           36  +	export TCLVERS TCLPRIVATE PROJROOTDIR
    29     37   
    30     38   	mkdir tcl tcl/build >/dev/null 2>/dev/null
    31     39   
    32     40   	if [ ! -f "tcl/src/tcl${TCLVERS}.tar.gz" ]; then
    33     41   		mkdir tcl/src >/dev/null 2>/dev/null
    34     42   		wget -o /dev/null -O "tcl/src/tcl${TCLVERS}.tar.gz" "http://prdownloads.sourceforge.net/tcl/tcl${TCLVERS}-src.tar.gz"
    35     43   	fi
................................................................................
    36     44   
    37     45   	echo "Building Tcl ${TCLVERS}"
    38     46   	(
    39     47   		mkdir tcl/build >/dev/null 2>/dev/null
    40     48   		cd tcl/build || exit 1
    41     49   		gzip -dc "../src/tcl${TCLVERS}.tar.gz" | tar -xf -
    42     50   
    43         -		cd "${TCLPRIVATE}/unix" || exit 1
           51  +		for dir in unix win macosx; do
           52  +			cd "${TCLPRIVATE}/${dir}" || exit 1
    44     53   
    45         -		./configure --enable-shared
           54  +			echo " Executing: ./configure ${CONFIGUREEXTRA}"
           55  +			./configure --disable-threads ${CONFIGUREEXTRA}
    46     56   
    47         -		${MAKE:-make}
    48         -	) > "tcl/build/build.log" 2>&1
           57  +			${MAKE:-make} || continue
    49     58   
    50         -	if [ -d "${TCLPRIVATE}" -a -f "${TCLPRIVATE}/unix/tclConfig.sh" ]; then
    51         -		TCLCONFIGDIR="${TCLPRIVATE}/unix"
           59  +			LD_LIBRARY_PATH=".:${LD_LIBRARY_PATH}"
           60  +			LD_RUN_PATH=".:${LD_RUN_PATH}"
           61  +			export LD_LIBRARY_PATH LD_RUN_PATH
           62  +
           63  +			file tclsh tclsh*.exe 2>/dev/null | grep -iv 'No such file' > "${PROJROOTDIR}/platform.magic.file"
           64  +			if [ -f tclsh*.exe ]; then
           65  +				echo 'puts "$::tcl_platform(os)"' | ./tclsh*.exe > "${PROJROOTDIR}/platform.magic.os" 2>/dev/null
           66  +			else
           67  +				echo 'puts "$::tcl_platform(os)"' | ./tclsh > "${PROJROOTDIR}/platform.magic.os" 2>/dev/null
           68  +			fi
           69  +			echo "${dir}" > "${PROJROOTDIR}/platform.magic.platform"
           70  +			pwd > "${PROJROOTDIR}/platform.magic.dir"
           71  +
           72  +			break
           73  +		done
           74  +	) > "tcl/build/build.log" 2>&1 || (
           75  +		echo 'Failed to build Tcl.  See "./tcl/build/build.log"'
           76  +		echo 'Proceeding with system Tcl.  Building might fail.'
           77  +	)
           78  +
           79  +	TCLBUILDDIR="$(cat "${PROJROOTDIR}/platform.magic.dir")"
           80  +	export TCLBUILDDIR
           81  +
           82  +	if [ -d "${TCLBUILDDIR}" -a -f "${TCLBUILDDIR}/tclConfig.sh" ]; then
           83  +		TCLCONFIGDIR="${TCLBUILDDIR}"
    52     84   	else
    53     85   		unset TCLPRIVATE
    54     86   
    55     87   		TCLCONFIGDIR=$(
    56     88   			(
    57     89   				echo "${LD_LIBRARY_PATH}" | tr ':' "\n"
    58     90   				cat /etc/ld.so.conf 2>/dev/null
................................................................................
    64     96   				fi
    65     97   			done
    66     98   		)
    67     99   		if [ -z "${TCLCONFIGDIR}" ]; then
    68    100   			TCLCONFIGDIR="/usr/lib"
    69    101   		fi
    70    102   
    71         -		TCLPRIVATE="${TCLCONFIGDIR}/../include/tcl-private"
          103  +		TCLPRIVATE="$(dirname "${TCLCONFIGDIR}")/include/tcl-private"
    72    104   	fi
    73    105   
    74         -	ADDFLAGS="-I${TCLPRIVATE} -I${TCLPRIVATE}/generic -I${TCLPRIVATE}/unix"
          106  +	ADDFLAGS="-I${TCLPRIVATE} -I${TCLPRIVATE}/generic -I${TCLBUILDDIR}"
    75    107   	CFLAGS="${ADDFLAGS} ${CFLAGS}"
    76    108   	CPPFLAGS="${ADDFLAGS} ${CPPFLAGS}"
    77    109   
    78    110   	unset TCLVERS
    79    111   	unset ADDFLAGS
          112  +	unset TCLBUILDDIR
    80    113   	export TCLCONFIGDIR TCLPRIVATE CFLAGS CPPFLAGS
    81    114   fi
    82    115   
    83    116   # Determine platform
    84    117   PLATFORM="$(./platform)"
    85    118   export PLATFORM
    86    119