#! /usr/bin/env bash # Builds a cross toolchain for distcc usage on Xilka systems set -e if (( $# < 1 )); then echo "Usage: $0 armv7l|armv7lhf|armv6zkhf|armv6lhf|armv5tel" exit 1 fi if [[ $1 != armv7l ]] && [[ $1 != armv7lhf ]] \ && [[ $1 != armv6lhf ]] && [[ $1 != armv6zkhf ]] \ && [[ $1 != armv5tel ]]; then echo "Only armv7l, armv7lhf, armv6zkhf, armv6lhf and armv5tel are supported currently" exit 1 fi function GetBaseArch() { local target="$1" case $target in armv5tel) echo "armv5tel" ;; armv6zkhf) echo "armv6zk" ;; armv6lhf) echo "armv6l" ;; armv7lhf) echo "armv7l" ;; armv7l) echo "armv7l" ;; *) echo "$target" ;; esac } function GetCpuMode() { local target="$1" case $target in armv5tel) echo "--with-arch=armv5te" ;; armv6zkhf) echo "--with-arch=armv6zk --with-tune=arm1176jzf-s --with-float=hard --with-fpu=vfp" ;; armv6lhf) echo "--with-arch=armv6l --with-float=hard --with-fpu=vfp" ;; armv7lhf) echo "--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16 --with-mode=thumb" ;; armv7l) echo "--with-arch=armv7-a --with-float=softfp --with-fpu=vfpv3-d16 --with-mode=thumb" ;; esac } Target="$1" localArch=$(uname -m) linaroVer='4.7-2013.03' binutilsVer='2.23.2' newlibVer='1.20.0' ver="$linaroVer" nativePath="/usr/bin:/opt/texlive/texmf/bin" orgDir=$PWD hostString="$localArch-xilka-linux-gnu" hostCc="$hostString-gcc" hostCxx="$hostString-g++" hostAr='ar' hostRanlib='ranlib' csVer='2012.09-63' bigArcChecksum="b3671f2536f8db94ade739927e01a2c7" abi='gnueabi' if [[ $Target == *hf ]]; then abi='gnueabihf' fi ane="$(GetBaseArch $Target)-xilka-linux-$abi" scratch="/var/tmp/CrossArm-$ver" respin="$scratch/respin" bigArc="arm-$csVer-arm-none-eabi.src.tar.bz2" #codeSourcery="http://www.codesourcery.com/public/gnu_toolchain/arm-none-eabi" codeSourcery="http://sourcery.mentor.com/public/gnu_toolchain/arm-none-eabi" hostPrefix="$respin/out/host-libs/usr" xilkaPatches=" Gcc-4.5-no-fixincludes.patch Gcc-4.6.1-libpwl.patch Gcc-4.6.2-fix-err_bad_typedef.patch gcc-4.7.1-cloog-0.17.patch Gcc-4.7.X-arm-no-va_list-mangle-warning.patch Gcc-4.7.2-LibPpl-0.12.patch Gcc-4.7.2-LibPpl-0.12-2.patch Gcc-4.7.2-CLooG-0.18.patch 0001-ARM-code-generic-change-linaro-4.7.patch 0002-intrinsic-head-file-change.patch 0003-built-in-define-and-expand.patch 0004-WMMX-machine-description.patch 0005-pipeline-description.patch" for p in $xilkaPatches; do [[ $p != 000* ]] || continue [[ -f $p ]] || wget "http://www.xilka.com/xilka/source/patches/$p" done makejobs=$(grep -Ec "^cpu[0-9]+" /proc/stat || :) if ! grep -qs QEMU /proc/cpuinfo; then (( makejobs *= 2 )) else (( makejobs++ )) # use fewer jobs on QEMU fi makej="make -j$makejobs" inform_fd=2 umask 022 exec < /dev/null error_handler () { exit 1 } check_status() { local status="$?" if [ "$status" -ne 0 ]; then error_handler fi } check_pipe() { local -a status=("${PIPESTATUS[@]}") local limit=$1 local ix if [ -z "$limit" ] ; then limit="${#status[@]}" fi for ((ix=0; ix != $limit ; ix++)); do if [ "${status[$ix]}" != "0" ] ; then error_handler fi done } error () { echo "$script: error: $@" >& $inform_fd exit 1 } warning () { echo "$script: warning: $@" >& $inform_fd } verbose () { if $gnu_verbose; then echo "$script: $@" >& $inform_fd fi } copy_dir() { mkdir -p "$2" (cd "$1" && tar cf - .) | (cd "$2" && tar xf -) check_pipe } copy_dir_clean() { mkdir -p "$2" (cd "$1" && tar cf - \ --exclude=CVS --exclude=.svn --exclude=.git --exclude=.pc \ --exclude="*~" --exclude=".#*" \ --exclude="*.orig" --exclude="*.rej" \ .) | (cd "$2" && tar xf -) check_pipe } update_dir_clean() { mkdir -p "$2" (cd "$1" && tar cf - \ --exclude=CVS --exclude=.svn --exclude=.git --exclude=.pc \ --exclude="*~" --exclude=".#*" \ --exclude="*.orig" --exclude="*.rej" \ --after-date="$3" \ . 2> /dev/null) | (cd "$2" && tar xf -) check_pipe } copy_dir_exclude() { local source="$1" local dest="$2" local excl="$3" shift 3 mkdir -p "$dest" (cd "$source" && tar cfX - "$excl" "$@") | (cd "$dest" && tar xf -) check_pipe } copy_dir_only() { local source="$1" local dest="$2" shift 2 mkdir -p "$dest" (cd "$source" && tar cf - "$@") | (cd "$dest" && tar xf -) check_pipe } clean_environment() { local env_var_list local var unset BASH_ENV CDPATH POSIXLY_CORRECT TMOUT env_var_list=$(export | \ grep '^declare -x ' | \ sed -e 's/^declare -x //' -e 's/=.*//') for var in $env_var_list; do case $var in HOME|HOSTNAME|LOGNAME|PWD|SHELL|SHLVL|SSH_*|TERM|USER) ;; LD_LIBRARY_PATH|PATH| \ FLEXLM_NO_CKOUT_INSTALL_LIC|LM_APP_DISABLE_CACHE_READ) ;; MAKEINFO) ;; *_LICENSE_FILE) if [ "" ]; then local license_file_envvar license_file_envvar= if [ "$var" != "$license_file_envvar" ]; then export -n "$var" || true fi else export -n "$var" || true fi ;; *) export -n "$var" || true ;; esac done export LANG=C export LC_ALL=C export CVS_RSH=ssh user_shell=$SHELL export SHELL=$BASH export CONFIG_SHELL=$BASH } pushenv() { pushenv_level=$(($pushenv_level + 1)) eval pushenv_vars_${pushenv_level}= } pushenv_level=0 pushenv_vars_0= pushenvvar() { local pushenv_var="$1" local pushenv_newval="$2" eval local pushenv_oldval=\"\$$pushenv_var\" eval local pushenv_oldset=\"\${$pushenv_var+set}\" local pushenv_save_var=saved_${pushenv_level}_${pushenv_var} local pushenv_savep_var=savedp_${pushenv_level}_${pushenv_var} eval local pushenv_save_set=\"\${$pushenv_savep_var+set}\" if [ "$pushenv_save_set" = "set" ]; then error "Pushing $pushenv_var more than once at level $pushenv_level" fi if [ "$pushenv_oldset" = "set" ]; then eval $pushenv_save_var=\"\$pushenv_oldval\" else unset $pushenv_save_var fi eval $pushenv_savep_var=1 eval export $pushenv_var=\"\$pushenv_newval\" local pushenv_list_var=pushenv_vars_${pushenv_level} eval $pushenv_list_var=\"\$$pushenv_list_var \$pushenv_var\" } prependenvvar() { local pushenv_var="$1" local pushenv_newval="$2" eval local pushenv_oldval=\"\$$pushenv_var\" pushenvvar "$pushenv_var" "$pushenv_newval$pushenv_oldval" } popenv() { local pushenv_var= eval local pushenv_vars=\"\$pushenv_vars_${pushenv_level}\" for pushenv_var in $pushenv_vars; do local pushenv_save_var=saved_${pushenv_level}_${pushenv_var} local pushenv_savep_var=savedp_${pushenv_level}_${pushenv_var} eval local pushenv_save_val=\"\$$pushenv_save_var\" eval local pushenv_save_set=\"\${$pushenv_save_var+set}\" unset $pushenv_save_var unset $pushenv_savep_var if [ "$pushenv_save_set" = "set" ]; then eval export $pushenv_var=\"\$pushenv_save_val\" else unset $pushenv_var fi done unset pushenv_vars_${pushenv_level} if [ "$pushenv_level" = "0" ]; then error "Popping environment level 0" else pushenv_level=$(($pushenv_level - 1)) fi } prepend_path() { if $(eval "test -n \"\$$1\""); then prependenvvar "$1" "$2:" else prependenvvar "$1" "$2" fi } pushenvvar PATH $nativePath pushenvvar MAKEINFO 'makeinfo --css-ref=../cs.css' clean_environment echo task [001/059] /init/dirs pushenv pushenvvar CC_FOR_BUILD $hostCc # start from scratch mkdir -p $scratch/arc if [[ ! -f $bigArc ]]; then wget -c $codeSourcery/$bigArc fi if [[ ! -f $bigArc ]]; then wget -c $codeSourcery/$bigArc fi if [[ $(md5sum $bigArc | cut -d' ' -f1) != $bigArcChecksum ]]; then echo "md5sum of $bigArc doesn't match" exit 1 fi if [[ ! -f gcc-linaro-$linaroVer.tar.bz2 ]]; then wget -c http://launchpad.net/gcc-linaro/4.7/$linaroVer/+download/gcc-linaro-$linaroVer.tar.bz2 fi if [[ ! -f binutils-$binutilsVer.tar.gz ]] && [[ ! -f binutils-$binutilsVer.tar.bz2 ]]; then wget -c http://ftp.gnu.org/gnu/binutils/binutils-$binutilsVer.tar.gz || \ wget -c ftp://sourceware.org/pub/binutils/snapshots/binutils-$binutilsVer.tar.bz2 fi if [[ ! -f newlib-$newlibVer.tar.gz ]]; then wget -c ftp://sources.redhat.com/pub/newlib/newlib-$newlibVer.tar.gz fi cp -a gcc-linaro-$linaroVer.tar.bz2 $scratch/arc cp -a Gcc-4.5-no-fixincludes.patch $scratch/arc cp -a Gcc-4.6.1-libpwl.patch $scratch/arc cp -a Gcc-4.6.2-fix-err_bad_typedef.patch $scratch/arc cp -a gcc-4.7.1-cloog-0.17.patch $scratch/arc cp -a Gcc-4.7.X-arm-no-va_list-mangle-warning.patch $scratch/arc cp -a Gcc-4.7.2-LibPpl-0.12.patch $scratch/arc cp -a Gcc-4.7.2-LibPpl-0.12-2.patch $scratch/arc cp -a Gcc-4.7.2-CLooG-0.18.patch $scratch/arc if false; then cp -a 0001-ARM-code-generic-change-linaro-4.7.patch $scratch/arc cp -a 0002-intrinsic-head-file-change.patch $scratch/arc cp -a 0003-built-in-define-and-expand.patch $scratch/arc cp -a 0004-WMMX-machine-description.patch $scratch/arc cp -a 0005-pipeline-description.patch $scratch/arc fi cp -a binutils-$binutilsVer.tar.* $scratch/arc cp -a newlib-$newlibVer.tar.gz $scratch/arc if [[ ! -f $scratch/arc/zlib-$csVer.tar.bz2 ]]; then pushd $scratch tar x --strip-components=1 -f $orgDir/$bigArc mv *.tar.bz2 *.sh arc popd fi # clean out prior run rm -rf $respin/{install,logs,obj,out,pkg} # make necessary directories mkdir -p $respin/src mkdir -p $respin/install/share/doc/arm-$ane/{html,pdf} mkdir -p $respin/logs/data mkdir -p $respin/obj mkdir -p $respin/pkg pushd $respin/src [[ -d binutils ]] || (tar xf $scratch/arc/binutils-$binutilsVer.tar.* && mv binutils-* binutils) [[ -d newlib ]] || (tar xf $scratch/arc/newlib-$newlibVer.tar.gz && mv newlib-* newlib) [[ -d expat ]] || (tar xf $scratch/arc/expat-$csVer.tar.bz2 && mv expat-* expat) [[ -d gdb ]] || (tar xf $scratch/arc/gdb-$csVer.tar.bz2 && mv gdb-* gdb) if ! [[ -d gcc ]]; then tar xf $scratch/arc/gcc-linaro-$linaroVer.tar.bz2 mv gcc-* gcc pushd gcc for p in Gcc-4.5-no-fixincludes.patch Gcc-4.6.1-libpwl.patch \ Gcc-4.6.2-fix-err_bad_typedef.patch gcc-4.7.1-cloog-0.17.patch \ Gcc-4.7.X-arm-no-va_list-mangle-warning.patch \ Gcc-4.7.2-LibPpl-0.12.patch \ Gcc-4.7.2-LibPpl-0.12-2.patch \ Gcc-4.7.2-CLooG-0.18.patch \ $(cd $scratch/arc && ls ????-*.patch); do echo "Applying $p" patch -p1 -i $scratch/arc/$p done popd fi popd popenv echo task [030/059] /$hostString/toolchain/binutils/copy pushenv pushenvvar CC_FOR_BUILD $hostCc pushenvvar CC $hostCc pushenvvar CXX $hostCxx pushenvvar AR $hostAr pushenvvar RANLIB $hostRanlib prepend_path PATH $respin/install/bin pushenv pushenv pushenvvar CPPFLAGS -I$hostPrefix/include pushenvvar LDFLAGS -L$hostPrefix/lib rm -rf $respin/obj/binutils-src copy_dir_clean $respin/src/binutils $respin/obj/binutils-src chmod -R u+w $respin/obj/binutils-src touch $respin/obj/binutils-src/.gnu-stamp popenv popenv popenv echo task [031/059] /$hostString/toolchain/binutils/configure pushenv pushenvvar CC_FOR_BUILD $hostCc pushenvvar CC $hostCc pushenvvar CXX $hostCxx pushenvvar AR $hostAr pushenvvar RANLIB $hostRanlib prepend_path PATH $respin/install/bin pushenv pushenv pushenvvar CPPFLAGS -I$hostPrefix/include pushenvvar LDFLAGS -L$hostPrefix/lib rm -rf $respin/obj/binutils mkdir -p $respin/obj/binutils pushd $respin/obj/binutils $respin/obj/binutils-src/configure \ --build=$hostString \ --host=$hostString \ --target=$ane \ --prefix=/opt/cross/$Target \ --enable-cloog-backend=isl \ --disable-cloog-version-check \ --enable-gold \ --disable-nls \ --with-sysroot=/opt/cross/$Target/sysroot \ --disable-werror \ --enable-poison-system-directories popd popenv popenv popenv echo task [032/059] /$hostString/toolchain/binutils/build pushenv pushenvvar CC_FOR_BUILD $hostCc pushenvvar CC $hostCc pushenvvar CXX $hostCxx pushenvvar AR $hostAr pushenvvar RANLIB $hostRanlib prepend_path PATH $respin/install/bin pushenv pushenv pushenvvar CPPFLAGS -I$hostPrefix/include pushenvvar LDFLAGS -L$hostPrefix/lib pushd $respin/obj/binutils $makej popd popenv popenv popenv echo task [033/059] /$hostString/toolchain/binutils/install pushenv pushenvvar CC_FOR_BUILD $hostCc pushenvvar CC $hostCc pushenvvar CXX $hostCxx pushenvvar AR $hostAr pushenvvar RANLIB $hostRanlib prepend_path PATH $respin/install/bin pushenv pushenv pushenvvar CPPFLAGS -I$hostPrefix/include pushenvvar LDFLAGS -L$hostPrefix/lib pushd $respin/obj/binutils make install prefix=$respin/install exec_prefix=$respin/install \ libdir=$respin/install/lib \ htmldir=$respin/install/share/doc/arm-$ane/html \ pdfdir=$respin/install/share/doc/arm-$ane/pdf \ infodir=$respin/install/share/doc/arm-$ane/info \ mandir=$respin/install/share/doc/arm-$ane/man \ datadir=$respin/install/share popd popenv popenv popenv echo task [034/059] /$hostString/toolchain/binutils/postinstall pushenv pushenvvar CC_FOR_BUILD $hostCc pushenvvar CC $hostCc pushenvvar CXX $hostCxx pushenvvar AR $hostAr pushenvvar RANLIB $hostRanlib prepend_path PATH $respin/install/bin pushenv pushenv pushenvvar CPPFLAGS -I$hostPrefix/include pushenvvar LDFLAGS -L$hostPrefix/lib pushd $respin/install [[ ! -f ./lib64/libiberty.a ]] || rm ./lib64/libiberty.a [[ ! -f ./lib/libiberty.a ]] || rm ./lib/libiberty.a [[ ! -d ./lib64 ]] || rmdir ./lib64 [[ ! -d ./lib ]] || rmdir ./lib popd copy_dir_clean $respin/src/binutils/include $respin/out/host-binutils/usr/include chmod -R u+w $respin/out/host-binutils/usr/include mkdir -p $respin/out/host-binutils/usr/lib cp $respin/obj/binutils/libiberty/libiberty.a $respin/out/host-binutils/usr/lib cp $respin/obj/binutils/bfd/.libs/libbfd.a $respin/out/host-binutils/usr/lib cp $respin/obj/binutils/bfd/bfd.h $respin/out/host-binutils/usr/include cp $respin/src/binutils/bfd/elf-bfd.h $respin/out/host-binutils/usr/include cp $respin/obj/binutils/opcodes/.libs/libopcodes.a $respin/out/host-binutils/usr/lib popenv popenv popenv #rm -f $respin/install/$ane/usr mkdir -p $respin/install/$ane/{,usr/}lib rm -rf $respin/install/$ane/{,usr/}lib/* if [[ $Target == armv5* ]]; then cp -a ~/source/src/CrossArm/root/$Target/lib/libc-2*.so $respin/install/$ane/lib cp -a ~/source/src/CrossArm/root/$Target/lib/libc.so* $respin/install/$ane/lib cp -a ~/source/src/CrossArm/root/$Target/usr/lib/libc.so $respin/install/$ane/usr/lib else cp -a ~/source/src/CrossArm/root/$Target/usr/lib/libc-2*.so $respin/install/$ane/usr/lib cp -a ~/source/src/CrossArm/root/$Target/usr/lib/libc.so* $respin/install/$ane/usr/lib fi mkdir -p $respin/install/$ane/usr/include rm -rf $respin/install/$ane/usr/include/* cp -a ~/source/src/CrossArm/root/$Target/usr/include/* $respin/install/$ane/usr/include echo task [035/059] /$hostString/toolchain/gcc_first/configure pushenv pushenvvar CC_FOR_BUILD $hostCc pushenvvar CC $hostCc pushenvvar CXX $hostCxx pushenvvar AR $hostAr pushenvvar RANLIB $hostRanlib prepend_path PATH $respin/install/bin pushenv pushenvvar AR_FOR_TARGET $ane-ar pushenvvar NM_FOR_TARGET $ane-nm pushenvvar OBJDUMP_FOR_TARET $ane-objdump pushenvvar STRIP_FOR_TARGET $ane-strip rm -rf $respin/obj/gccFirst mkdir -p $respin/obj/gccFirst pushd $respin/obj/gccFirst # --with-specs='%{save-temps: -fverbose-asm} -D__CS_SOURCERYGXX_MAJ__=2010 -D__CS_SOURCERYGXX_MIN__=9 -D__CS_SOURCERYGXX_REV__=51 %{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}' \ $respin/src/gcc/configure \ --build=$hostString \ --host=$hostString \ --target=$ane \ $(GetCpuMode $Target) \ --enable-extra-sgxxlite-multilibs \ --with-gnu-as \ --with-gnu-ld \ --enable-lto \ --disable-nls \ --prefix=/opt/cross/$Target \ --disable-shared \ --disable-threads \ --disable-libstdcxx-pch \ --disable-libquadmath \ --disable-libmudflap \ --disable-libssp \ --disable-libgomp \ --without-headers \ --disable-decimal-float \ --disable-libffi \ --enable-languages=c \ --with-sysroot=/opt/cross/$Target/sysroot \ --with-build-sysroot="$respin/install/$ane" \ --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' \ --disable-libgomp --enable-poison-system-directories \ --with-build-time-tools="$respin/install/$ane/bin" \ --with-build-time-tools="$respin/install/$ane/bin" popd popenv popenv echo task [036/059] /$hostString/toolchain/gcc_first/build pushenv pushenvvar CC_FOR_BUILD $hostCc pushenvvar CC $hostCc pushenvvar CXX $hostCxx pushenvvar AR $hostAr pushenvvar RANLIB $hostRanlib prepend_path PATH $respin/install/bin pushenv pushenvvar AR_FOR_TARGET $ane-ar pushenvvar NM_FOR_TARGET $ane-nm pushenvvar OBJDUMP_FOR_TARET $ane-objdump pushenvvar STRIP_FOR_TARGET $ane-strip pushd $respin/obj/gccFirst $makej LDFLAGS_FOR_TARGET=--sysroot=$respin/install/$ane \ CPPFLAGS_FOR_TARGET=--sysroot=$respin/install/$ane \ build_tooldir=$respin/install/$ane popd popenv popenv echo task [037/059] /$hostString/toolchain/gcc_first/install pushenv pushenvvar CC_FOR_BUILD $hostCc pushenvvar CC $hostCc pushenvvar CXX $hostCxx pushenvvar AR $hostAr pushenvvar RANLIB $hostRanlib prepend_path PATH $respin/install/bin pushenv pushenvvar AR_FOR_TARGET $ane-ar pushenvvar NM_FOR_TARGET $ane-nm pushenvvar OBJDUMP_FOR_TARET $ane-objdump pushenvvar STRIP_FOR_TARGET $ane-strip pushd $respin/obj/gccFirst make prefix=$respin/install \ exec_prefix=$respin/install \ libdir=$respin/install/lib \ htmldir=$respin/install/share/doc/arm-$ane/html \ pdfdir=$respin/install/share/doc/arm-$ane/pdf \ infodir=$respin/install/share/doc/arm-$ane/info \ mandir=$respin/install/share/doc/arm-$ane/man install popd popenv popenv echo task [038/059] /$hostString/toolchain/gcc_first/postinstall pushenv pushenvvar CC_FOR_BUILD $hostCc pushenvvar CC $hostCc pushenvvar CXX $hostCxx pushenvvar AR $hostAr pushenvvar RANLIB $hostRanlib prepend_path PATH $respin/install/bin pushenv pushenvvar AR_FOR_TARGET $ane-ar pushenvvar NM_FOR_TARGET $ane-nm pushenvvar OBJDUMP_FOR_TARET $ane-objdump pushenvvar STRIP_FOR_TARGET $ane-strip pushd $respin/install [[ ! -f bin/$ane-gccbug ]] || rm bin/$ane-gccbug [[ ! -f ./lib64/libiberty.a ]] || rm ./lib64/libiberty.a [[ ! -f ./lib/libiberty.a ]] || rm ./lib/libiberty.a rmdir include popd popenv popenv echo task [043/059] /$hostString/toolchain/gcc_final/configure pushenv pushenvvar CC_FOR_BUILD $hostCc pushenvvar CC $hostCc pushenvvar CXX $hostCxx pushenvvar AR $hostAr pushenvvar RANLIB $hostRanlib prepend_path PATH $respin/install/bin pushenv pushenvvar AR_FOR_TARGET $ane-ar pushenvvar NM_FOR_TARGET $ane-nm pushenvvar OBJDUMP_FOR_TARET $ane-objdump pushenvvar STRIP_FOR_TARGET $ane-strip #rm -rf $respin/install/$ane/usr #ln -s . $respin/install/$ane/usr rm -rf $respin/obj/gcc mkdir -p $respin/obj/gcc pushd $respin/obj/gcc #--with-specs='%{save-temps: -fverbose-asm} -D__CS_SOURCERYGXX_MAJ__=2010 -D__CS_SOURCERYGXX_MIN__=9 -D__CS_SOURCERYGXX_REV__=51 %{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}' \ $respin/src/gcc/configure \ --build=$hostString \ --host=$hostString \ --target=$ane \ $(GetCpuMode $Target) \ --enable-extra-sgxxlite-multilibs \ --enable-threads \ --disable-libmudflap \ --disable-libgomp \ --disable-libssp \ --disable-libstdcxx-pch \ --disable-libquadmath \ --with-gnu-as \ --with-gnu-ld \ --enable-languages=c,c++ \ --enable-gold \ --disable-shared \ --enable-lto \ --disable-nls \ --prefix=/opt/cross/$Target \ --with-headers=yes \ --with-sysroot=/opt/cross/$Target/sysroot \ --with-build-sysroot="$respin/install/$ane" \ --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' \ --enable-poison-system-directories \ --with-build-time-tools="$respin/install/$ane/bin" popd popenv popenv echo task [044/059] /$hostString/toolchain/gcc_final/build pushenv pushenvvar CC_FOR_BUILD $hostCc pushenvvar CC $hostCc pushenvvar CXX $hostCxx pushenvvar AR $hostAr pushenvvar RANLIB $hostRanlib prepend_path PATH $respin/install/bin pushenv pushenvvar AR_FOR_TARGET $ane-ar pushenvvar NM_FOR_TARGET $ane-nm pushenvvar OBJDUMP_FOR_TARET $ane-objdump pushenvvar STRIP_FOR_TARGET $ane-strip #rm -f $respin/install/$ane/usr #ln -s . $respin/install/$ane/usr pushd $respin/obj/gcc for t in all-gcc all-target-libgcc; do if ! $makej LDFLAGS_FOR_TARGET=--sysroot=$respin/install/$ane \ CPPFLAGS_FOR_TARGET=--sysroot=$respin/install/$ane \ build_tooldir=$respin/install/$ane $t; then echo "044 failed" exit 1 fi done popd popenv popenv echo task [045/059] /$hostString/toolchain/gcc_final/install pushenv pushenvvar CC_FOR_BUILD $hostCc pushenvvar CC $hostCc pushenvvar CXX $hostCxx pushenvvar AR $hostAr pushenvvar RANLIB $hostRanlib prepend_path PATH $respin/install/bin pushenv pushenvvar AR_FOR_TARGET $ane-ar pushenvvar NM_FOR_TARGET $ane-nm pushenvvar OBJDUMP_FOR_TARET $ane-objdump pushenvvar STRIP_FOR_TARGET $ane-strip #rm -f $respin/install/$ane/usr #ln -s . $respin/install/$ane/usr pushd $respin/obj/gcc mkdir -p $respin/install/$ane/usr/include for t in install-gcc install-target-libgcc; do if ! make prefix=$respin/install exec_prefix=$respin/install \ libdir=$respin/install/lib \ htmldir=$respin/install/share/doc/arm-$ane/html \ pdfdir=$respin/install/share/doc/arm-$ane/pdf \ infodir=$respin/install/share/doc/arm-$ane/info \ mandir=$respin/install/share/doc/arm-$ane/man $t; then echo "045 failed" exit 1 fi done popd popenv popenv echo task [046/059] /$hostString/toolchain/gcc_final/postinstall pushenv pushenvvar CC_FOR_BUILD $hostCc pushenvvar CC $hostCc pushenvvar CXX $hostCxx pushenvvar AR $hostAr pushenvvar RANLIB $hostRanlib prepend_path PATH $respin/install/bin pushenv pushenvvar AR_FOR_TARGET $ane-ar pushenvvar NM_FOR_TARGET $ane-nm pushenvvar OBJDUMP_FOR_TARET $ane-objdump pushenvvar STRIP_FOR_TARGET $ane-strip pushd $respin/install [[ ! -f bin/$ane-gccbug ]] || rm bin/$ane-gccbug [[ ! -f ./lib64/libiberty.a ]] || rm ./lib64/libiberty.a [[ ! -f ./lib/libiberty.a ]] || rm ./lib/libiberty.a rm -f ./$ane/lib/libiberty.a rm -f ./$ane/lib/thumb2/libiberty.a rm -f ./$ane/lib/thumb/libiberty.a rm -f ./$ane/lib/armv6-m/libiberty.a #rmdir include popd #rm -f $respin/install/$ane/usr popenv popenv echo task [059/059] /$hostString/createarchive pushd $respin/install/bin rm $ane-gcc $ane-c++ ln -s $ane-gcc-4* $ane-gcc ln -s $ane-g++ $ane-c++ pushd .. mkdir -p $scratch/opt/cross/$Target cp -a * $scratch/opt/cross/$Target rm -rf $scratch/opt/cross/$Target/{info,lib64,man,share} rm -rf $scratch/opt/cross/$Target/$Target-xilka-linux-$abi/usr/include pushd $scratch tar cJf CrossArm-$hostString-$ane-$ver.tar.xz opt rm -rf $scratch/opt mv CrossArm-$hostString-$ane-$ver.tar.xz $orgDir popd popd popd echo echo "*************************************************************************" echo "Finished building CrossArm-$hostString-$ane-$ver.tar.bz2" echo "*************************************************************************"