cookutils diff cross @ rev 822

cooker.cgi: add source link
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Jul 26 21:39:56 2016 +0200 (2016-07-26)
parents f2cd25cd9120
children 3f0ca4492ec7
line diff
     1.1 --- a/cross	Fri Jun 06 18:31:25 2014 +0100
     1.2 +++ b/cross	Tue Jul 26 21:39:56 2016 +0200
     1.3 @@ -2,22 +2,27 @@
     1.4  #
     1.5  # Cross - Help build a cross toolchain on SliTaz.
     1.6  #
     1.7 -# Copyright 2012-2014 (C) SliTaz GNU/Linux - BSD License
     1.8 +# Copyright 2012-2015 (C) SliTaz GNU/Linux - BSD License
     1.9  # Author: Christophe Lincoln <pankso@slitaz.org>
    1.10  #
    1.11 +
    1.12  . /lib/libtaz.sh
    1.13  
    1.14  [ -f "/etc/slitaz/cross.conf" ] && . /etc/slitaz/cross.conf
    1.15  [ -f "cross.conf" ] && . ./cross.conf
    1.16  
    1.17 +
    1.18  # Handle --config=/path/to/cross.conf
    1.19 +
    1.20  [ "$config" ] && . $config
    1.21 -source=$WORK/source
    1.22 -tools=$WORK/tools
    1.23 -sysroot=$WORK/sysroot
    1.24 -logdir=$WORK/log
    1.25 +source="$WORK/source"
    1.26 +tools="$WORK/tools"
    1.27 +sysroot="$WORK/sysroot"
    1.28 +logdir="$WORK/log"
    1.29 +
    1.30  
    1.31  # Cross-tools tarballs
    1.32 +
    1.33  binutils_tarball="binutils-$BINUTILS_VERSION.tar.bz2"
    1.34  linux_tarball="linux-$LINUX_VERSION.tar.xz"
    1.35  glibc_tarball="glibc-$GLIBC_VERSION.tar.bz2"
    1.36 @@ -25,7 +30,9 @@
    1.37  gcc_tarball="gcc-$GCC_VERSION.tar.bz2"
    1.38  libtool_tarball="libtool-$LIBTOOL_VERSION.tar.gz"
    1.39  
    1.40 +
    1.41  # Cross-tools URLs
    1.42 +
    1.43  binutils_wget="http://ftp.gnu.org/gnu/binutils/$binutils_tarball"
    1.44  linux_wget="http://www.kernel.org/pub/linux/kernel/v3.x/$linux_tarball"
    1.45  glibc_wget="http://ftp.gnu.org/gnu/libc/$glibc_tarball"
    1.46 @@ -34,9 +41,11 @@
    1.47  gcc_wget="http://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/$gcc_tarball"
    1.48  libtool_wget="ftp://sunsite.cnlab-switch.ch/mirror/gnu/libtool/$libtool_tarball"
    1.49  
    1.50 +
    1.51  # Help and usage.
    1.52 +
    1.53  usage() {
    1.54 -	cat << EOT
    1.55 +	cat <<EOT
    1.56  
    1.57  Usage: $(basename $0) command --option
    1.58  
    1.59 @@ -62,10 +71,12 @@
    1.60  EOT
    1.61  }
    1.62  
    1.63 +
    1.64  # Prebuilt README
    1.65 +
    1.66  prebuilt_readme() {
    1.67 -	echo -n "Creating toolchain README..."
    1.68 -	cat >> $package/README << EOT
    1.69 +	echo -n 'Creating toolchain README...'
    1.70 +	cat >> $package/README <<EOT
    1.71  
    1.72  SliTaz Prebuilt $ARCH cross toolchain
    1.73  ================================================================================
    1.74 @@ -85,7 +96,9 @@
    1.75  	status
    1.76  }
    1.77  
    1.78 +
    1.79  # Make sure we have all directories.
    1.80 +
    1.81  init_compile() {
    1.82  	unset CFLAGS CXXFLAGS
    1.83  	export LC_ALL=POSIX LANG=POSIX
    1.84 @@ -97,32 +110,38 @@
    1.85  	cd $source
    1.86  }
    1.87  
    1.88 +
    1.89  # Some arch may need custom CFLAGS to build Glibc/Eglibc
    1.90 +
    1.91  init_cflags() {
    1.92  	case "$ARCH" in
    1.93  		arm|armv6) export CFLAGS="-O2 -march=armv6" ;;
    1.94 -		armv6hf) export CFLAGS="-O2 -march=armv6j" ;;
    1.95 -		armv7) export CFLAGS="-Os -march=armv7-a" ;;
    1.96 +		armv6hf)   export CFLAGS="-O2 -march=armv6j" ;;
    1.97 +		armv7)     export CFLAGS="-Os -march=armv7-a" ;;
    1.98  	esac
    1.99  }
   1.100  
   1.101 +
   1.102  # Get source if not yet in $SRC.
   1.103 +
   1.104  download_src() {
   1.105 -	mkdir -p $SRC && cd $SRC
   1.106 +	mkdir -p $SRC; cd $SRC
   1.107  	[ -f "$binutils_tarball" ] || wget $binutils_wget
   1.108 -	[ -f "$linux_tarball" ] || wget --no-check-certificate $linux_wget
   1.109 -	[ -f "$glibc_tarball" ] || wget $glibc_wget
   1.110 -	[ -f "$eglibc_tarball" ] || wget $eglibc_wget
   1.111 -	[ -f "$gcc_tarball" ] || wget $gcc_wget
   1.112 -	[ -f "$libtool_tarball" ] || wget $libtool_wget
   1.113 +	[ -f "$linux_tarball" ]    || wget --no-check-certificate $linux_wget
   1.114 +	[ -f "$glibc_tarball" ]    || wget $glibc_wget
   1.115 +	[ -f "$eglibc_tarball" ]   || wget $eglibc_wget
   1.116 +	[ -f "$gcc_tarball" ]      || wget $gcc_wget
   1.117 +	[ -f "$libtool_tarball" ]  || wget $libtool_wget
   1.118  }
   1.119  
   1.120 +
   1.121  # 1. Binutils
   1.122 +
   1.123  binutils() {
   1.124  	init_compile
   1.125  	rm -rf binutils-$BINUTILS_VERSION
   1.126  	echo "Extracting: $binutils_tarball"
   1.127 -	tar xjf $SRC/$binutils_tarball
   1.128 +	tar -xjf $SRC/$binutils_tarball
   1.129  	echo "Configure: $BINUTILS_ARGS"
   1.130  	cd binutils-$BINUTILS_VERSION
   1.131  	./configure \
   1.132 @@ -138,16 +157,18 @@
   1.133  	echo "cross: binutils compiled on: $(date)"
   1.134  }
   1.135  
   1.136 +
   1.137  # 2. Kernel headers could use CROSS_COMPILE but gcc is not yet built.
   1.138 +
   1.139  linux_headers() {
   1.140  	init_compile
   1.141  	if [ ! -d "linux-$LINUX_VERSION" ]; then
   1.142  		echo "Extracting: $linux_tarball"
   1.143 -		tar xJf $SRC/$linux_tarball
   1.144 +		tar -xJf $SRC/$linux_tarball
   1.145  	fi
   1.146  	case "$ARCH" in
   1.147 -		armv6hf) KARCH="arm" ;;
   1.148 -		*) KARCH="$ARCH" ;;
   1.149 +		armv6hf) KARCH='arm' ;;
   1.150 +		*)       KARCH="$ARCH" ;;
   1.151  	esac
   1.152  	rm -rf linux-headers
   1.153  	cd linux-$LINUX_VERSION
   1.154 @@ -161,13 +182,15 @@
   1.155  	cp -a $source/linux-headers/* $sysroot/usr
   1.156  }
   1.157  
   1.158 +
   1.159  # 2.1 Glibc headers needed to compile x86_64 gcc-static.
   1.160 +
   1.161  glibc_headers() {
   1.162  	init_compile
   1.163  	echo "Extracting: $glibc_tarball"
   1.164 -	tar xjf $SRC/$glibc_tarball
   1.165 +	tar -xjf $SRC/$glibc_tarball
   1.166  	rm -rf glibc-headers
   1.167 -	mkdir glibc-headers && cd glibc-headers
   1.168 +	mkdir glibc-headers; cd glibc-headers
   1.169  	libc_cv_forced_unwind=yes \
   1.170  	libc_cv_c_cleanup=yes \
   1.171  	../glibc-$GLIBC_VERSION/configure \
   1.172 @@ -181,20 +204,22 @@
   1.173  	# Fixes
   1.174  	mkdir -p $sysroot/usr/include/gnu
   1.175  	touch $sysroot/usr/include/gnu/stubs.h
   1.176 -	
   1.177 +
   1.178  	# Fixe error: bits/stdio_lim.h not found
   1.179  	#cp bits/stdio_lim.h $sysroot/usr/include/bits
   1.180  	cp /usr/include/bits/stdio_lim.h $sysroot/usr/include/bits
   1.181  }
   1.182  
   1.183 +
   1.184  # 3. GCC static (first pass)
   1.185 +
   1.186  gcc_static() {
   1.187  	init_compile
   1.188  	echo "Extracting: $gcc_tarball"
   1.189 -	tar xjf $SRC/$gcc_tarball
   1.190 +	tar -xjf $SRC/$gcc_tarball
   1.191  	echo "Configure: $GCC_STATIC_ARGS"
   1.192  	rm -rf gcc-static
   1.193 -	mkdir gcc-static && cd gcc-static
   1.194 +	mkdir gcc-static; cd gcc-static
   1.195  	../gcc-$GCC_VERSION/configure \
   1.196  		--prefix=$tools \
   1.197  		--libexec=$tools/lib \
   1.198 @@ -213,28 +238,30 @@
   1.199  	echo "cross: gcc-static compiled on: $(date)"
   1.200  }
   1.201  
   1.202 +
   1.203  # 4. GNU Glibc: TODO Improve ARM support
   1.204 +
   1.205  glibc() {
   1.206  	init_compile
   1.207  	echo "Extracting: $glibc_tarball"
   1.208 -	tar xjf $SRC/$glibc_tarball
   1.209 +	tar -xjf $SRC/$glibc_tarball
   1.210  	echo "Configure: $GLIBC_ARGS"
   1.211  	# Some arch may need glibc-ports and custom CFLAGS
   1.212  	case "$ARCH" in
   1.213  		arm*)
   1.214 -			export CFLAGS="-march=armv6 -O2"
   1.215 +			export CFLAGS='-march=armv6 -O2'
   1.216  			[ -f "$SRC/glibc-ports-$GLIBC_VERSION.tar.bz2" ] || wget \
   1.217  				http://ftp.gnu.org/gnu/libc/glibc-ports-$GLIBC_VERSION.tar.bz2 \
   1.218  				-O $SRC/glibc-ports-$GLIBC_VERSION.tar.bz2 || exit 1
   1.219  			echo "Extracting: glibc-ports-$GLIBC_VERSION.tar.bz2"
   1.220  			rm -rf glibc-$GLIBC_VERSION/ports
   1.221 -			tar xjf $SRC/glibc-ports-$GLIBC_VERSION.tar.bz2
   1.222 +			tar -xjf $SRC/glibc-ports-$GLIBC_VERSION.tar.bz2
   1.223  			mv glibc-ports-$GLIBC_VERSION glibc-$GLIBC_VERSION/ports
   1.224 -			libexec=/usr/lib/glibc ;;
   1.225 +			libexec='/usr/lib/glibc' ;;
   1.226  		x86_64)
   1.227  			#export CFLAGS="-02 -march=generic -pipe"
   1.228 -			ccflags="-m64"
   1.229 -			libexec=/usr/lib64/glibc ;;
   1.230 +			ccflags='-m64'
   1.231 +			libexec='/usr/lib64/glibc' ;;
   1.232  	esac
   1.233  	# Disable linking to libgcc_eh
   1.234  	cd glibc-$GLIBC_VERSION
   1.235 @@ -243,7 +270,7 @@
   1.236  	cd ..
   1.237  	echo "CFLAGS: $CFLAGS"
   1.238  	rm -rf glibc-build
   1.239 -	mkdir -p glibc-build && cd glibc-build
   1.240 +	mkdir -p glibc-build; cd glibc-build
   1.241  	BUILD_CC="gcc" \
   1.242  	CC="${TARGET}-gcc $ccflags" \
   1.243  	AR="${TARGET}-ar" \
   1.244 @@ -264,13 +291,15 @@
   1.245  	case "$ARCH" in
   1.246  		x86_64)
   1.247  			rm -f $sysroot/lib $sysroot/usr/lib
   1.248 -			cd $sysroot && ln -s lib64 lib
   1.249 -			cd usr && ln -s lib64 lib ;;
   1.250 +			cd $sysroot; ln -s lib64 lib
   1.251 +			cd usr;      ln -s lib64 lib ;;
   1.252  	esac
   1.253  	echo "cross: glibc compiled on: $(date)"
   1.254  }
   1.255  
   1.256 +
   1.257  # 4. eglibc: always use --prefix=/usr
   1.258 +
   1.259  eglibc() {
   1.260  	init_compile
   1.261  	init_cflags
   1.262 @@ -280,7 +309,7 @@
   1.263  		exit 1
   1.264  	fi
   1.265  	echo "Extracting: $eglibc_tarball"
   1.266 -	tar xjf $SRC/$eglibc_tarball || exit 1
   1.267 +	tar -xjf $SRC/$eglibc_tarball || exit 1
   1.268  	case "$ARCH" in
   1.269  		arm*)
   1.270  			if [ ! -d "$source/eglibc-ports-$EGLIBC_VERSION" ]; then
   1.271 @@ -288,11 +317,11 @@
   1.272  				svn co $eglibc_svn/ports eglibc-ports-$EGLIBC_VERSION >/dev/null
   1.273  			fi
   1.274  			cp -a eglibc-ports-$EGLIBC_VERSION eglibc-$EGLIBC_VERSION/ports
   1.275 -			libexec=/usr/lib/eglibc ;;
   1.276 +			libexec='/usr/lib/eglibc' ;;
   1.277  		x86_64)
   1.278  			#export CFLAGS="-march=nocona -O2 -pipe"
   1.279 -			ccflags="-m64"
   1.280 -			libexec=/usr/lib64/eglibc ;;
   1.281 +			ccflags='-m64'
   1.282 +			libexec='/usr/lib64/eglibc' ;;
   1.283  	esac
   1.284  	# Disable linking to libgcc_eh
   1.285  	cd eglibc-$EGLIBC_VERSION
   1.286 @@ -300,14 +329,14 @@
   1.287  	sed -e 's/-lgcc_eh//g' Makeconfig.orig > Makeconfig
   1.288  	cd ..
   1.289  	echo "CFLAGS: $CFLAGS"
   1.290 -	mkdir -p eglibc-build && cd eglibc-build
   1.291 +	mkdir -p eglibc-build; cd eglibc-build
   1.292  	# config.cache
   1.293 -	cat > config.cache << EOT
   1.294 +	cat > config.cache <<EOT
   1.295  libc_cv_forced_unwind=yes
   1.296  libc_cv_c_cleanup=yes
   1.297  libc_cv_gnu89_inline=yes
   1.298  EOT
   1.299 -	BUILD_CC="gcc" \
   1.300 +	BUILD_CC='gcc' \
   1.301  	CC="${TARGET}-gcc $ccflags" \
   1.302  	AR="${TARGET}-ar" \
   1.303  	RANLIB="${TARGET}-ranlib" \
   1.304 @@ -330,16 +359,18 @@
   1.305  	echo "cross: eglibc compiled on: $(date)"
   1.306  }
   1.307  
   1.308 +
   1.309  # 5. GCC final
   1.310 +
   1.311  gcc_final() {
   1.312  	init_compile
   1.313  	if [ ! -d "gcc-$GCC_VERSION" ]; then
   1.314  		echo "Extracting: $gcc_tarball"
   1.315 -		tar xjf $SRC/$gcc_tarball
   1.316 +		tar -xjf $SRC/$gcc_tarball
   1.317  	fi
   1.318  	echo "Configure: $GCC_FINAL_ARGS"
   1.319  	rm -rf gcc-build
   1.320 -	mkdir -p gcc-build && cd gcc-build
   1.321 +	mkdir -p gcc-build; cd gcc-build
   1.322  	AR=ar \
   1.323  	../gcc-$GCC_VERSION/configure \
   1.324  		--prefix=$tools \
   1.325 @@ -365,13 +396,15 @@
   1.326  	echo "cross: GCC final compiled on: $(date)"
   1.327  }
   1.328  
   1.329 +
   1.330  # A cross libtool should avoid some shared libs path/format bugs
   1.331 +
   1.332  cross_libtool() {
   1.333  	init_compile
   1.334  	[ "$clean" ] && rm -rf libtool-${LIBTOOL_VERSION}
   1.335  	if [ ! -d "libtool-$LIBTOOL_VERSION" ]; then
   1.336  		echo "Extracting: $libtool_tarball"
   1.337 -		tar xzf $SRC/$libtool_tarball
   1.338 +		tar -xzf $SRC/$libtool_tarball
   1.339  	fi
   1.340  	cd libtool-${LIBTOOL_VERSION}
   1.341  	./configure \
   1.342 @@ -383,21 +416,23 @@
   1.343  	echo "cross: Cross libtool compiled on: $(date)"
   1.344  }
   1.345  
   1.346 +
   1.347  #
   1.348  # Commands
   1.349  #
   1.350  
   1.351  case "$1" in
   1.352  	howto|man)
   1.353 -		doc=/usr/share/doc/cookutils/cross.txt
   1.354 +		doc='/usr/share/doc/cookutils/cross.txt'
   1.355  		[ -f "$doc" ] && less -E $doc ;;
   1.356 +
   1.357  	info)
   1.358  		init_compile
   1.359  		init_cflags
   1.360  		CC=${TARGET}-gcc
   1.361 -		echo -e "\nCross Toolchain information" && separator
   1.362 +		echo -e '\nCross Toolchain information'; separator
   1.363  		[ "$config" ] && echo "Config file     : $config"
   1.364 -		cat << EOT
   1.365 +		cat <<EOT
   1.366  Target arch     : $ARCH
   1.367  C Compiler      : $CC
   1.368  CFLAGS          : $CFLAGS
   1.369 @@ -405,15 +440,16 @@
   1.370  Tools prefix    : $tools/bin
   1.371  Arch sysroot    : $sysroot
   1.372  EOT
   1.373 -		separator && echo ""
   1.374 -		echo "GCC version" && separator
   1.375 +		separator; newline
   1.376 +		echo 'GCC version'; separator
   1.377  		if [ -x "$tools/bin/$CC" ]; then
   1.378  			$CC -v
   1.379  		else
   1.380 -			echo "No C compiler. To build a toolchain run: cross compile"
   1.381 +			echo 'No C compiler. To build a toolchain run: cross compile'
   1.382  			echo "Missing: $tools/bin/$CC"
   1.383  		fi
   1.384 -		separator && echo "" ;;
   1.385 +		separator; newline ;;
   1.386 +
   1.387  	testsuite)
   1.388  		init_compile
   1.389  		echo "[COMPILING] $TARGET-gcc -v -Wall -o test.out test.c" \
   1.390 @@ -426,12 +462,13 @@
   1.391  		fi
   1.392  		echo -e "\n[CHECKING] readelf -h test.out" | tee -a $logdir/testsuite.log
   1.393  		readelf -h test.out | tee -a $logdir/testsuite.log ;;
   1.394 +
   1.395  	*setup)
   1.396 -		data="/usr/share/cross"
   1.397 +		data='/usr/share/cross'
   1.398  		arch=${1%-setup}
   1.399 -		[ "$arch" == "setup" ] && arch="arm"
   1.400 -		newline
   1.401 -		echo "Checking: build system packages"
   1.402 +		[ "$arch" == 'setup' ] && arch="arm"
   1.403 +
   1.404 +		newline; echo 'Checking: build system packages'
   1.405  		for pkg in slitaz-toolchain mpfr mpfr-dev gmp gmp-dev mpc-library \
   1.406  			gawk autoconf; do
   1.407  			if [ ! -d "/var/lib/tazpkg/installed/$pkg" ]; then
   1.408 @@ -447,30 +484,41 @@
   1.409  		cp -f ${data}/cross-${arch}.conf /etc/slitaz/cross.conf
   1.410  		cook ${arch}-setup
   1.411  		newline ;;
   1.412 +
   1.413  	download)
   1.414  		download_src ;;
   1.415 +
   1.416  	show-log)
   1.417  		pkg=$2
   1.418  		log=$logdir/$pkg.log
   1.419  		if [ ! -f "$log" ]; then
   1.420 -			echo "No log file found for: $pkg" && exit 1
   1.421 +			echo "No log file found for: $pkg"
   1.422 +			exit 1
   1.423  		fi
   1.424  		less -E $log ;;
   1.425 +
   1.426  	binutils)
   1.427  		rm -f $logdir/binutils.log
   1.428  		binutils 2>&1 | tee $logdir/binutils.log ;;
   1.429 +
   1.430  	linux-headers)
   1.431  		linux_headers 2>&1 | tee $logdir/linux-headers.log ;;
   1.432 +
   1.433  	glibc-headers)
   1.434  		glibc_headers 2>&1 | tee $logdir/glibc-headers.log ;;
   1.435 +
   1.436  	gcc-static)
   1.437  		gcc_static 2>&1 | tee $logdir/gcc-static.log ;;
   1.438 +
   1.439  	glibc)
   1.440  		glibc 2>&1 | tee $logdir/glibc.log ;;
   1.441 +
   1.442  	eglibc)
   1.443  		eglibc 2>&1 | tee $logdir/eglibc.log ;;
   1.444 +
   1.445  	gcc-final)
   1.446  		gcc_final 2>&1 | tee $logdir/gcc-final.log ;;
   1.447 +
   1.448  	compile)
   1.449  		# Compile the full toolchain.
   1.450  		time=$(date +%s)
   1.451 @@ -484,11 +532,11 @@
   1.452  		linux_headers 2>&1 | tee $logdir/linux-headers.log
   1.453  		gcc_static 2>&1 | tee $logdir/gcc-static.log
   1.454  		case "$ARCH" in
   1.455 -			arm*) eglibc 2>&1 | tee $logdir/eglibc.log ;;
   1.456 +			arm*)  eglibc 2>&1 | tee $logdir/eglibc.log ;;
   1.457  			x86_64) glibc 2>&1 | tee $logdir/glibc.log ;;
   1.458  		esac
   1.459  		gcc_final 2>&1 | tee $logdir/gcc-final.log
   1.460 -		echo ""
   1.461 +		newline
   1.462  		echo "Compile end  : $(date)" | tee -a $logdir/compile.log
   1.463  		time=$(($(date +%s) - $time))
   1.464  		sec=$time
   1.465 @@ -496,40 +544,43 @@
   1.466  		[ "$div" != 0 ] && min="~ ${div}m"
   1.467  		echo "Build time   : ${sec}s $min" | tee -a $logdir/compile.log
   1.468  		echo "" ;;
   1.469 +
   1.470  	libtool)
   1.471  		cross_libtool 2>&1 | tee $logdir/libtool.log ;;
   1.472 +
   1.473  	libhack)
   1.474  		# Some libxx.la files have libdir='/usr/lib' and make packages 
   1.475  		# cross compilation fail. Some receipts may have got hacked to force
   1.476  		# use of libs in sysroot but 'cross libhack' should be preferred.
   1.477  		echo "Libdir: $sysroot/usr/lib" 
   1.478 -		for la in $(fgrep -l libdir= $sysroot/usr/lib/*.la 2>/dev/null)
   1.479 -		do
   1.480 +		for la in $(fgrep -l libdir= $sysroot/usr/lib/*.la 2>/dev/null); do
   1.481  			if fgrep -q "libdir='/usr/lib'" ${la}; then
   1.482  				echo "Cross fixing: $(basename $la)"
   1.483  				sed -i s"#libdir=.*#libdir='/cross/$ARCH/sysroot/usr/lib'#" ${la}
   1.484  			fi
   1.485  		done ;;
   1.486 +
   1.487  	clean)
   1.488 -		echo -n "Removing all source files..."
   1.489 -		rm -rf $WORK/source && status
   1.490 +		echo -n 'Removing all source files...'
   1.491 +		rm -rf $WORK/source; status
   1.492  		[ "$log" ] && rm -f $WORK/log/*.log ;;
   1.493 +
   1.494  	clean-tools)
   1.495  		# Remove crap :-)
   1.496  		init_compile
   1.497  		echo "Cleaning   : $tools ($(du -sh $tools | awk '{print $1}'))"
   1.498 -		for file in share/info share/man share/local
   1.499 -		do
   1.500 +		for file in share/info share/man share/local; do
   1.501  			echo -n "Removing   : $file"
   1.502 -			rm -rf $tools/$file && status
   1.503 +			rm -rf $tools/$file; status
   1.504  		done
   1.505  		echo -n "Stripping  : shared libs and binaries"
   1.506 -		find $tools/bin -type f -exec strip -s '{}' 2>/dev/null \;
   1.507 -		find $tools/lib -name cc1* -exec strip -s '{}' 2>/dev/null \;
   1.508 -		find $tools/lib -name lto* -exec strip -s '{}' 2>/dev/null \;
   1.509 +		find $tools/bin -type f     -exec strip -s '{}' 2>/dev/null \;
   1.510 +		find $tools/lib -name cc1*  -exec strip -s '{}' 2>/dev/null \;
   1.511 +		find $tools/lib -name lto*  -exec strip -s '{}' 2>/dev/null \;
   1.512  		find $sysroot -name "*.so*" -exec ${TARGET}-strip -s '{}' 2>/dev/null \;
   1.513 -		sleep 1 && status
   1.514 -		echo -n "Tools size : " && du -sh $tools | awk '{print $1}' ;;
   1.515 +		sleep 1; status
   1.516 +		echo -n "Tools size : "; du -sh $tools | awk '{print $1}' ;;
   1.517 +
   1.518  	gen-prebuilt)
   1.519  		# Create a prebuilt cross toolchain tarball.
   1.520  		init_compile
   1.521 @@ -538,20 +589,21 @@
   1.522  		tarball="$package.tar.bz2"
   1.523  		cd /cross
   1.524  		mkdir -p $package/$ARCH || exit 1
   1.525 -		echo ""
   1.526 +		newline
   1.527  		echo -n "Copying $ARCH to: $package"
   1.528  		cp -a $ARCH/tools $package/$ARCH
   1.529  		cp -a $ARCH/sysroot $package/$ARCH
   1.530  		status
   1.531  		prebuilt_readme
   1.532  		echo -n "Creating prebuilt $ARCH toolchain tarball..."
   1.533 -		tar cjf $tarball $package
   1.534 +		tar -cjf $tarball $package
   1.535  		status
   1.536  		rm -rf $package
   1.537  		size=$(du -sh $tarball | awk '{print $1}')
   1.538  		echo "Tarball path: $(pwd)/$tarball"
   1.539  		echo "Tarball size: $size"
   1.540 -		echo "" ;;
   1.541 +		newline ;;
   1.542 +
   1.543  	*)
   1.544  		usage ;;
   1.545  esac