Check-in [437d69d82c]
Overview
Comment:Updated to include many Tcl symbols
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tcc
Files: files | file ages | folders
SHA1:437d69d82cc1f8754f639a285bd262b4d97ca932
User & Date: rkeene on 2014-04-28 14:02:34
Other Links: manifest | tags
Context
2014-04-28
16:33
Updated to more accepting of C compilers when fixing up TCC check-in: 35718d9982 user: rkeene tags: tcc
14:02
Updated to include many Tcl symbols check-in: 437d69d82c user: rkeene tags: tcc
2014-04-27
05:52
More work towards getting a usable TclTCC check-in: 2a3d2138b6 user: rkeene tags: tcc
Changes

Modified tcc/build.sh from [bdd97ba1c5] to [bb5492c154].

    13     13   
    14     14   TCLTCCVERS="0.4"
    15     15   SRC="src/tcltcc-${TCLTCCVERS}.zip"
    16     16   SRCURL="https://tcltcc.googlecode.com/files/tcltcc${TCLTCCVERS}.zip"
    17     17   BUILDDIR="$(pwd)/build/tcltcc-0.4"
    18     18   OUTDIR="$(pwd)/out"
    19     19   INSTDIR="$(pwd)/inst"
           20  +PATCHSCRIPTDIR="$(pwd)/patchscripts"
    20     21   PATCHDIR="$(pwd)/patches"
    21         -export TCLTCCVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR
           22  +export TCLTCCVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHSCRIPTDIR PATCHDIR
    22     23   
    23     24   # Set configure options for this sub-project
    24     25   LDFLAGS="${KC_TCLTCC_LDFLAGS}"
    25     26   CFLAGS="${KC_TCLTCC_CFLAGS}"
    26     27   CPPFLAGS="${KC_TCLTCC_CPPFLAGS}"
    27     28   LIBS="${KC_TCLTCC_LIBS}"
    28     29   export LDFLAGS CFLAGS CPPFLAGS LIBS
................................................................................
    57     58   		)
    58     59   	else    
    59     60   		cp -rp ../buildsrc/* './'
    60     61   	fi
    61     62   
    62     63   	# Apply required patches
    63     64   	cd "${BUILDDIR}" || exit 1
           65  +
           66  +	# Install current Tcl headers
           67  +	cp -r ../../../{tcl,tk}/inst/include/* include/
           68  +
    64     69   	for patch in "${PATCHDIR}/all"/tcltcc-${TCLTCCVERS}-*.diff "${PATCHDIR}/${TCL_VERSION}"/tcltcc-${TCLTCCVERS}-*.diff; do
    65     70   		if [ ! -f "${patch}" ]; then
    66     71   			continue
    67     72   		fi
    68     73   
    69     74   		echo "Applying: ${patch}"
    70     75   		${PATCH:-patch} -p1 < "${patch}"
    71     76   	done
    72     77   
    73         -	cd "${BUILDDIR}" || exit 1
           78  +	# Apply patch scripts if needed
           79  +	for patchscript in "${PATCHSCRIPTDIR}"/*.sh; do
           80  +		if [ -f "${patchscript}" ]; then
           81  +			echo "Running patch script: ${patchscript}"
           82  +
           83  +			(
           84  +				. "${patchscript}"
           85  +			)
           86  +		fi
           87  +	done
    74     88   
    75     89   	# Try to build as a shared object if requested
    76     90   	if [ "${STATICTCLTCC}" = "0" ]; then
    77     91   		tryopts="--enable-shared --disable-shared"
    78     92   	elif [ "${STATICTCLTCC}" = "-1" ]; then
    79     93   		tryopts="--enable-shared"
    80     94   	else
................................................................................
   101    115   		# If build a static TclX for KitDLL, ensure that we use PIC
   102    116   		# so that it can be linked into the shared object
   103    117   		if [ "${isshared}" = "0" -a "${KITTARGET}" = "kitdll" ]; then
   104    118   			CFLAGS="${SAVE_CFLAGS} -fPIC"
   105    119   		else
   106    120   			CFLAGS="${SAVE_CFLAGS}"
   107    121   		fi
          122  +
          123  +		if [ "${isshared}" = "0" ]; then
          124  +			CFLAGS="${CFLAGS} -DCONFIG_TCC_STATIC=1"
          125  +		fi
   108    126   		export CFLAGS
   109    127   
   110    128   		if [ "${isshared}" = '0' ]; then
   111    129   			sed 's@USE_TCL_STUBS@XXX_TCL_STUBS@g' configure > configure.new
   112    130   		else
   113    131   			sed 's@XXX_TCL_STUBS@USE_TCL_STUBS@g' configure > configure.new
   114    132   		fi
................................................................................
   141    159   
   142    160   	# Install headers needed for compilation
   143    161   	incDir="${pkgDir}/include"
   144    162   	mkdir "${incDir}"
   145    163   
   146    164   	touch include/windows.h
   147    165   	cp -r include/* "${incDir}"
   148         -	cp -r ../../../{tcl,tk}/inst/include/* "${incDir}"
   149    166   
   150    167   	find "${incDir}" -name '*.a' | xargs rm -f
   151    168   
   152    169   	# Install libraries
   153    170   	libDir="${pkgDir}/lib"
   154    171   	mkdir "${libDir}"
   155    172   
................................................................................
   156    173   	(
   157    174   		cd c || exit 1
   158    175   		rm -f *.a *.o
   159    176   		for file in *.c; do
   160    177   			ofile="$(echo "${file}" | sed 's@\.c$@.o@')"
   161    178   			"${CC:-gcc}" -I../include -I../../../../{tcl,tk}/inst/include/ -I../../../../tcl/build/tcl${TCLVERS}/generic/ -I../../../../tcl/build/tcl${TCLVERS}/unix/ -DUSE_TCL_STUBS=1 -c "${file}" -o "${ofile}"
   162    179   		done
   163         -		"${AR:-ar}" cu ../lib/libtcc1.a *.o
          180  +		"${AR:-ar}" rcu ../lib/libtcc1.a *.o
   164    181   		"${RANLIB:-ranlib}" ../lib/libtcc1.a
   165    182   	)
   166    183   	cp lib/libtcc1.a "${libDir}"
   167    184   
   168    185   	# Create VFS-insert
   169    186   	cp -r "${INSTDIR}/lib" "${OUTDIR}" || exit 1
   170    187   	find "${OUTDIR}" -name '*.a' -type f | grep -v '/lib/libtcc1\.a$' | xargs rm -f
   171    188   
   172    189   	exit 0
   173    190   ) || exit 1
   174    191   
   175    192   exit 0

Added tcc/patchscripts/tcltcc-0.4-addtclfuncs.sh version [cd3e226cba].

            1  +#! /bin/bash
            2  +
            3  +function find_syms() {
            4  +	if [ -z "${NM}" ]; then
            5  +		if echo "${CC}" | sed 's@ .*$@@' | grep '[-]' >/dev/null; then
            6  +			NM="$(echo "${CC}" | sed 's@ .*$@@;s@\(.*\)-[^-]*$@\1-nm@')"
            7  +		else
            8  +			NM='nm'
            9  +		fi
           10  +	fi
           11  +
           12  +	# "${NM}" "${LIBTCL}" | sed 's@:.*$@@' | sed 's@.* @@' | grep '^Tcl_' | sort -u | while read -r sym; do
           13  +	"${CC:-gcc}" ${CPPFLAGS} -E include/tcl.h  | grep '^ *extern.*Tcl_'| sed 's@^ *extern *@@;s@(.*@@;s@.* *\**  *@@'  | sort -u | grep '^Tcl_' | grep -v ';$' | while read -r sym; do
           14  +		echo "    TCCSYM($sym)"
           15  +	done
           16  +}
           17  +
           18  +add="$(find_syms)"
           19  +
           20  +awk -v add="${add}" '/TCCSyms tcc_syms.*=/{
           21  +	print
           22  +	print add
           23  +	next
           24  +} { print }' generic/tcc.h > generic/tcc.h.new
           25  +cat generic/tcc.h.new > generic/tcc.h
           26  +rm -f generic/tcc.h.new
           27  +
           28  +exit 0