cookutils rev 371

cross: add clean-tools
author Christophe Lincoln <pankso@slitaz.org>
date Thu May 10 21:31:45 2012 +0200 (2012-05-10)
parents 0c0e4f64389a
children 6f26ad7a0786
files cross
line diff
     1.1 --- a/cross	Thu May 10 21:10:04 2012 +0200
     1.2 +++ b/cross	Thu May 10 21:31:45 2012 +0200
     1.3 @@ -22,7 +22,8 @@
     1.4    testsuite       Execute a small testsuite
     1.5    check-env       Check build host tools
     1.6    download        Download necessary sources
     1.7 -  clean           Clean-up environment
     1.8 +  clean           Clean-up build environment
     1.9 +  clean-tools     Clean: $PREFIX
    1.10    show-log        Show a compile log
    1.11    binutils        Compile Binutils
    1.12    gcc-static      Compile GCC static
    1.13 @@ -240,7 +241,11 @@
    1.14  		echo "To clean chroot: rm -rf $PREFIX" ;;
    1.15  	show-log)
    1.16  		pkg=$2
    1.17 -		less -E $logdir/$pkg.log ;;
    1.18 +		log=$logdir/$pkg.log
    1.19 +		if [ ! -f "$log" ]; then
    1.20 +			echo "No log file found for: $pkg" && exit 1
    1.21 +		fi
    1.22 +		less -E $log ;;
    1.23  	binutils)
    1.24  		init_compile
    1.25  		rm -f $logdir/binutils.log
    1.26 @@ -272,6 +277,24 @@
    1.27  		echo ""
    1.28  		echo "Compile end  : $(date)" | tee -a $logdir/compile.log
    1.29  		echo "" ;;
    1.30 +	clean-tools)
    1.31 +		# Remove crap :-)
    1.32 +		init_compile
    1.33 +		echo "Cleaning  : $PREFIX"
    1.34 +		for dir in info man locale
    1.35 +		do
    1.36 +			echo -n "Removing  : $dir"
    1.37 +			rm -rf $PREFIX/share && status
    1.38 +		done
    1.39 +		echo -n "Stripping : binaries"
    1.40 +		for bin in $PREFIX/bin/${TARGET}-*
    1.41 +		do
    1.42 +			[ "$bin" == "$PREFIX/bin/${TARGET}-strip" ] && continue
    1.43 +			if [ -x "$bin" ]; then
    1.44 +				${TARGET}-strip -s $bin 2>/dev/null
    1.45 +			fi
    1.46 +		done && status
    1.47 +		echo -n "Tools size: " && du -sh $PREFIX | awk '{print $1}' ;;
    1.48  	gen-rootfs)
    1.49  		#
    1.50  		# TESTING