gluon/targets/generic
Matthias Schiffer 9e23534ec3
build: rework config generation
So far, we were using a sort operation on the generated .config to
implement precedence of =y packages over =m, and =m over unset.
Unfortunately, this sort not only used for packages, but for all config
lines. This made it impossible to override settings from targets/generic
in a target config when the new setting was sorted before the generic
setting.

To fix this, track configurations by their keys, so we can properly
override config keys that were set before. Value-based precedence is
only preserved for package configuration.

The config() and try_config() calls always take key and value as
separate arguments now. Strings are quoted automatically; the values
true, nil and false map to y, m and unset for tristate options. config()
can take an optional third argument to override the error message to
display when the setting fails to apply.

All existing target configs generate the same .config with the old and the
new code. The new code is also a bit faster on targets with many devices.
2020-05-31 02:20:58 +02:00

78 lines
2.0 KiB
Plaintext

assert(env.GLUON_LANGS)
config('CONFIG_GLUON_SITEDIR', env.GLUON_SITEDIR)
config('CONFIG_GLUON_RELEASE', env.GLUON_RELEASE)
try_config('CONFIG_GLUON_BRANCH', env.GLUON_BRANCH or '')
for lang in string.gmatch(env.GLUON_LANGS, '%S+') do
try_config('CONFIG_GLUON_WEB_LANG_' .. lang, true)
end
config('CONFIG_TARGET_' .. env.BOARD, true)
if env.SUBTARGET ~= '' then
config(string.format('CONFIG_TARGET_%s_%s', env.BOARD, env.SUBTARGET), true)
end
-- Disable non-default feeds in distfeeds.conf
config('CONFIG_FEED_gluon_base', false)
local default_feeds = {}
for feed in string.gmatch(exec_capture_raw('. scripts/default_feeds.sh && echo "$DEFAULT_FEEDS"'), '%S+') do
default_feeds[feed] = true
end
for feed in string.gmatch(exec_capture_raw('. scripts/modules.sh && echo -n "$FEEDS"'), '%S+') do
if not default_feeds[feed] then
config('CONFIG_FEED_' .. feed, false)
end
end
config('CONFIG_TARGET_ROOTFS_INITRAMFS', false)
config('CONFIG_DEVEL', true)
config('CONFIG_ALL_NONSHARED', true)
config('CONFIG_PACKAGE_usbip', false) -- fails to build
config('CONFIG_PACKAGE_kmod-jool', false) -- fails to build
config('CONFIG_BUSYBOX_CUSTOM', true)
config('CONFIG_BUSYBOX_CONFIG_FEATURE_PREFER_IPV4_ADDRESS', false)
config('CONFIG_PACKAGE_ATH_DEBUG', true)
try_config('CONFIG_TARGET_SQUASHFS_BLOCK_SIZE', 256)
config('CONFIG_KERNEL_IP_MROUTE', false)
config('CONFIG_KERNEL_IPV6_MROUTE', false)
try_config('CONFIG_TARGET_MULTI_PROFILE', true)
try_config('CONFIG_TARGET_PER_DEVICE_ROOTFS', true)
config('CONFIG_GLUON_MULTIDOMAIN', istrue(env.GLUON_MULTIDOMAIN))
config('CONFIG_AUTOREMOVE', istrue(env.GLUON_AUTOREMOVE))
if istrue(env.GLUON_DEBUG) then
config('CONFIG_DEBUG', true)
config('CONFIG_NO_STRIP', true)
config('CONFIG_USE_STRIP', false)
config('CONFIG_USE_SSTRIP', false)
try_config('CONFIG_TARGET_ROOTFS_PARTSIZE', 500)
end
config('CONFIG_GLUON_MINIFY', istrue(env.GLUON_MINIFY))
packages {
'-kmod-ipt-offload',
'-odhcpd-ipv6only',
'-ppp',
'-ppp-mod-pppoe',
'-wpad-mini',
'-wpad-basic',
'gluon-core',
'ip6tables',
}