scripts/create_addon: allow packages to ship multiple addons

This commit is contained in:
Stefan Saraev 2015-07-05 13:42:04 +03:00
parent b123561fde
commit 668f53f3f2

View File

@ -47,21 +47,8 @@ if [ -n "$PKG_ADDON_REPOVERSION" -a ! "$PKG_ADDON_REPOVERSION" = "$ADDON_VERSION
exit 0
fi
if [ "$PKG_IS_ADDON" = "yes" ] ; then
$SCRIPTS/build $@
printf "%${BUILD_INDENT}c CREATE ADDON ($PROJECT/$TARGET_ARCH) $1\n" ' '>&$SILENT_OUT
export BUILD_INDENT=$((${BUILD_INDENT:-1}+$BUILD_INDENT_SIZE))
rm -rf $ADDON_BUILD
if [ "$(type -t addon)" = "function" ]; then
addon
else
echo "*** unsupported package format. please convert your package ***"
exit 1
fi
pack_addon() {
IFS=" "
for i in $PKG_ADDON_REQUIRES; do
REQUIRES_ADDONNAME=`echo $i | cut -f1 -d ":"`
@ -120,7 +107,7 @@ if [ "$PKG_IS_ADDON" = "yes" ] ; then
ADDON_INSTALL_DIR="$TARGET/$ADDONS/$ADDON_VERSION/$PROJECT/$TARGET_ARCH/$PKG_ADDON_ID"
if [ -f $ADDON_INSTALL_DIR/$PKG_ADDON_ID-$ADDONVER.zip ] ; then
echo "*** WARNING: $PKG_ADDON_ID-$ADDONVER.zip already exists. not overwriting it ***"
exit 0
return 0
fi
cd $ADDON_BUILD
echo "*** compressing Addon $PKG_ADDON_ID ... ***"
@ -136,4 +123,32 @@ if [ "$PKG_IS_ADDON" = "yes" ] ; then
cp $ADDON_BUILD/$PKG_ADDON_ID/icon.png $ADDON_INSTALL_DIR/icon.png
fi
fi
}
if [ "$PKG_IS_ADDON" = "yes" ] ; then
$SCRIPTS/build $@
printf "%${BUILD_INDENT}c CREATE ADDON ($PROJECT/$TARGET_ARCH) $1\n" ' '>&$SILENT_OUT
export BUILD_INDENT=$((${BUILD_INDENT:-1}+$BUILD_INDENT_SIZE))
rm -rf $ADDON_BUILD
if [ "$(type -t addon)" = "function" ]; then
addon
else
echo "*** unsupported package format. please convert your package ***"
exit 1
fi
# HACK for packages tat provide multiple addons like screensavers.rsxs
# addon's addon() in package.mk should take care for exporting
# MULTI_ADDONS="addon.boo1 addon.boo2 addon.boo3"
if [ -n "$MULTI_ADDONS" ] ; then
for _ADDON in $MULTI_ADDONS ; do
PKG_ADDON_ID=$_ADDON
pack_addon
done
else
pack_addon
fi
fi