Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 97 lines (76 sloc) 2.44 KB
#!/bin/sh
. config/options
if [ -z "$1" ]; then
echo "usage: $0 package_name"
exit 1
fi
if [ "$1" = "--force" ]; then
FORCE=true
shift
fi
unset INSTALL
[ -n "$REPO" ] && $SCRIPTS/get-opk $1
[ -n "$REPO" ] && [ ! -f $ROOT/$STAMPS/dl-from-repo-not-ok ] && echo "Continuing without building $1" && exit 0
mkdir -p $STAMPS/$1
STAMP=$STAMPS/$1/build
$SCRIPTS/unpack $1
if [ -f $STAMP ] && [ -f $PACKAGES/$1/need_build ]; then
$PACKAGES/$1/need_build $@
fi
# check for platform-specific package overlay
## check where is meta (use SECTION for that)
## SECTIONS="admin drivers filesystem firmware fonts games host-packages libs misc multimedia nodejs net perl proto python sound system utils x11"
get_meta $1
if [ -r $PACKAGES/$PKG_SECTION/$1/build ] ; then
BUILD_RULE=$PACKAGES/$PKG_SECTION/$1/build
else
BUILD_RULE=$PACKAGES/$1/build
fi
PLATFORM_BUILD="$PLATFORM_PACKAGES/$1/build"
[ -r "$PLATFORM_BUILD" ] && BUILD_RULE="$PLATFORM_BUILD"
MACHINE_BUILD="$MACHINE_PACKAGES/$1/build"
[ -r "$MACHINE_BUILD" ] && BUILD_RULE="$MACHINE_BUILD"
# check for flavour-specific package overlay
FLAVOUR_BUILD="$FLAVOUR_PACKAGES/$1/build"
[ -r "$FLAVOUR_BUILD" ] && BUILD_RULE="$FLAVOUR_BUILD"
if [ -f $STAMP ] && [ $BUILD_RULE -nt $STAMP ] || [ "$FORCE" = true ]; then
rm -f $STAMP
$SCRIPTS/unpackage $1
$SCRIPTS/unpackagedev $1
fi
if [ ! -f $STAMP ]; then
rm -f $STAMP
set_title "BUILD $1"
get_meta $1
if [ "$PKG_OPK_ARCH" = unsupported ]; then
echo "$1 is not supported on $TARGET_ARCH, aborting."
exit 1
fi
if [ "$DYNAMIC_SYSROOT" = yes ]; then
for f in $ROOT/$TOOLCHAIN/var/lib/opkg/info/*.control ; do
p=`basename $f .control`
[ "$p" = "opkg-host" ] || [ "$p" = "opkg-utils" ] && continue
$SCRIPTS/uninstalldev $p
done
# we create all the dev packages before installing them because, when using
# dynamic sysroot, a package build could clear the toolchain and make the
# subsequent package build fail in some cases
for p in $PKG_BUILD_DEPENDS; do
$SCRIPTS/packagedev $p
done
fi
for p in $PKG_BUILD_DEPENDS; do
$SCRIPTS/installdev $p
done
echo "Building $1"
if [ -f $BUILD_RULE ]; then
$BUILD_RULE $@ >&$VERBOSE_OUT
elif [ -f "$PKG_BUILD_DIR/Makefile" ]; then
$SCRIPTS/build toolchain
make -C $PKG_BUILD_DIR >&$VERBOSE_OUT
elif [ -f "$PKG_BUILD_DIR/$1.c" ]; then
$SCRIPTS/build toolchain
make -C $PKG_BUILD_DIR $1 >&$VERBOSE_OUT
fi
create_stamp $STAMP
fi