Scripts/build

From Organic Design wiki
  1. !/bin/sh

. config/options

if [ -z "$1" ]; then

 echo "usage: $0 package_name"
 exit 1

fi

if [ -f $PACKAGES/$1/arch ]; then

 grep -q "$TARGET_ARCH" "$PACKAGES/$1/arch" || exit 0

fi

unset INSTALL

mkdir -p $STAMPS/$1 STAMP=$STAMPS/$1/build

$SCRIPTS/unpack $1 if [ -f $STAMP -a -f $PACKAGES/$1/need_build ]; then

 $PACKAGES/$1/need_build $@

fi if [ -f $STAMP -a $PACKAGES/$1/build -nt $STAMP ]; then

 rm -f $STAMP

fi

if [ ! -f $STAMP ]; then

 rm -f $STAMP
 printf "%${INDENT}c BUILD    $1\n" >&$SILENT_OUT
 export INDENT=$((${INDENT:-1}+$INDENT_SIZE))
 if [ -f $PACKAGES/$1/build ]; then
   $PACKAGES/$1/build $@ >&$VERBOSE_OUT
 elif [ -f $BUILD/$1*/Makefile ]; then
   $SCRIPTS/build toolchain
   make -C $BUILD/$1* >&$VERBOSE_OUT
 elif [ "$1" != "${1#theme-}" ]; then
   $SCRIPTS/build-theme $@ >&$VERBOSE_OUT
 elif [ -f $BUILD/$1*/$1.c ]; then
   $SCRIPTS/build toolchain
   make -C $BUILD/$1* $1 >&$VERBOSE_OUT
 fi
 . $CONFIG/options
 for i in `sed -n "s/^\([^#].*\)=.*$/\1/p" $CONFIG/options`; do
   eval val=\$$i
   echo "STAMP_$i=\"$val\"" >> $STAMP
 done

fi