# this script is used to build hdw-linux packages.
#
-hdw_status=""
+stage=""
package=""
no_src_del=""
priority=""
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 ;;
exit 1
fi
-if [ -z "$hdw_status" ]; then
- echo "stage level not specified. something went wrong ... hey,"
- echo "this is a development version ;)"
+if [ -z "$stage" ]; then
+ echo "no stage level specified, abort."
exit 1
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
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}"
+ prefix="/${tc_name}"
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"
confopt="$confopt --datadir=$prefix/share"
confopt="$confopt --infodir=$prefix/info"
confopt="$confopt --mandir=$prefix/man"
- confopt="$confopt --build=$hdw_arch_build"
- confopt="$confopt --host=$hdw_arch_target"
- # crosscompiling
- [ "$hdw_crossbuild" != "0" ] && \
- confopt="$confopt --target=$hdw_arch_target"
- if [ "$hdw_status" -gt "1" ] ; then
+ if [ "$stage" -gt "1" ] ; then
confopt="$confopt --localstatedir=$localstatedir"
confopt="$confopt --sysconfdir=$sysconfdir"
fi
+ # architecture specific stuff
+ confopt="$confopt --build=$hdw_arch_build"
+ confopt="$confopt --host=$hdw_arch_host"
+ # crosscompiling
+ [ "$package" = "gcc" -o "$package" = "binutils" ] && \
+ confopt="$confopt --target=$hdw_arch_target"
# buildfunctions
pre_install() {
# 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} ${tc_name}/"
flist_cmd="find \$flist_path \( -cnewer $root/.time_$package -o \
-newer $root/.time_$package \) \( -not -type d -o \
-type d -empty \) -print"
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
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
echo
echo "Debug: (buildenvironment)"
printenv
+ echo "gcc to use: `which gcc`, `which cc`"
echo
fi
build_main
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
# 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" >> \
# 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\." \
grep -v '^ldd'`; do
for rpkg in `grep $rdep -r \
$root/var/adm/flists | \
- grep -v $s1_prefix | \
+ grep -v $tc_name | \
awk -F: '{ print $2 }'`; do
add=1
for cmp in $alldeps; do
grep -v '^ldd'`; do
for rpkg in `grep $rdep -r \
$root/var/adm/flists | \
- grep -v $s1_prefix | \
+ grep -v $tc_name | \
awk -F: '{ print $2 }'`; do
add=1
for cmp in $alldeps; do