buildscript: support to choose the build variant

Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Tim Niemeyer 2019-02-03 14:06:08 +01:00 committed by Adrian Schmutzler
parent 5074c6b08f
commit f0eae4fff4
5 changed files with 72 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
/selected_bsp
/selected_community
/selected_variant
/build
/bin*
/src/dl

View File

@ -140,6 +140,11 @@ prepare() {
patch_target
# set the variant for this build
cp "./src/packages/fff/fff/variant-$(cat selected_variant).mk" "$target"/variant.mk
# force the reevaluation of this Makefile to make note of the new variant
touch ./src/packages/fff/fff/Makefile
## generate own feeds.conf
#this local variable should be globally configure variable used in get_source and here
local PACKAGEBASE=${PWD}/src/packages
@ -344,6 +349,16 @@ loadBSP()
. selected_bsp
}
loadVariant()
{
echo "Working with build variant \"$(cat selected_variant)\""
}
setVariant()
{
echo "$1" > selected_variant
}
setBSP()
{
/bin/rm -rf selected_bsp
@ -364,13 +379,19 @@ if [ "$(/usr/bin/id -u)" -eq 0 ]; then
exit 1
fi
if [ "$1" != "selectbsp" ]; then
if [ "$1" != "selectbsp" -a "$1" != "selectvariant" ]; then
if [ ! -h selected_bsp ]; then
echo "Please select a Board-Support-Package using:"
echo "$0 selectbsp"
exit
fi
if [ ! -f selected_variant ]; then
echo "Please select a build variant using:"
echo "$0 selectvariant"
exit
fi
loadBSP
loadVariant
echo
fi
@ -391,6 +412,22 @@ case "$1" in
fi
fi
;;
"selectvariant")
if [ "$2" = "help" ] || [ "$2" = "" ]; then
echo "Select a build varaint:"
echo
echo "Usage: $0 $1 <name of variant>"
echo "available variants: "
/bin/ls src/packages/fff/fff/variant-*.mk | sed 's#.*/variant-\(.*\)\.mk#\1#g'
echo
else
if [ ! -f "src/packages/fff/fff/variant-$2.mk" ]; then
echo "Could not find variant $2"
else
setVariant $2
fi
fi
;;
"prepare")
if [ "$2" = "help" ] || [ "$2" = "x" ]; then
echo "This option fetches the sources for the images and configurates the build so that it can be compiled"
@ -462,6 +499,7 @@ case "$1" in
echo "Usage: $0 command"
echo "command:"
echo " selectbsp <bsp-file>"
echo " selectvariant <name of variant>"
echo " prepare"
echo " config openwrt"
echo " build [fast|debug]"

View File

@ -35,7 +35,6 @@ endef
define Package/fff-node
$(call Package/fff/base)
DEFAULT:=y
TITLE+=(Home node)
DEPENDS+=+fff-fastd \
+fff-firewall \
@ -76,3 +75,5 @@ endef
$(eval $(call BuildPackage,fff-node))
$(eval $(call BuildPackage,fff-layer3))
include $(TOPDIR)/variant.mk

View File

@ -0,0 +1,15 @@
define Package/fff-default
SECTION:=base
CATEGORY:=Freifunk
DEFAULT:=y
TITLE:=Freifunk-Franken Base default switcher
URL:=http://www.freifunk-franken.de
DEPENDS:=+fff-layer3
endef
define Package/fff-default/description
This package is used to switch on of the Freifunk Franken
package on per default
endef
$(eval $(call BuildPackage,fff-default))

View File

@ -0,0 +1,15 @@
define Package/fff-default
SECTION:=base
CATEGORY:=Freifunk
DEFAULT:=y
TITLE:=Freifunk-Franken Base default switcher
URL:=http://www.freifunk-franken.de
DEPENDS:=+fff-node
endef
define Package/fff-default/description
This package is used to switch on of the Freifunk Franken
package on per default
endef
$(eval $(call BuildPackage,fff-default))