Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 90 lines (67 sloc) 2.11 KB
#!/bin/sh
. config/options
add_control() {
local KEY="$1"
local VAL="$2"
[ -n "$KEY" -a -n "$VAL" ] && \
echo "${KEY}: $VAL" >> $INSTALL/CONTROL/control
return 0
}
[ -n "$REPO" ] && $SCRIPTS/get-opk $1
get_meta $1
# check for platform-specific package overlay
if [ -r $PACKAGES/$PKG_SECTION/$1/installdev ] ; then
INSTALLDEV_RULE=$PACKAGES/$PKG_SECTION/$1/installdev
else
INSTALLDEV_RULE=$PACKAGES/$1/installdev
fi
PLATFORM_INSTALLDEV="$PLATFORM_PACKAGES/$1/installdev"
[ -r "$PLATFORM_INSTALLDEV" ] && INSTALLDEV_RULE="$PLATFORM_INSTALLDEV"
MACHINE_INSTALLDEV="$MACHINE_PACKAGES/$1/installdev"
[ -r "$MACHINE_INSTALLDEV" ] && INSTALLDEV_RULE="$MACHINE_INSTALLDEV"
# check for flavour-specific package overlay
FLAVOUR_INSTALLDEV="$FLAVOUR_PACKAGES/$1/installdev"
[ -r "$FLAVOUR_INSTALLDEV" ] && INSTALLDEV_RULE="$FLAVOUR_INSTALLDEV"
mkdir -p $DEVPKGROOT
STAMP="$DEVPKGROOT/$PKG_OPK_DEV"
if [ -f $STAMP ] && [ $INSTALLDEV_RULE -nt $STAMP ]; then
$SCRIPTS/uninstalldev $1
rm -f $STAMP
fi
if [ -f $STAMP ]; then
echo "$1 (dev) is already packaged, skipping..." >&$VERBOSE_OUT
exit 0
fi
if [ ! -f $INSTALLDEV_RULE ]; then
echo "$1 is not a dev package, skipping..." >&$VERBOSE_OUT
exit 0
fi
set_title "PACKAGEDEV $1"
rm -f $STAMP
export INSTALL="$DEVPKGROOT_STAGE/$1"
rm -rf $INSTALL
mkdir -p $INSTALL/CONTROL
# build
$SCRIPTS/build $1
# install to staging
$INSTALLDEV_RULE $1 >&$VERBOSE_OUT
if [ -n "$PKG_EPOCH" ]; then
OPK_VER_ID="${PKG_EPOCH}:${PKG_VERSION}-${PKG_REV}"
elif [ "$PKG_URL_PROTO" = git ]; then
OPK_VER_ID="1:${PKG_VERSION}-${PKG_REV}"
else
OPK_VER_ID="${PKG_VERSION}-${PKG_REV}"
fi
# build opk package
add_control "Package" "${PKG_NAME}"
add_control "Version" "${OPK_VER_ID}dev${PKG_OPK_ARCH}"
add_control "Architecture" "`uname -m`"
add_control "Depends" "$PKG_OPK_DEV_DEPENDS"
add_control "Priority" "extra"
add_control "Section" "devel"
add_control "Maintainer" "$DISTRO_MAINTAINER"
add_control "Source" "$DISTRO_SOURCE"
add_control "Description" "Devel files for ${PKG_NAME}"
$SCRIPTS/build opkg-utils
mkdir -p $DEVPKGROOT
opkg-build -O -o root -g root $INSTALL $DEVPKGROOT >&$VERBOSE_OUT