toolchain mods, glibc and gcc still need some checking
[hdw-linux/hdw-linux.git] / scripts / Build
index 41a2fa0..a3ed9a8 100755 (executable)
@@ -5,7 +5,7 @@
 # this script is used to build hdw-linux packages. 
 #
 
-hdw_status=""
+stage=""
 package=""
 no_src_del=""
 priority=""
@@ -13,7 +13,7 @@ dir="*"
 
 while [ "$1" ] ; do
        case "$1" in 
-               -stage)         hdw_status=$2   ; shift 2 ;;
+               -stage)         stage=$2        ; shift 2 ;;
                -package)       package=$2      ; shift 2 ;;
                -no_src_del)    no_src_del="1"  ; shift 1 ;;
                -priority)      priority=$2     ; shift 2 ;;
@@ -34,7 +34,7 @@ if [ -z "$package" ]; then
        exit 1
 fi
 
-if [ -z "$hdw_status" ]; then
+if [ -z "$stage" ]; then
        echo "stage level not specified. something went wrong ... hey,"
        echo "this is a development version ;)"
        exit 1
@@ -47,13 +47,13 @@ fi
 export priority
 
 # load config andsubroutines
-. ./scripts/Config -stage $hdw_status
+. ./scripts/Config -stage $stage
 . ./scripts/subroutines
 # optimization
 . ./scripts/optimization
 
 # check for dietlibc
-if [ "$hdw_status" != "1" -a "$hdw_use_dietlibc" = "1" ] ; then
+if [ "$stage" != "1" -a "$hdw_use_dietlibc" = "1" ] ; then
        export CC="diet-dyn $CC -nostdinc"
        export CXX="diet-dyn $CXX -nostdinc"
 fi
@@ -120,17 +120,17 @@ echo "found $package config file ..."
        make_conf=""; install_conf=""
        
        prefix=""; docdir=""
-       if [ "$hdw_status" -lt "2" ] ; then
+       if [ "$stage" -lt "2" ] ; then
                # use the symlink as prefix
                prefix="/${s1_prefix}"
                docdir="$prefix/share/doc/$package"
                install_conf="PREFIX=$prefix"
        else
-               if [ "$hdw_status" = "2" -o "$hdw_status" = "3" ] ; then
+               if [ "$stage" = "2" -o "$stage" = "3" ] ; then
                        prefix="$root/usr"; docdir="$root/usr/doc/$package"
                        localstatedir="$root/var"
                        sysconfdir="$root/etc"
-               elif [ "$hdw_status" = "4" ] ; then
+               elif [ "$stage" = "4" ] ; then
                        prefix="$root/opt/$package"
                        docdir="$root/opt/$package/doc"
                        localstatedir="$root/var/opt/$package"
@@ -150,7 +150,7 @@ echo "found $package config file ..."
        confopt="$confopt --datadir=$prefix/share"
        confopt="$confopt --infodir=$prefix/info"
        confopt="$confopt --mandir=$prefix/man"
-       if [ "$hdw_status" -gt "1" ] ; then
+       if [ "$stage" -gt "1" ] ; then
                confopt="$confopt --localstatedir=$localstatedir"
                confopt="$confopt --sysconfdir=$sysconfdir"
        fi
@@ -186,7 +186,7 @@ echo "found $package config file ..."
        
        # flist find variables/command
        flist_path="bin/ boot/ etc/ lib/ opt/ sbin/ usr/ var/"
-       [ "$hdw_status" -lt "2" ] && flist_path="${flist_path} ${s1_prefix}/"
+       [ "$stage" -lt "2" ] && flist_path="${flist_path} ${s1_prefix}/"
        flist_cmd="find \$flist_path \( -cnewer $root/.time_$package -o \
                -newer $root/.time_$package \) \( -not -type d -o \
                -type d -empty \) -print"
@@ -203,7 +203,7 @@ echo "found $package config file ..."
        umask 0022
 
        # run ldconfig to, maybe we installed some libs before!
-       if [ "$hdw_status" != "1" ] ; then
+       if [ "$stage" != "1" ] ; then
                echo "running ldconfig ..."
                ldconfig
        fi
@@ -284,7 +284,7 @@ echo "found $package config file ..."
                        done
                fi
                # stage specific patches
-               for xtra_patch in `ls $confdir/*.patch.${hdw_status} 2> /dev/null`; do
+               for xtra_patch in `ls $confdir/*.patch.${stage} 2> /dev/null`; do
                        echo "applying patch $xtra_patch ..."
                        patch -Nfp1 < $xtra_patch
                done
@@ -310,7 +310,7 @@ echo "found $package config file ..."
                done
        fi
        # setup scripts
-       if [ "$hdw_status" != "1" ] ; then
+       if [ "$stage" != "1" ] ; then
                for my_setup in `ls $confdir/*.setup 2> /dev/null`; do
                        create_setup_scripts $my_setup
                done
@@ -326,23 +326,23 @@ echo "found $package config file ..."
 
        # let's create the flist
        append=""
-       [ "$hdw_status" = "0" ] && append=".stage0"
-       [ "$hdw_status" = "1" ] && append=".stage1"
+       [ "$stage" = "0" ] && append=".stage0"
+       [ "$stage" = "1" ] && append=".stage1"
        append="${append}-${priority}"
        export package
        export append
-       export hdw_status
+       export stage
        export priority
        awk '\
        BEGIN   { package=ENVIRON["package"] ; append=ENVIRON["append"] ; \
-                 stage=ENVIRON["hdw_status"] ; priority=ENVIRON["priority"] } \
+                 stage=ENVIRON["stage"] ; priority=ENVIRON["priority"] } \
                { print package ": " $0 } \
        END     { print package ": " "var/adm/logs/" stage "-" priority "-" \
                  package ; \
                  print package ": " "var/adm/flists/" package append }' \
        $root/flist.$package > $root/var/adm/flists/${package}${append}
        # manually add dependency files, calculated after flist
-       if [ "$hdw_status" -ge "3" ] ; then
+       if [ "$stage" -ge "3" ] ; then
                echo "${package}: var/adm/deps/build/$package" >> \
                $root/var/adm/flists/${package}${append}
                echo "${package}: var/adm/deps/run/$package" >> \
@@ -352,13 +352,13 @@ echo "found $package config file ..."
        # build/runtime dependencies (just libs >= stage 3, 
        # default is 'hardcoded')
        # still in development !!
-       if [ "$hdw_status" -ge "3" ] ; then
+       if [ "$stage" -ge "3" ] ; then
                # build deps
                rm -f $root/var/adm/deps/build/$package
                echo -n "calculating build dependencies ... "
                alldeps=""
                for lib in `grep '\ -l[A-Za-z]' \
-               $root/var/adm/logs/${hdw_status}-${priority}-$package.out`; do
+               $root/var/adm/logs/${stage}-${priority}-$package.out`; do
                        if [ -n "`echo $lib | grep '^-l'`" ] ; then
                                lib=${lib//-l/lib}
                                for dep in `grep "/$lib\." \