Commit Graph

13 Commits

Author SHA1 Message Date
Matthias Schiffer aed14db84f build: remove no_opkg
With the removal of ramips-rt305x, all targets come with opkg again.
2021-07-13 21:37:39 +02:00
Matthias Schiffer a9c2db939a features: handle all feature files in a single pass of feature_lib.get_packages()
All defined features need to be known at the same time, otherwise handling
a feed-provided feature definition file would add gluon-web-advanced etc.
to the package list when the corresponding feature flags appear in
GLUON_FEATURES.

Fixes: ee5ec5afe5 ("build: rewrite features.sh in Lua")
2020-08-28 22:27:38 +02:00
Matthias Schiffer ee5ec5afe5 build: rewrite features.sh in Lua
The `features` file is converted to a Lua-based DSL.

A helper function `_` is used in the DSL; this will return the original
string for enabled features, and nil for disabled features. This allows
to use boolean operations on features without making the code too
verbose.

Besides having more readable and robust code, this also fixes the bug
that all files `packages/*/features` were evaluated instead of only
using the feature definitions of currently active feeds.
2020-07-01 20:35:22 +02:00
Matthias Schiffer 0fd5905fc2
build: target_config_lib: introduce concat_list helper 2020-07-01 20:10:40 +02:00
Matthias Schiffer b3edfd292a
build: target_config_lib: do not build unused packages for targets without opkg (#2051)
Normally, we build all nonshared packages (which includes all kernel
modules) to generate an opkg feed for later package installations by
users. On targets without opkg, this just wastes time - disable it.
2020-06-11 02:16:49 +02:00
Matthias Schiffer 3ce43329f5
build: remove now-unneeded function from target_config_lib.lua
target_config.lua and target_config_check.lua don't pass a table of
callbacks anymore, so target_config_lib.lua can by simplified by moving
all the code that was in the returned function to the toplevel.
2020-05-31 02:20:58 +02:00
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
Matthias Schiffer 53690d83be
build: move package list generation to target_config_lib.lua, fix precedence
The precedence of different package lists was broken since #1876,
disallowing removal of GLUON_FEATURES packages via GLUON_SITE_PACKAGES.

Including all package selections, both implicit defaults and explicit
handling in Gluon, the order of precedence is now the following:

1.  OpenWrt defaults (including target-specific defaults)
2.  Device-specific packages from OpenWrt
3.  Generic default packages (from target/generic)
4.  Target default packages (target/$(GLUON_TARGET))
5.  Removal of opkg for tiny targets
6.  Packages derived from GLUON_FEATURES + GLUON_FEATURES_$(class)
7.  GLUON_SITE_PACKAGES
8.  GLUON_SITE_PACKAGES_$(class)
9.  Device-specific packages from target/$(GLUON_TARGET)
10. Device-specific packages from GLUON_$(device)_SITE_PACKAGES

This also contains various pieces of cleanup:

- No hardcoded order of device classes for target_config.lua arguments
  anymore (in fact, the Makefile doesn't know anything about device
  classes now)
- target_conifg_lib.lua only hardcodes the fallback class for x86, no
  other occurences of specific class names
- Feature -> package list mapping is moved from Makefile to the Lua code
  as well (still implemented in Shell though)
2020-05-03 22:05:20 +02:00
Matthias Schiffer 89efe55c7c
build: implement image site_packages using a generic site_var function 2020-05-03 18:00:35 +02:00
David Bauer c9f90c3ef8 build: add class-packages for targets without devices
When adding device classes, targets without devices such as x86 were not
handled. As site and feature packages are included on such a per-device
decision, x86 images ended up without most packages.

Include a class setting for a target and include the class-packages
target-wide when this setting is configured.

Fixes 9c52365077 ("build: introduce device classes")
2020-03-27 23:35:24 +01:00
David Bauer 9c52365077 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.
2020-03-25 02:05:18 +01:00
Matthias Schiffer 78054cddbf
scripts: target_config_lib: fix inclusion of device-specific packages from site.mk
Fixes: 071cf7b20f ("Switch to Lua for target definitions")
2019-09-14 13:46:56 +02:00
Matthias Schiffer 09a09d634a
scripts: avoid global variables in target handler scripts 2019-06-18 01:34:45 +02:00