build: introduce device classes
This commit allows to define a device-class flag in the target definitions. This way, it is possible to distinguish between groups of devices in the build-process in terms of package or feature selection.
This commit is contained in:
parent
3d5a693026
commit
9c52365077
6
Makefile
6
Makefile
@ -112,6 +112,8 @@ lint-sh: FORCE
|
||||
@scripts/lint-sh.sh
|
||||
|
||||
GLUON_DEFAULT_PACKAGES := hostapd-mini
|
||||
GLUON_CLASS_PACKAGES_standard :=
|
||||
GLUON_CLASS_PACKAGES_tiny :=
|
||||
|
||||
GLUON_FEATURE_PACKAGES := $(shell scripts/features.sh '$(GLUON_FEATURES)' || echo '__ERROR__')
|
||||
ifneq ($(filter __ERROR__,$(GLUON_FEATURE_PACKAGES)),)
|
||||
@ -144,12 +146,12 @@ config: $(LUA) FORCE
|
||||
$(foreach conf,site $(patsubst $(GLUON_SITEDIR)/%.conf,%,$(wildcard $(GLUON_SITEDIR)/domains/*.conf)),$(call CheckSite,$(conf)))
|
||||
|
||||
@$(GLUON_CONFIG_VARS) \
|
||||
$(LUA) scripts/target_config.lua '$(GLUON_TARGET)' '$(GLUON_PACKAGES)' \
|
||||
$(LUA) scripts/target_config.lua '$(GLUON_TARGET)' '$(GLUON_DEFAULT_PACKAGES)' '$(GLUON_CLASS_PACKAGES_standard)' '$(GLUON_CLASS_PACKAGES_tiny)' \
|
||||
> openwrt/.config
|
||||
+@$(OPENWRTMAKE) defconfig
|
||||
|
||||
@$(GLUON_CONFIG_VARS) \
|
||||
$(LUA) scripts/target_config_check.lua '$(GLUON_TARGET)' '$(GLUON_PACKAGES)'
|
||||
$(LUA) scripts/target_config_check.lua '$(GLUON_TARGET)' '$(GLUON_DEFAULT_PACKAGES)' '$(GLUON_CLASS_PACKAGES_standard)' '$(GLUON_CLASS_PACKAGES_tiny)'
|
||||
|
||||
|
||||
all: config
|
||||
|
@ -7,6 +7,10 @@ return function(funcs)
|
||||
|
||||
local target = arg[1]
|
||||
local extra_packages = arg[2]
|
||||
local class_packages = {
|
||||
standard = arg[3],
|
||||
tiny = arg[4],
|
||||
}
|
||||
|
||||
local openwrt_config_target
|
||||
if env.SUBTARGET ~= '' then
|
||||
@ -64,13 +68,19 @@ END_MAKE
|
||||
end
|
||||
device_pkgs = device_pkgs .. ' ' .. pkg
|
||||
end
|
||||
local function handle_pkgs(pkgs)
|
||||
local packages = string.gmatch(pkgs or '', '%S+')
|
||||
for pkg in packages do
|
||||
handle_pkg(pkg)
|
||||
end
|
||||
end
|
||||
|
||||
for _, pkg in ipairs(dev.options.packages or {}) do
|
||||
handle_pkg(pkg)
|
||||
end
|
||||
for pkg in string.gmatch(site_packages(dev.image), '%S+') do
|
||||
handle_pkg(pkg)
|
||||
end
|
||||
handle_pkgs(site_packages(dev.image))
|
||||
|
||||
handle_pkgs(class_packages[dev.options.class])
|
||||
|
||||
funcs.config_message(lib.config, string.format("unable to enable device '%s'", profile),
|
||||
'CONFIG_TARGET_DEVICE_%s_DEVICE_%s=y', openwrt_config_target, profile)
|
||||
|
@ -39,6 +39,7 @@ local default_options = {
|
||||
aliases = {},
|
||||
manifest_aliases = {},
|
||||
packages = {},
|
||||
class = "standard",
|
||||
deprecated = false,
|
||||
broken = false,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user