cookutils rev 377

cook: dont cross compile package with HOST_ARCH unset (see comments)
author Christophe Lincoln <pankso@slitaz.org>
date Sat May 12 20:29:17 2012 +0200 (2012-05-12)
parents 2b84441caa17
children 0c6b86180633
files cook
line diff
     1.1 --- a/cook	Sat May 12 03:32:54 2012 +0200
     1.2 +++ b/cook	Sat May 12 20:29:17 2012 +0200
     1.3 @@ -426,21 +426,22 @@
     1.4  	separator
     1.5  	set_paths
     1.6  
     1.7 -	# Handle cross compilation.
     1.8 -	if [ "$HOST_ARCH" ]; then
     1.9 -		if ! echo "$HOST_ARCH" | fgrep -q $ARCH; then
    1.10 -			echo "ERROR: This package dont cook or is not include in: $ARCH"
    1.11 -			[ "$CROSS_BUGS" ] && echo "Bug: $CROSS_BUGS"
    1.12 -			exit 1
    1.13 -		fi
    1.14 -	fi
    1.15 +	# Handle cross-tools.
    1.16  	case "$ARCH" in
    1.17  		arm|x86_64)
    1.18 +			# CROSS_COMPILE is used by at leat Busybox and the kernel to set
    1.19 +			# the cross-tools prefix.
    1.20  			echo "cook: adding /usr/cross/$ARCH/bin to PATH"
    1.21  			export PATH=$PATH:/usr/cross/$ARCH/bin
    1.22 -			echo "cook: using C compiler $HOST_SYSTEM-gcc"
    1.23 +			export CROSS_COMPILE=$HOST_SYSTEM-
    1.24 +			echo "cook: using cross-tools: $CROSS_COMPILE"
    1.25  			export CC=${HOST_SYSTEM}-gcc
    1.26 -			export CXX=${HOST_SYSTEM}-g++ ;;
    1.27 +			export CXX=${HOST_SYSTEM}-g++
    1.28 +			export AR=${HOST_SYSTEM}-ar
    1.29 +			export AS=${HOST_SYSTEM}-as
    1.30 +			export RANLIB=${HOST_SYSTEM}-ranlib
    1.31 +			export LD=${HOST_SYSTEM}-ld
    1.32 +			export STRIP=${HOST_SYSTEM}-strip ;;
    1.33  	esac
    1.34  
    1.35  	[ "$QA" ] && receipt_quality
    1.36 @@ -1161,6 +1162,42 @@
    1.37  		receipt="$WOK/$pkg/receipt"
    1.38  		check_pkg_in_wok && echo ""
    1.39  
    1.40 +		unset inst
    1.41 +		unset_receipt
    1.42 +		. $receipt
    1.43 +
    1.44 +		# Handle cross compilation.
    1.45 +		#
    1.46 +		# CROSS_NOTE: Actually we are running an ARM cooker but running
    1.47 +		# the cooker and build each commit in wok is not possible since
    1.48 +		# we dont cook the full wok for this arch. For ARM we need a set
    1.49 +		# of packages to handle a touch sreen desktop, servers but not
    1.50 +		# erland.
    1.51 +		#
    1.52 +		# The temporary solution is to build only reviewed and tested
    1.53 +		# packages with HOST_ARCH set in receipt.
    1.54 +		case "$ARCH" in
    1.55 +			arm)
    1.56 +				if [ ! "$HOST_ARCH" ]; then
    1.57 +					echo "cook: HOST_ARCH is not set in receipt"
    1.58 +					echo "cook: This package is not include in: $ARCH"
    1.59 +					[ "$CROSS_BUGS" ] && echo "bugs: $CROSS_BUGS"
    1.60 +					echo "Cook skip $pkg: HOST_ARCH is not set" | log
    1.61 +					echo "" && exit 1
    1.62 +				fi ;;
    1.63 +		esac
    1.64 +
    1.65 +		# Some packages are not include in some arch or fails to cross compile.
    1.66 +		if [ "$HOST_ARCH" ]; then
    1.67 +			if ! $(echo "$HOST_ARCH" | fgrep -q $ARCH); then
    1.68 +				echo "cook: HOST_ARCH=$HOST_ARCH"
    1.69 +				echo "cook: This package dont cook or is not include in: $ARCH"
    1.70 +				[ "$CROSS_BUGS" ] && echo "bugs: $CROSS_BUGS"
    1.71 +				echo "Cook skip $pkg: is not include in: $ARCH" | log
    1.72 +				echo "" && exit 1
    1.73 +			fi
    1.74 +		fi
    1.75 +
    1.76  		# Skip blocked, 3 lines also for the Cooker.
    1.77  		if grep -q "^$pkg$" $blocked && [ "$2" != "--unblock" ]; then
    1.78  			gettext -e "Blocked package:"; echo -e " $pkg\n" && exit 0
    1.79 @@ -1176,10 +1213,6 @@
    1.80  		trap 'gettext -e "\n\nCook stopped: control-C\n\n" | \
    1.81  			tee -a $LOGS/$pkg.log' INT
    1.82  
    1.83 -		unset inst
    1.84 -		unset_receipt
    1.85 -		. $receipt
    1.86 -
    1.87  		# Handle --options
    1.88  		case "$2" in
    1.89  			--clean|-c)