Diff

Differences From Artifact [bdd97ba1c5]:

To Artifact [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