X-Git-Url: https://hackdaworld.org/gitweb/?p=hdw-linux%2Fhdw-linux.git;a=blobdiff_plain;f=scripts%2FConfig;h=042664c609ffe77c8921025f03094115758fbbdc;hp=ba394ddb13d9f0338866d2385abfaf8dce59f035;hb=8dd2356c22327a15f0e16abbc887c4f72fc62985;hpb=31a91ffcb50fe40bced2bc972f681e506863247a diff --git a/scripts/Config b/scripts/Config index ba394dd..042664c 100755 --- a/scripts/Config +++ b/scripts/Config @@ -1,26 +1,27 @@ # # hdw-linux Config script # -# author: hackbard +# author: hackbard@hackdaworld.org # # script initializing environment # -hdw_status="" +stage="" while [ "$1" ] ; do case "$1" in - -stage) hdw_status="$2" ; shift 2 ;; + -stage) stage="$2" ; shift 2 ;; *) echo echo "Usage:" echo echo " ./scripts/Config -stage " - echo ;; + echo + shift 1 ; exit 1 ;; esac done -if [ -z "$hdw_status" ]; then - echo "something went wrong. stage needs to be specified." +if [ -z "$stage" ]; then + echo "something went wrong, no stage specified." exit 1 fi @@ -39,17 +40,13 @@ else exit 1 fi -# define the stage 0/1 prefix to use -# default "static", though no static linking is done anymore in stage1 -if [ -z "$hdw_stage1_prefix" ] ; then - s1_prefix="static" # default -else - s1_prefix=$hdw_stage1_prefix -fi +# define the toolchain name, default: "toolchain" +[ -z "$hdw_tc_name" ] && hdw_tc_name="toolchain" +export tc_name=$hdw_tc_name # lets see what root is: root="" -if [ "$hdw_crossbuild" != "0" -o "$hdw_status" -lt "2" ] ; then +if [ "$hdw_crossbuild" != "0" -o "$stage" -lt "2" ] ; then # check for properly configured build directory if [ -z "$hdw_build_dir" ] ; then echo "please set hdw_build_dir in ./Config!" @@ -67,8 +64,11 @@ fi set +h umask 022 export LC_ALL=POSIX -[ "$hdw_status" -lt "2" -o "$hdw_crossbuild" != "0" ] && \ - export PATH="$root/${s1_prefix}/bin:$PATH" +if [ "$stage" -lt "2" -a "$hdw_crossbuild" = "0" ] ; then + export PATH="/${tc_name}/bin:/${tc_name}/sbin:$PATH" +elif [ "$hdw_crossbuild" != "0" ] ; then + export PATH="$root/${tc_name}/bin:$root/${tc_name}/sbin:$PATH" +fi # let's do optimization and care for crossbuilds # @@ -112,6 +112,14 @@ case "$hdw_arch" in hdw_cflags="-mcpu=${hdw_arch_opt}" fi hdw_arch_build=${hdw_arch_build//ppc/powerpc} ;; + ppc64) + hdw_arch_target="powerpc64-unknown-linux-gnu" + if [ -z "$hdw_arch_opt" ] ; then + hdw_cflags="-mcpu=common" + else + hdw_cflags="-mcpu=${hdw_arch_opt}" + fi + hdw_arch_build=${hdw_arch_build//ppc64/powerpc64} ;; mips) hdw_arch_target="mips-unknown-linux-gnu" if [ -z "$hdw_arch_opt" ] ; then echo "info: no optimization set" @@ -125,24 +133,29 @@ esac # --host: system where the created executable runs on. hdw_arch_host=${hdw_arch_build} -[ "$hdw_status" != "0" ] && hdw_arch_host=${hdw_arch_target} +[ "$stage" != "0" -a "$hdw_crossbuild" = "0" ] && \ + hdw_arch_host=${hdw_arch_target} # -O flag # optimization only at stages >= 1 -[ -n "$hdw_opt" ] && hdw_cflags="-O${hdw_opt} $hdw_cflags" +if [ -n "$hdw_opt" -a "$stage" != "0" ] ; then + hdw_cflags="-O${hdw_opt} $hdw_cflags" +else + unset hdw_cflags +fi # build tools to use -# should be the same like host imho, right? -hdw_arch_prefix="$hdw_arch_host-" +hdw_arch_prefix="" +[ "$stage" != "0" ] && hdw_arch_prefix="$hdw_arch_target-" # print decissions for debugging ... echo "root variable set to '$root'" 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'" +echo "hdw_arch_host variable set to $hdw_arch_host" +echo "hdw_arch_prefix variable set to '$hdw_arch_prefix'" +echo "hdw_cflags variable set to '$hdw_cflags'" +echo "hdw_tc_name set to '$hdw_tc_name'" # lets see what we are going to build if [ -z $hdw_target ] ; then