From: hackbard Date: Wed, 21 Jul 2004 09:00:41 +0000 (+0000) Subject: initial checkin of hdw-linux devel cvs repository X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=6590bcd1cecd29b92b821a0663de431a01410786;p=hdw-linux%2Fhdw-linux.git initial checkin of hdw-linux devel cvs repository --- diff --git a/scripts/Config b/scripts/Config new file mode 100755 index 0000000..b059d61 --- /dev/null +++ b/scripts/Config @@ -0,0 +1,136 @@ +# +# hdw-linux Config script +# +# author: hackbard +# +# script initializing environment +# + +hdw_status="" + +while [ "$1" ] ; do + case "$1" in + -stage) hdw_status="$2" ; shift 2 ;; + *) echo + echo "Usage:" + echo + echo " ./scripts/Config -stage " + echo ;; + esac +done + +if [ -z "$hdw_status" ]; then + echo "something went wrong. stage needs to be specified." + exit 1 +fi + +# execute Config file & create symlink to doc/README + doc/BUILD +if [ -f ./Config ] ; then + hdw_home_dir=`pwd` + echo "setting hdw_home_dir to $hdw_home_dir" + echo "reading ./Config file" + . ./Config + [ ! -s ./README ] && ln -s ./doc/README . + [ ! -s ./BUILD ] && ln -s ./doc/BUILD . + [ ! -s ./INSTALL ] && ln -s ./doc/INSTALL . + [ ! -s ./License ] && ln -s ./doc/License . +else + echo "./Config file not found. are you in correct directory?" + 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 + +# lets see what root is: +[ "$hdw_status" = "2" -o "$hdw_status" = "3" ] && root="" +if [ "$hdw_status" -lt 2 -o "$hdw_crossbuild" != "0" ] ; then + if [ -z "$hdw_build_dir" ] ; then + echo "please set hdw_build_dir in ./Config!" + exit 1 + elif [ ! -d $hdw_build_dir ] ; then + echo "please set _existing_ hdw_build_dir in ./Config" + exit 1 + else + echo "hdw_build_dir variable set to $hdw_build_dir" + root="$hdw_build_dir" + fi +fi + +# setting up general environment, now that we know $root +set +h +umask 022 +export LC_ALL=POSIX +[ "$hdw_status" -lt "2" ] && export PATH="$root/${s1_prefix}/bin:$PATH" + +# let's do optimization and care for crossbuilds +if [ ! -z "`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 +case "$hdw_arch" in + ia32) if [ -z "$hdw_arch_opt" ] ; then + hdw_arch_target="i386-pc-linux-gnu" + elif [ ! -z "$hdw_arch_opt" ] ; then + hdw_arch_target="${hdw_arch_opt}-pc-linux-gnu" + hdw_cflags="-march=${hdw_arch_opt}" + fi + hdw_arch_build=${hdw_arch_build//unknown/pc} ;; + 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}" + hdw_arch_build=${hdw_arch_build//ppc/powerpc} ;; + *) echo "not supported yet" + echo "please choose a valid optimization and build platform." + exit 1 ;; +esac +# -O flag +[ ! -z "$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-" + +# resume ... +echo "hdw_arch_target variable set to $hdw_arch_target" +echo "hdw_arch_build variable set to $hdw_arch_build" +echo "hdw_cflags variable set to $hdw_cflags" +[ "$hdw_status" = "1" ] && echo "hdw_stage1_prefix set to '$s1_prefix'" + +# lets see what we are going to build +if [ -z $hdw_target ] ; then + echo "please set hdw_target in ./Config!" + exit 1 +elif [ ! -d ./targets/$hdw_target ] ; then + echo "please set _existing_ hdw_target in ./Config!" + exit 1 +else + echo "hdw_target variable set to $hdw_target" +fi + diff --git a/scripts/Create-Binary b/scripts/Create-Binary new file mode 100755 index 0000000..14f9d45 --- /dev/null +++ b/scripts/Create-Binary @@ -0,0 +1,92 @@ +#/bin/sh +# +# hdw - linux ./scripts/Create-Binary +# +# this script is used to create the binary packages +# + +package="" +tar_name="" +my_root="" + +while [ "$1" ] ; do + case "$1" in + all) package=all ; shift 1 ;; + -package) package=$2 ; shift 2 ;; + -tar-name) tar_name=$2 ; shift 2 ;; + -root) my_root=$2 ; shift 2 ;; + *) + echo "usage: $0 -package -tar-name -root " + exit 1 ;; + esac +done + +# do we run? +if [ -z "$package" ] ; then + echo "no package specified" + exit 1 +fi + +# how to call the packaged tar file (no .tar.bz2 ending!) +[ -z "$tar_name" ] && tar_name="$package" + +# get Config & set hdw_home_dir +. ./Config && hdw_home_dir=`pwd` + +# which root to use? +[ ! -z "$my_root" ] && hdw_build_dir="$my_root" + +# create binary directory +if [ ! -z "$hdw_arch_opt" ]; then + bin_dir=${hdw_arch}-${hdw_arch_opt} +else + bin_dir=${hdw_arch}-generic +fi +mkdir -p binaries/$bin_dir + +# single package +if [ "$package" != "all" ] ; then +if [ -d ./binaries/$bin_dir/${package} ] ; then + echo "$package binary already exists, skipped" + echo "(remove ./binaries/$bin_dir/$package to recreate it)" + exit 0 +else + # does it exist? + if [ ! -f $hdw_build_dir/var/adm/flists/$package ] ; then + echo "package not build (moved flist file?)" + exit 0 + else + echo "creating binary tarball of $package" + mkdir -p $hdw_home_dir/binaries/$bin_dir/$package && + cd $hdw_build_dir && + # which files do we need? - are we packaging linux? + if [ "$package" = "linux" ] ; then + fl_file="var/adm/flists/$package*" + else + fl_file="var/adm/flists/$package" + fi + cat $fl_file | awk '{ print $2 }' | \ + tar --no-recursion --use-compress-program=bzip2 \ + -cf $hdw_home_dir/binaries/$bin_dir/$package/$tar_name.tar.bz2 \ + -T - + cp $hdw_build_dir/var/adm/flists/$package \ + $hdw_home_dir/binaries/$bin_dir/$package + cd $hdw_home_dir + echo "done" + fi +fi + +elif [ "$package" = "all" ] ; then + +((counter=1)) +for pkg in `ls -A $hdw_build_dir/var/adm/flists | grep -v '.stage1'`; do + ./scripts/Create-Binary -package $pkg -root $hdw_build_dir + ((counter+=1)) +done + +# add 00-dirtree, build in stage1 +./scripts/Create-Binary -package 00-dirtree.stage1 -tar-name 00-dirtree +((counter+=1)) + +echo "created $counter binaries, done" +fi