From: hackbard Date: Fri, 13 May 2005 12:42:31 +0000 (+0000) Subject: major changes to improve toolchain and crossbuild concept, still in devel! X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=054c7ecaf04f6aa5157d2709d36e38b8ed2b2e28;p=hdw-linux%2Fhdw-linux.git major changes to improve toolchain and crossbuild concept, still in devel! --- diff --git a/Config b/Config index 9350fe0..2e9a7c4 100644 --- a/Config +++ b/Config @@ -7,7 +7,7 @@ # start -export hdw_version="0.3" # version of hdw-linux +export hdw_version="1.0" # version of hdw-linux export hdw_target="default" # which target to build # currently: @@ -28,25 +28,26 @@ export hdw_arch="ia32" # which architecture to build for # sparc - 32bit sparc # sparc64 - 64bit sparc # ppc - powerpc's + # mips - mips architctures -export hdw_arch_opt="i686" # choose optimization - # currently: ia32 : i[3-6]86 - # sparc64 : sparc_v9 - # sparc : sparc_v[7-8] - # ppc : "" (still in dev) +export hdw_arch_opt="" # choose optimization + # currently: ia32 : i386, i586, i686 ... + # sparc64 : v9, ultrasparc ... + # sparc : v7, v8, supersparc ... + # ppc : 603e, 604, 740 ... + # mips : r2k, r3k, r4k ... -export hdw_use_dietlibc="0" # 0: use gnu c library (glibc) - # 1: use dietlibc +export hdw_use_dietlibc="0" # 0: use gnu c library + # 1: use dietlibc (devel) export hdw_opt="3" # choose -O optimization value # default : 3 export hdw_crossbuild="0" # 0: native build - # 1: crossbuild - warning: devel! + # 1: crossbuild -export hdw_real_build="" # set real build arch in case hdw_crossbuild is - # set to 1 & the scripts guess wrong build arch - # (example: sparc64 with 32 bit userland) +export hdw_real_build="" # set real build arch + # uname output may not match available compiler export hdw_build_id="$hdw_target-$hdw_arch-$hdw_arch_opt-$hdw_version" # id diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 4c1523e..f7d6259 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -1,3 +1,7 @@ +*) 2005-05-13 + +- changes major scripts improving toolchain and crossbuild concept (devel) + *) 2005-05-03 - updated fontconfig package diff --git a/packages/base/binutils/binutils b/packages/base/binutils/binutils index ade55d3..c4e77f2 100644 --- a/packages/base/binutils/binutils +++ b/packages/base/binutils/binutils @@ -22,9 +22,10 @@ if [ "$priority" = "4" ] ; then rm -rf $root/tmp/src.binutils # show new linker to gcc + cr="" ; [ "$hdw_crossbuild" != "0" ] && cr=/${s1_prefix} SPECFILE="`gcc --print-file specs`" - sed -e "s@ /${s1_prefix}/lib/ld-linux.so.2@ /lib/ld-linux.so.2@g" \ - -e "s@ /${s1_prefix}/lib/ld.so.1@ /lib/ld.so.1@g" \ + sed -e "s@ /${s1_prefix}/lib/ld-linux.so.2@ $cr/lib/ld-linux.so.2@g" \ + -e "s@ /${s1_prefix}/lib/ld.so.1@ $cr/lib/ld.so.1@g" \ $SPECFILE > tempspecfile mv tempspecfile $SPECFILE unset SPECFILE diff --git a/packages/toolchain/binutils/binutils b/packages/toolchain/binutils/binutils index 08e3bc0..82ea44d 100644 --- a/packages/toolchain/binutils/binutils +++ b/packages/toolchain/binutils/binutils @@ -7,13 +7,11 @@ # [D] binutils-2.15.91.0.1.tar.bz2 http://ftp.kernel.org/pub/linux/devel/binutils/ if [ "$priority" = "1" ] ; then - confopt=${confopt//--host* /--host=$hdw_arch_build } confopt="$confopt --disable-nls" # use host system tools hdw_arch_prefix="" . ./scripts/optimization unset CFLAGS - make_conf="LDFLAGS=-all-static" libpath="$prefix/lib" fi @@ -27,7 +25,7 @@ if [ "$priority" = "4" ] ; then rm -rf $root/tmp/src.binutils # show new linker to gcc - SPECFILE=$prefix/lib/gcc-lib/*/*/specs && + SPECFILE="`gcc --print-file specs`" && sed -e "s@/lib/ld.so.1@$prefix/lib/ld.so.1@g" \ -e "s@/lib/ld-linux.so.2@$prefix/lib/ld-linux.so.2@g" \ $SPECFILE > tempspecfile @@ -40,23 +38,25 @@ fi if [ "$priority" = "5" ] ; then confopt="$confopt --enable-shared --with-lib-path=$prefix/lib" - make_conf="" - libpath="/usr/lib:/lib" + if [ "$hdw_crossbuild" = "0" ] ; then + libpath="/usr/lib:/lib" + else + libpath="$prefix/usr/lib:$prefix/lib" + fi fi build_main() { mkdir -p ../binutils-build cd ../binutils-build ../binutils-${ver}/configure $confopt && - [ "$priority" = "1" ] && make configure-host make $make_conf && - make install + make $install_conf install } post_install() { # linkers default library path (where our glibc will go) make -C ld clean - make -C ld $make_conf LIB_PATH=$libpath + make -C ld LIB_PATH=$libpath # __very__ ___ugly___ # store binutils tree to reinstall after glibc build cd $root && mkdir -p tmp diff --git a/scripts/Build b/scripts/Build index 1f8fbf2..41a2fa0 100755 --- a/scripts/Build +++ b/scripts/Build @@ -156,7 +156,7 @@ echo "found $package config file ..." fi # architecture specific stuff confopt="$confopt --build=$hdw_arch_build" - confopt="$confopt --host=$hdw_arch_target" + confopt="$confopt --host=$hdw_arch_host" # crosscompiling [ "$package" = "gcc" -o "$package" = "binutils" ] && \ confopt="$confopt --target=$hdw_arch_target" diff --git a/scripts/Config b/scripts/Config index 9e7d704..2804a19 100755 --- a/scripts/Config +++ b/scripts/Config @@ -48,8 +48,9 @@ else fi # lets see what root is: -[ "$hdw_status" = "2" -o "$hdw_status" = "3" ] && root="" -if [ "$hdw_status" -lt 2 -o "$hdw_crossbuild" != "0" ] ; then +root="" +if [ "$hdw_crossbuild" != "0" -a "$hdw_status" -lt "2" ] ; then + # check for properly configured build directory if [ -z "$hdw_build_dir" ] ; then echo "please set hdw_build_dir in ./Config!" exit 1 @@ -66,18 +67,33 @@ fi set +h umask 022 export LC_ALL=POSIX -[ "$hdw_status" -lt "2" ] && export PATH="$root/${s1_prefix}/bin:$PATH" +[ "$hdw_status" -lt "2" -o "$hdw_crossbuild" != "0" ] && \ + export PATH="$root/${s1_prefix}/bin:$PATH" # let's do optimization and care for crossbuilds -if [ ! -z "`uname --version | grep sh-utils`" ] ; then +# +# as gnu autoconf terminology has been confusing me again and again, +# there are a few comments following ;) +# +# ref: gcc docs - hardware models and configurations +# @ http://gcc.gnu.org/onlinedocs/ +# + +# --build: the system the actual executable is created on. uname will tell us. +# you may set hdw_real_build, or +# you may fake uname output using fake_utsname kernel module! +if [ -n "`uname --version | grep sh-utils`" ] ; then hdw_arch_build="`uname -m -p | tr " " -`-linux-gnu" else hdw_arch_build="`uname -m`-unknown-linux-gnu" fi +[ -n "$hdw_real_build" ] && hdw_arch_build="${hdw_real_build}-unknown-linux-gnu" + +# --target: the system for which the executable is going to produce code. case "$hdw_arch" in ia32) if [ -z "$hdw_arch_opt" ] ; then hdw_arch_target="i386-pc-linux-gnu" - elif [ ! -z "$hdw_arch_opt" ] ; then + else hdw_arch_target="${hdw_arch_opt}-pc-linux-gnu" hdw_cflags="-march=${hdw_arch_opt}" fi @@ -85,44 +101,45 @@ case "$hdw_arch" in sparc*) if [ -z "$hdw_arch_opt" ] ; then hdw_arch_target="$hdw_arch-unknown-linux-gnu" else - # hack this! :) - echo "pls hack sparc* opt. options and submit :)" - echo "no optimization used!" hdw_arch_target="$hdw_arch-unknown-linux-gnu" hdw_cflags="-march={hdw_arch_opt}" fi ;; ppc) hdw_arch_target="powerpc-unknown-linux-gnu" - [ ! -z "$hdw_arch_opt" ] && hdw_cflags="-march=${hdw_arch_opt}" + if [ -z "$hdw_arch_opt" ] ; then + hdw_cflags="-mcpu=common" + else + hdw_cflags="-mcpu=${hdw_arch_opt}" + fi hdw_arch_build=${hdw_arch_build//ppc/powerpc} ;; mips) hdw_arch_target="mips-unknown-linux-gnu" - [ ! -z "$hdw_arch_opt" ] && hdw_cflags="-march=${hdw_arch_opt}" - ;; - *) echo "not supported yet" + if [ -z "$hdw_arch_opt" ] ; then + echo "info: no optimization set" + else + hdw_cflags="-march=${hdw_arch_opt}" + fi ;; + *) echo "$hdw_arch_target not supported yet" echo "please choose a valid optimization and build platform." exit 1 ;; esac + +# --host: system where the created executable runs on. +hdw_arch_host=${hdw_arch_build} +[ "$hdw_status" != "0" ] && hdw_arch_host=${hdw_arch_target} + # -O flag -[ ! -z "$hdw_opt" ] && hdw_cflags="-O${hdw_opt} $hdw_cflags" +# optimization only at stages >= 1 +[ -n "$hdw_opt" ] && hdw_cflags="-O${hdw_opt} $hdw_cflags" # build tools to use -hdw_arch_prefix="" -if [ "$hdw_crossbuild" != "0" ] ; then - hdw_arch_prefix="$hdw_arch_target-" - if [ "$hdw_real_build" ] ; then - if [ "$hdw_arch" = "ia32" ] ; then - hdw_arch_build=${hdw_arch_build//$hdw_arch_opt/$hdw_real_build} - else - hdw_arch_build=${hdw_arch_build//$hdw_arch/$hdw_real_build} - fi - fi -fi -# test: actually we always use the compilers for target -# hdw_arch_prefix="$hdw_arch_target-" +# should be the same like host imho, right? +hdw_arch_prefix="$hdw_arch_host-" -# resume ... +# print decissions for debugging ... echo "hdw_arch_target variable set to $hdw_arch_target" echo "hdw_arch_build variable set to $hdw_arch_build" +echo "hdw_arch_host variable ste to $hdw_arch_host" +echo "hdw_arch_prefix variable set to $hdw_arch_prefix" echo "hdw_cflags variable set to $hdw_cflags" [ "$hdw_status" = "1" ] && echo "hdw_stage1_prefix set to '$s1_prefix'" diff --git a/scripts/optimization b/scripts/optimization index 016fb5e..59b595a 100755 --- a/scripts/optimization +++ b/scripts/optimization @@ -7,6 +7,7 @@ # the tools export CC="${hdw_arch_prefix}gcc" +export CPP="${hdw_arch_prefix}g++" export CXX="${hdw_arch_prefix}c++" export AS="${hdw_arch_prefix}as" export STRIP="${hdw_arch_prefix}strip" @@ -18,10 +19,9 @@ export NM="${hdw_arch_prefix}nm" export KCC="${hdw_arch_prefix}kcc" # flags - edit this at own risk -# export CPP export CFLAGS="${hdw_cflags}" -# export CPPFLAGS -# export CXXFLAGS +export CPPFLAGS="${hdw_cflags}" +export CXXFLAGS="${hdw_cflags}" # export ASFLAGS # export ARFLAGS # export LDFLAGS