2 # hdw-linux Config script
6 # script initializing environment
13 -stage) hdw_status="$2" ; shift 2 ;;
17 echo " ./scripts/Config -stage <stagelevel>"
22 if [ -z "$hdw_status" ]; then
23 echo "something went wrong. stage needs to be specified."
27 # execute Config file & create symlink to doc/README + doc/BUILD
28 if [ -f ./Config ] ; then
30 echo "setting hdw_home_dir to $hdw_home_dir"
31 echo "reading ./Config file"
33 [ ! -s ./README ] && ln -s ./doc/README .
34 [ ! -s ./BUILD ] && ln -s ./doc/BUILD .
35 [ ! -s ./INSTALL ] && ln -s ./doc/INSTALL .
36 [ ! -s ./License ] && ln -s ./doc/License .
38 echo "./Config file not found. are you in correct directory?"
42 # define the stage 0/1 prefix to use
43 # default "static", though no static linking is done anymore in stage1
44 if [ -z "$hdw_stage1_prefix" ] ; then
45 s1_prefix="static" # default
47 s1_prefix=$hdw_stage1_prefix
50 # lets see what root is:
51 [ "$hdw_status" = "2" -o "$hdw_status" = "3" ] && root=""
52 if [ "$hdw_status" -lt 2 -o "$hdw_crossbuild" != "0" ] ; then
53 if [ -z "$hdw_build_dir" ] ; then
54 echo "please set hdw_build_dir in ./Config!"
56 elif [ ! -d $hdw_build_dir ] ; then
57 echo "please set _existing_ hdw_build_dir in ./Config"
60 echo "hdw_build_dir variable set to $hdw_build_dir"
65 # setting up general environment, now that we know $root
69 [ "$hdw_status" -lt "2" ] && export PATH="$root/${s1_prefix}/bin:$PATH"
71 # let's do optimization and care for crossbuilds
72 if [ ! -z "`uname --version | grep sh-utils`" ] ; then
73 hdw_arch_build="`uname -m -p | tr " " -`-linux-gnu"
75 hdw_arch_build="`uname -m`-unknown-linux-gnu"
78 ia32) if [ -z "$hdw_arch_opt" ] ; then
79 hdw_arch_target="i386-pc-linux-gnu"
80 elif [ ! -z "$hdw_arch_opt" ] ; then
81 hdw_arch_target="${hdw_arch_opt}-pc-linux-gnu"
82 hdw_cflags="-march=${hdw_arch_opt}"
84 hdw_arch_build=${hdw_arch_build//unknown/pc} ;;
85 sparc*) if [ -z "$hdw_arch_opt" ] ; then
86 hdw_arch_target="$hdw_arch-unknown-linux-gnu"
89 echo "pls hack sparc* opt. options and submit :)"
90 echo "no optimization used!"
91 hdw_arch_target="$hdw_arch-unknown-linux-gnu"
92 hdw_cflags="-march={hdw_arch_opt}"
95 hdw_arch_target="powerpc-unknown-linux-gnu"
96 [ ! -z "$hdw_arch_opt" ] && hdw_cflags="-march=${hdw_arch_opt}"
97 hdw_arch_build=${hdw_arch_build//ppc/powerpc} ;;
98 *) echo "not supported yet"
99 echo "please choose a valid optimization and build platform."
103 [ ! -z "$hdw_opt" ] && hdw_cflags="-O${hdw_opt} $hdw_cflags"
107 if [ "$hdw_crossbuild" != "0" ] ; then
108 hdw_arch_prefix="$hdw_arch_target-"
109 if [ "$hdw_real_build" ] ; then
110 if [ "$hdw_arch" = "ia32" ] ; then
111 hdw_arch_build=${hdw_arch_build//$hdw_arch_opt/$hdw_real_build}
113 hdw_arch_build=${hdw_arch_build//$hdw_arch/$hdw_real_build}
117 # test: actually we always use the compilers for target
118 # hdw_arch_prefix="$hdw_arch_target-"
121 echo "hdw_arch_target variable set to $hdw_arch_target"
122 echo "hdw_arch_build variable set to $hdw_arch_build"
123 echo "hdw_cflags variable set to $hdw_cflags"
124 [ "$hdw_status" = "1" ] && echo "hdw_stage1_prefix set to '$s1_prefix'"
126 # lets see what we are going to build
127 if [ -z $hdw_target ] ; then
128 echo "please set hdw_target in ./Config!"
130 elif [ ! -d ./targets/$hdw_target ] ; then
131 echo "please set _existing_ hdw_target in ./Config!"
134 echo "hdw_target variable set to $hdw_target"