]> hackdaworld.org Git - hdw-linux/hdw-linux.git/commitdiff
major changes to improve toolchain and crossbuild concept, still in devel!
authorhackbard <hackbard>
Fri, 13 May 2005 12:42:31 +0000 (12:42 +0000)
committerhackbard <hackbard>
Fri, 13 May 2005 12:42:31 +0000 (12:42 +0000)
Config
doc/CHANGELOG
packages/base/binutils/binutils
packages/toolchain/binutils/binutils
scripts/Build
scripts/Config
scripts/optimization

diff --git a/Config b/Config
index 9350fe099955eda3a7c3bd989f3e3811daf4f179..2e9a7c495797c461c1c9fbf8c3b5ea3887ae6f9e 100644 (file)
--- 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
 
index 4c1523eb219eb247fadd17c68d0eea8febda5602..f7d6259d5505b6d5c75b659850607aef59e8ec3f 100644 (file)
@@ -1,3 +1,7 @@
+*) 2005-05-13
+
+- changes major scripts improving toolchain and crossbuild concept (devel)
+
 *) 2005-05-03
 
 - updated fontconfig package
index ade55d3508a050f39d6dcbbe0618989a1e141575..c4e77f213fff2e2d387ec2591b6539b148a82eb8 100644 (file)
@@ -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
index 08e3bc037e30482727e2a4015cc36257cfc3fe1c..82ea44d586eab7b9518b2f2104a137362fedd93f 100644 (file)
@@ -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
index 1f8fbf2ba197be54ff2f16e4c87118a7e68074fa..41a2fa032ca019bfbdec44da23fc58433f46c6b2 100755 (executable)
@@ -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"
index 9e7d70406d8939c66bf06e51174d74985348c7a5..2804a1923475bb7ef10ba01aeb1eb9ce8834a988 100755 (executable)
@@ -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'"
 
index 016fb5e84f63d465c5c62646c89418acc92969d9..59b595a9014e14640c6acfc12dab53c44fa9776b 100755 (executable)
@@ -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