Diff

Differences From Artifact [68f05d7b91]:

To Artifact [eadceaed0f]:


    13     13   
    14     14   ZLIBVERS="1.2.8"
    15     15   SRC="src/zlib-${ZLIBVERS}.tar.gz"
    16     16   SRCURL="http://sourceforge.net/projects/libpng/files/zlib/${ZLIBVERS}/zlib-${ZLIBVERS}.tar.gz/download"
    17     17   BUILDDIR="$(pwd)/build/zlib-${ZLIBVERS}"
    18     18   OUTDIR="$(pwd)/out"
    19     19   INSTDIR="$(pwd)/inst"
    20         -export ZLIBVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR
           20  +PATCHSCRIPTDIR="$(pwd)/patchscripts"
           21  +PATCHDIR="$(pwd)/patches"
           22  +export ZLIBVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHSCRIPTDIR PATCHDIR
    21     23   
    22     24   # Set configure options for this sub-project
    23     25   LDFLAGS="${KC_ZLIB_LDFLAGS}"
    24     26   CFLAGS="${KC_ZLIB_CFLAGS}"
    25     27   CPPFLAGS="${KC_ZLIB_CPPFLAGS}"
    26     28   LIBS="${KC_ZLIB_LIBS}"
    27     29   export LDFLAGS CFLAGS CPPFLAGS LIBS
................................................................................
    45     47   	if [ ! -d '../buildsrc' ]; then
    46     48   		gzip -dc "../${SRC}" | tar -xf -
    47     49   	else    
    48     50   		cp -rp ../buildsrc/* './'
    49     51   	fi
    50     52   
    51     53   	cd "${BUILDDIR}" || exit 1
    52         -	# ZLIB Expects AR to contain options
    53         -	AR="${AR:-ar} rcu"
    54         -	export AR
           54  +
           55  +	# Apply patches if needed
           56  +	for patch in "${PATCHDIR}/all"/zlib-${ZLIBVERS}-*.diff "${PATCHDIR}/all"/zlib-all-*.diff "${PATCHDIR}/${ZLIBVERS}"/zlib-${ZLIBVERS}-*.diff; do
           57  +		if [ ! -f "${patch}" ]; then
           58  +			continue
           59  +		fi
           60  +
           61  +		echo "Applying: ${patch}"
           62  +		${PATCH:-patch} -p1 < "${patch}"
           63  +	done
           64  +
           65  +
           66  +	# Apply patch scripts if needed
           67  +	for patchscript in "${PATCHSCRIPTDIR}"/*.sh; do
           68  +		if [ -f "${patchscript}" ]; then
           69  +			echo "Running patch script: ${patchscript}"
           70  +
           71  +			(
           72  +				. "${patchscript}"
           73  +			)
           74  +		fi
           75  +	done
    55     76   
    56     77   	# If we are building for KitDLL, compile with '-fPIC'
    57     78   	if [ "${KITTARGET}" = "kitdll" ]; then
    58     79   		CFLAGS="${CFLAGS} -fPIC"
    59     80   		export CFLAGS
    60     81   	fi
    61     82   
    62     83   	# We don't pass CONFIGUREEXTRA here, since this isn't a GNU autoconf
    63     84   	# script and will puke
    64     85   	echo "Running: ./configure --prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\""
    65     86   	./configure --prefix="${INSTDIR}" --libdir="${INSTDIR}/lib"
    66     87   
    67         -	echo "Running: ${MAKE:-make} AR=\"${AR}\""
    68         -	${MAKE:-make} AR="${AR}" || exit 1
           88  +	echo "Running: ${MAKE:-make}"
           89  +	${MAKE:-make} || exit 1
    69     90   
    70         -	echo "Running: ${MAKE:-make} install AR=\"${AR}\""
    71         -	${MAKE:-make} install AR="${AR}"
           91  +	echo "Running: ${MAKE:-make} install"
           92  +	${MAKE:-make} install
    72     93   
    73     94   	# We don't really care too much about failure in zlib
    74     95   	exit 0
    75     96   ) || exit 1
    76     97   
    77     98   exit 0