cookutils rev 443
Some update to cook to use sysroot
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue May 29 09:10:12 2012 +0000 (2012-05-29) |
parents | 1be327c53ee7 |
children | 91b32bc2e34d |
files | cook cross |
line diff
1.1 --- a/cook Tue May 29 08:15:45 2012 +0000 1.2 +++ b/cook Tue May 29 09:10:12 2012 +0000 1.3 @@ -410,13 +410,16 @@ 1.4 case "$ARCH" in 1.5 arm|x86_64) 1.6 # CROSS_COMPILE is used by at least Busybox and the kernel to set 1.7 - # the cross-tools prefix but first check if sysroot is used. 1.8 - if [ "$SYSROOT" ]; then 1.9 - echo "$ARCH sysroot: $SYSROOT" 1.10 - else 1.11 - echo "Adding /usr/cross/$ARCH/bin to PATH" 1.12 - export PATH=$PATH:$CROSS_PREFIX/bin 1.13 - fi 1.14 + # the cross-tools prefix. Sysroot the the root of our target arch 1.15 + sysroot=$CROSS_TREE/sysroot 1.16 + tools=$CROSS_TREE/tools 1.17 + # Set root path when cross compiling. ARM tested but not x86_64 1.18 + # When cross compiling we must install build deps in $sysroot. 1.19 + arch="-${ARCH}" 1.20 + root=$sysroot 1.21 + echo "$ARCH sysroot: $sysroot" 1.22 + echo "Adding $tools/bin to PATH" 1.23 + export PATH=$PATH:$tools/bin 1.24 export CROSS_COMPILE=${HOST_SYSTEM}- 1.25 echo "Using cross-tools: $CROSS_COMPILE" 1.26 if [ "$ARCH" == "x86_64" ]; then 1.27 @@ -430,13 +433,7 @@ 1.28 export AS=${HOST_SYSTEM}-as 1.29 export RANLIB=${HOST_SYSTEM}-ranlib 1.30 export LD=${HOST_SYSTEM}-ld 1.31 - export STRIP=${HOST_SYSTEM}-strip 1.32 - # Set root path when cross compiling. ARM tested but not x86_64 1.33 - # When cross compiling we must install build deps in CROSS_PREFIX 1.34 - # or SYSROOT when it will be support by cross (the final goal is 1.35 - # to use only the sysroot method). 1.36 - root=$CROSS_PREFIX 1.37 - arch="-${ARCH}" ;; 1.38 + export STRIP=${HOST_SYSTEM}-strip ;; 1.39 esac 1.40 1.41 [ "$QA" ] && receipt_quality 1.42 @@ -773,7 +770,7 @@ 1.43 case "$ARCH" in 1.44 arm|x86_64) 1.45 arch="-${ARCH}" 1.46 - root=$CROSS_PREFIX ;; 1.47 + root=$CROSS_TREE/sysroot ;; 1.48 esac 1.49 # Install package if requested but skip install if target host doesn't 1.50 # match build system or it will break the build chroot. 1.51 @@ -940,17 +937,18 @@ 1.52 check_root 1.53 echo "Cook: setup $arch cross environment" | log 1.54 newline 1.55 - boldify $(gettext "Setting up your cross environment") 1.56 + boldify $(gettext "Setting up your $arch cross environment") 1.57 separator 1.58 init_db_files 1.59 sed -i \ 1.60 -e s"/ARCH=.*/ARCH=\"$arch\"/" \ 1.61 + -e s"/CROSS_TREE=.*/CROSS_TREE=\"\/cross\/$arch\"/" \ 1.62 -e s'/BUILD_SYSTEM=.*/BUILD_SYSTEM=i486-slitaz-linux/' \ 1.63 /etc/slitaz/cook.conf 1.64 case "$arch" in 1.65 arm) 1.66 sed -i \ 1.67 - -e s'/CFLAGS=.*/CFLAGS="-march=armv6"/' \ 1.68 + -e s'/CFLAGS=.*/CFLAGS="-march=armv6 -O2"/' \ 1.69 -e s'/HOST_SYSTEM=.*/HOST_SYSTEM=$ARCH-slitaz-linux-gnueabi/' \ 1.70 -e s'/xorg-dev/""/' \ 1.71 /etc/slitaz/cook.conf ;; 1.72 @@ -961,17 +959,14 @@ 1.73 /etc/slitaz/cook.conf ;; 1.74 esac 1.75 . /etc/slitaz/cook.conf 1.76 + sysroot=$CROSS_TREE/sysroot 1.77 + tools=/cross/$arch/tools 1.78 + root=$sysroot 1.79 + CC=$tools/bin/${HOST_SYSTEM}-gcc 1.80 echo "Target arch : $ARCH" 1.81 echo "Configure args : $CONFIGURE_ARGS" 1.82 - if [ "$SYSROOT" ]; then 1.83 - echo "Arch sysroot : $SYSROOT" 1.84 - CC=/usr/bin/${HOST_SYSTEM}-gcc 1.85 - root=$SYSROOT 1.86 - else 1.87 - echo "Additional path : $CROSS_PREFIX/bin" 1.88 - CC=$CROSS_PREFIX/bin/${HOST_SYSTEM}-gcc 1.89 - root=$CROSS_PREFIX 1.90 - fi 1.91 + echo "Arch sysroot : $sysroot" 1.92 + echo "Tools prefix : $tools/bin" 1.93 # Tell the packages manager wher to find packages. 1.94 echo "Packages DB : ${root}$DB" 1.95 mkdir -p ${root}$INSTALLED 1.96 @@ -984,16 +979,7 @@ 1.97 # i486 package will be used as dep by tazpkg and then break the 1.98 # cross environment 1.99 if [ ! -f "${root}$INSTALLED/glibc-base/receipt" ]; then 1.100 - . /etc/slitaz/cross.conf 1.101 - if [ ! -f "$PKGS/glibc-base-$GLIBC_VERSION-$ARCH.tazpkg" ]; then 1.102 - echo -n "WARNING: cook glibc-base for $ARCH then run again:" 1.103 - echo "$(basename $0) $ARCH-setup" 1.104 - else 1.105 - echo "Installing : glibc-base-$GLIBC_VERSION-$ARCH.tazpkg" 1.106 - tazpkg install \ 1.107 - $PKGS/glibc-base-$GLIBC_VERSION-$ARCH.tazpkg \ 1.108 - --root=$root >/dev/null 1.109 - fi 1.110 + colorize 36 "WARNING: (e)glibc-base is not installed in sysroot" 1.111 fi 1.112 # Show GCC version or warn if not yet compiled. 1.113 if [ -x $CC ]; then
2.1 --- a/cross Tue May 29 08:15:45 2012 +0000 2.2 +++ b/cross Tue May 29 09:10:12 2012 +0000 2.3 @@ -397,28 +397,30 @@ 2.4 # Remove crap :-) 2.5 init_compile 2.6 echo "Cleaning : $tools ($(du -sh $tools | awk '{print $1}'))" 2.7 - for file in share/info share/man share/local lib/*-gdb.py 2.8 + for file in share/info share/man share/local 2.9 do 2.10 echo -n "Removing : $file" 2.11 rm -rf $tools/$file && status 2.12 done 2.13 echo -n "Stripping : shared libs and binaries" 2.14 - ${TARGET}-strip -s $sysroot/lib/*.so* 2>/dev/null 2.15 - strip -s $tools/bin/* 2>/dev/null 2.16 + find $tools/bin -type f -exec strip -s '{}' 2>/dev/null \; 2.17 + find $tools/lib -name cc1* -exec strip -s '{}' 2>/dev/null \; 2.18 + find $tools/lib -name lto* -exec strip -s '{}' 2>/dev/null \; 2.19 + #find $sysroot -name "*.so*" -exec ${TARGET}-strip -s '{}' 2>/dev/null \; 2.20 sleep 1 && status 2.21 echo -n "Tools size : " && du -sh $tools | awk '{print $1}' ;; 2.22 gen-prebuilt) 2.23 # Create a prebuilt cross toolchain tarball. 2.24 init_compile 2.25 date=$(date "+%Y%m%d") 2.26 - package="slitaz-cross-$ARCH-toolchain-$date" 2.27 + package="slitaz-$ARCH-toolchain-$date" 2.28 tarball="$package.tar.bz2" 2.29 cd /cross 2.30 - mkdir $package || exit 1 2.31 + mkdir -p $package/$ARCH || exit 1 2.32 echo "" 2.33 echo -n "Copying $ARCH to: $package" 2.34 - cp -a $ARCH $package 2.35 - rm -rf $package/source $package/log 2.36 + cp -a $ARCH/tools $package/$ARCH 2.37 + cp -a $ARCH/sysroot $package/$ARCH 2.38 status 2.39 prebuilt_readme 2.40 echo -n "Creating prebuilt $ARCH toolchain tarball..."