summaryrefslogtreecommitdiffstats
path: root/include/package.mk
Commit message (Collapse)AuthorAgeFilesLines
* build: add APK package build capabilitiesPaul Spooren2 days1-1/+1
| | | | | | | | | A new option called `USE_APK` is added which generated APK packages (.apk) instead of OPKG packages (.ipk). Some features like fstools `snapshot` command are not yet ported Signed-off-by: Paul Spooren <mail@aparcar.org>
* build: add support to use the mold linker for packagesAndre Heider2023-07-041-0/+5
| | | | | | | If CONFIG_USE_MOLD is set, all target packages will use the mold linker. Except the ones which opted-out via setting PKG_BUILD_FLAGS:=no-mold. Signed-off-by: Andre Heider <a.heider@gmail.com>
* treewide: opt-out of tree-wide mold usageAndre Heider2023-07-041-1/+1
| | | | | | These use linker scripts, which mold doesn't support. Signed-off-by: Andre Heider <a.heider@gmail.com>
* build: export GIT_CEILING_DIRECTORIES for package buildsJeffery To2023-05-311-0/+1
| | | | | | | | | | | | | | | | | | A package may run git as part of its build process, and if the package source code is not from a git checkout, then git may traverse up the directory tree to find buildroot's repository directory (.git). For instance, Poetry Core, a Python build backend, will read the contents of .gitignore for paths to exclude when creating a Python package. If it finds buildroot's .gitignore file, then Poetry Core will exclude all of the package's files[1]. This exports GIT_CEILING_DIRECTORIES for both package and host builds so that git will not traverse beyond $(BUILD_DIR)/$(BUILD_DIR_HOST). [1]: https://github.com/python-poetry/poetry/issues/5547 Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* build: remove backwards compatibility for PKG_USE_MIPS16Andre Heider2023-05-121-6/+0
| | | | | | All package feeds have been refactored to PKG_BUILD_FLAGS:=no-mips16. Signed-off-by: Andre Heider <a.heider@gmail.com>
* build: add a config knob to enable LTO for all packagesAndre Heider2023-03-211-1/+1
| | | | | | This enables LTO for all packages which haven't opted-out. Signed-off-by: Andre Heider <a.heider@gmail.com>
* build: add a config knob to enable gc-sections for all packagesAndre Heider2023-03-211-1/+1
| | | | | | | This enables the linker's garbage collection for all packages which haven't opted-out. Signed-off-by: Andre Heider <a.heider@gmail.com>
* treewide: add support for "lto" in PKG_BUILD_FLAGSAndre Heider2023-03-211-1/+6
| | | | | | | | | | | | | | | | This reduces open coding and allows to easily add a knob to enable it treewide, where chosen packages can still opt-out via "no-lto". Some packages used LTO, but not the linker plugin. This unifies 'em all to attempt to produce better code. Quoting man gcc(1): "This improves the quality of optimization by exposing more code to the link-time optimizer." Also use -flto=auto instead of -flto=jobserver, as it's not guaranteed that every buildsystem uses +$(MAKE) correctly. Signed-off-by: Andre Heider <a.heider@gmail.com>
* treewide: add support for "gc-sections" in PKG_BUILD_FLAGSAndre Heider2023-03-211-1/+6
| | | | | | | | | | | | | | | This reduces open coding and allows to easily add a knob to enable it treewide, where chosen packages can still opt-out via "no-gc-sections". Note: libnl, mbedtls and opkg only used the CFLAGS part without the LDFLAGS counterpart. That doesn't help at all if the goal is to produce smaller binaries. I consider that an accident, and this fixes it. Note: there are also packages using only the LDFLAGS part. I didn't touch those, as gc might have been disabled via CFLAGS intentionally. Signed-off-by: Andre Heider <a.heider@gmail.com>
* treewide: replace PKG_USE_MIPS16:=0 with PKG_BUILD_FLAGS:=no-mips16Andre Heider2023-03-211-8/+13
| | | | | | | Keep backwards compatibility via PKG_USE_MIPS16 for now, as this is used in all package feeds. Signed-off-by: Andre Heider <a.heider@gmail.com>
* build: introduce PKG_BUILD_FLAGS and move PKG_IREMAP to itAndre Heider2023-03-211-2/+14
| | | | | | | | | | | | | | | | | | | PKG_BUILD_FLAGS is a new variable for package Makefiles similar to PKG_FLAGS. It's a whitespace separated list of flags to control various aspects of how a package is build. The build system and/or .config defines the default for each, but every package has the means to override it. Using $flagname enables a flag, no-$flagname disables it. Start with PKG_IREMAP as "iremap". That's easy as no package here nor in any package feed uses it. The default is unchanged: enabled. Packages can opt-out via: PKG_BUILD_FLAGS:=no-iremap (Not that any should, just to illustrate how to use it) Signed-off-by: Andre Heider <a.heider@gmail.com>
* build: make find_md5 reproducible with AUTOREMOVEChristian Marangi2022-09-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | While experimenting with the AUTOREMOVE option in search of a way to use prebuilt host tools in different buildroot, it was discovered that the md5 generated by find_md5 in depends.mk is not reproducible. Currently the hash is generated by the path of the file in addition to the file mod time. Out of confusion, probably, there was an idea that such command was used on the package build_dir. Reality is that this command is run on the package files. (Makefile, patches, src) This is problematic because the package Makefile (for example) change at each git clone and base the hash on the Makefile mtime doesn't really reflect if the Makefile actually changes across a buildroot or not. A better approach is to generate an hash of each file and then generate an hash on the sort hash list. This way we remove the problem of git clone setting a wrong mtime while keeping the integrity of checking if a file changed for the package as any change will result in a different hash. Introduce a new kind of find_md5 function, find_md5_reproducible that apply this new logic and limit it only with AUTOREMOVE option set to prevent any kind of slowdown due to additional hash generation. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* build: handle directory with whitespace in AUTOREMOVE cleanChristian Marangi2022-09-111-2/+2
| | | | | | | | | Package with whitespace in their build directory are not correctly removed when CONFIG_AUTOREMOVE is enabled. This is caused by xargs that use whitespace as delimiters. To handle this use \0 as the delimiter and set find to use \0 as the delimiter. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* build: fix host package unpack if git-src is usedFelix Fietkau2021-11-041-1/+2
| | | | | | | If the package download step is skipped, it needs to be performed for the host build instead. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* download: improve handling of invalid local filesEneas U de Queiroz2021-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 4e19cbc5533: [download: handle possibly invalid local tarballs] added a FORCE rule to downloaded files, so that they will be always checked by download.pl. As a side-effect, check-compile will fail, forcing unnecessary package rebuilds. The check-compile.txt log shows (for libxml2 for example): Considering target file '.../dl/libxml2-2.9.12.tar.gz'. ... prerequisite 'FORCE' of target '.../dl/libxml2-2.9.12.tar.gz' does not exist. Must remake target '.../dl/libxml2-2.9.12.tar.gz'. ... Giving up on target file '...libxml2-2.9.12/.prepared_...'. Giving up on target file '...libxml2-2.9.12/.configured_...'. Giving up on target file '...libxml2-2.9.12/.built'. Giving up on target file '...stamp/.libxml2_installed'. Giving up on target file '.compile'. Then the package is rebuilt even if it is not otherwise needed. To fix this, instead of always forcing the download target to be remade, check its hash first: if it matches, then the FORCE is not added. Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
* Revert "build: use config.site generated by autoconf-lean, drop hardcoded ↵Daniel Golle2021-03-021-1/+1
| | | | | | | | sitefiles" This reverts commit f439e291304a93b982e912dc91b80ca950a594f3. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* build: use config.site generated by autoconf-lean, drop hardcoded sitefilesFelix Fietkau2021-02-281-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: filter out own packages on package version checkFelix Fietkau2021-02-151-2/+2
| | | | | | | This was accidentally dropped in 27a4a71c2408 ("metadata: handle ABI version rebuild tracking for transient dependencies") Signed-off-by: Felix Fietkau <nbd@nbd.name>
* Mostly revert "build: add support for fixing up library soname"Felix Fietkau2021-02-151-2/+0
| | | | | | | | | This reverts commit b12288fa69b171f7c9405518c9bed3581a06f7ce. The patchelf approach is too fragile, and the only users of this have been converted to make patching unnecessary Leave the abi_version_str variable in place in rules.mk Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: add support for fixing up library sonameFelix Fietkau2021-02-141-0/+2
| | | | | | | | | | This makes it possible to declare a package ABI_VERSION independent from the upstream soname by setting PKG_ABI_VERSION in the package makefile. The library filename is fixed up for files installed to packages and to the staging dir. References to the original from executables within the same package are also fixed up Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: fix ABI version rebuild dependencyFelix Fietkau2021-02-141-1/+1
| | | | | | | A stray comma was being appended to the last package version dependency, causing it to be missed for ABI version checks Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: use SPDX license tagsPaul Spooren2021-02-051-5/+2
| | | | | | | | | The license folder is a core part of OpenWrt and all GPL-2.0 licensed. Use SPDX license tags to allow machines to check licenses. Signed-off-by: Paul Spooren <mail@aparcar.org> [rebase, keep some Copyright lines, sharpen commit message] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* build: drop ccache variables from specific targetsSven Wegener2021-01-011-3/+0
| | | | | | | With commit 2ca084cc ("build: improve ccache support") these variables are being set globally and we don't need them for specific targets. Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
* download: handle possibly invalid local tarballsPetr Štetiar2020-11-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently it's assumed, that already downloaded tarballs are always fine, so no checksum checking is performed and the tarball is used even if it might be corrupted. From now on, we're going to always check the downloaded tarballs before considering them valid. Steps to reproduce: 1. Remove cached tarball rm dl/libubox-2020-08-06-9e52171d.tar.xz 2. Download valid tarball again make package/libubox/download 3. Invalidate the tarball sed -i 's/PKG_MIRROR_HASH:=../PKG_MIRROR_HASH:=ff/' package/libs/libubox/Makefile 4. Now compile with corrupt tarball source make package/libubox/{clean,compile} Signed-off-by: Petr Štetiar <ynezz@true.cz>
* build: fix extreme build system slowdown caused by SOURCE_DATE_EPOCH changesFelix Fietkau2020-09-051-0/+2
| | | | | | | | Adding inline shell invocations in per-target variables causes them to be executed over and over again, which causes a significant slowdown. Fix this by evaluating it only once per package directory Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: improve ccache supportRoman Yeryomin2020-07-111-1/+3
| | | | | | | | | | | | | | | | | | Set CCACHE_DIR to $(TOPDIR)/.ccache and CCACHE_BASEDIR to $(TOPDIR). This allows to do clean and dirclean. Cache hit rate for test build after dirclean is ~65%. If CCACHE is enabled stats are printed out at the end of building process. CCACHE_DIR config variable allows to override default, which could be useful when sharing cache with many builds. cacheclean make target allows to clean the cache. Changes from v1: - remove ccache directory using CCACHE_DIR variable - remove ccache leftovers from sdk and toolchain make files - introduce CONFIG_CCACHE_DIR variable - introduce cacheclean make target Signed-off-by: Roman Yeryomin <roman@advem.lv>
* build: Remove STAGING_DIR_HOST references for InstallDev/UninstallDevJeffery To2020-03-011-3/+3
| | | | | | | | | | | | | Build/InstallDev no longer places a file list in $(STAGING_DIR_HOST)/packages; this change removes the creation of $(STAGING_DIR_HOST)/packages and the attempted removal of a STAGING_DIR_HOST file list during package clean. This also changes the host directory passed to Build/UninstallDev from $(STAGING_DIR_HOST) to $(STAGING_DIR)/host, to match the directory passed to Build/InstallDev. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* Revert faulty tree pushFelix Fietkau2019-08-121-1/+1
| | | | | | | | | | | | Revert "mac80211: add new minstrel_ht patches to improve probing on mt76x2" (9861050b85e5381c93d73ffdbc24c130400e0fb8) Revert "kernel: use bulk free in kfree_skb_list to improve performance" (98b654de2e7502507b31f0fb82befbb48f9c8542) Revert "ramips: add preliminary support for WIO ONE" (085141dc5ba5e763e1bf4c1a2fd6957160810ccc) Revert "ramips: add preliminary support for SGE AP-MTKH7-0006 developer board" (b1db6d0539511f60bf65fbde28b16afa31180e34) Revert "build: use config.site generated by autoconf-lean, drop hardcoded sitefiles" (363ce4329d4f6c00b4a7cb83dd1821fafc0d40ad) Revert "toolchain: add autoconf-lean" (fdb30eed03ae56cd87078b64d9b2fac00799e783) Revert "build: allow overriding the filename on the remote server when downloading" (6fa0e07758524eddf20c9b66dfcb55c490e1961e) Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: use config.site generated by autoconf-lean, drop hardcoded sitefilesFelix Fietkau2019-08-121-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: include BUILD_VARIANT in PKG_BUILD_DIRJeffery To2019-08-051-1/+1
| | | | | | | | | | | This changes the default PKG_BUILD_DIR to take BUILD_VARIANT into account (if set), so that packages do not need to manually override PKG_BUILD_DIR just to handle variants. This also updates most base packages with variants to use the updated default PKG_BUILD_DIR. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* include/package.mk: Add support for src-checkout/ folderJohn Crispin2019-07-101-1/+17
| | | | | | | | | This feature is similar to the SRC_TREE_OVERRIDE. However instead of having to manually create a symlink inside the package folder, the buildsystem will check if $(TOP_DIR)/src-checkout/$(PKG_NAME)/.git is present and use this instead. Signed-off-by: John Crispin <john@phrozen.org>
* metadata: handle ABI version rebuild tracking for transient dependenciesJo-Philipp Wich2019-06-211-9/+21
| | | | | | | | | | | | Extend the packageauxvars database to keep a list of possible package dependencies for each provider, then utilize this information in buildroot to resolve the ABI version dependencies of dependent packages up to five levels deep. This should properly trigger rebuilds for packages indirectly depending on other packages whose ABI_VERSION changed. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* build: fix STAGING_DIR cleaning for packagesJeffery To2019-01-301-3/+4
| | | | | | | | | | | | | | | | This fixes two issues with cleaning package files from STAGING_DIR: * CleanStaging currently can only remove files and not directories. This changes CleanStaging to use clean-package.sh, which does remove directories. * Because of the way directories are ordered in the staging files list, clean-package.sh currently tries (and fails) to remove parent directories before removing subdirectories. This changes clean-package.sh to process the staging files list in reverse, so that subdirectories are removed first. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* build: do not override CCACHE_DIR when ccache is disabledJo-Philipp Wich2018-07-241-1/+1
| | | | Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* build: prevent spurious package rebuilds under CONFIG_AUTOREMOVEJo-Philipp Wich2018-05-221-1/+1
| | | | | | | | | | | | | | | | When CONFIG_AUTOREMOVE is enabled, the build system touches an additional ".autoremove" stamp file in the cleaned build directory. Since the autoremove stamp file is touched after the compile process completed, it ends up being the most recent file of the package build directory, causing the timestamp.pl check of depends.mk to erroneously declare the ".built" and ".prepared" stamp files as stale, triggering a forced clean-build submake process. Fix the problem by using the ".built" stamp file as modification time reference when touching the ".autoremove" stamp file. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* build: add support for git submodules with CONFIG_SRC_TREE_OVERRIDEFelix Fietkau2018-04-271-1/+6
| | | | | | | Also work around an issue where git would store the modified workdir in the submodule git config files Signed-off-by: Felix Fietkau <nbd@nbd.name>
* include/package.mk: remove old configured stamps before attempting configurationMatthias Schiffer2017-12-281-1/+1
| | | | | | | | | | Some packages, e.g. busybox, explicitly remove old .configured stamps before attempting configuration, rather than after the actual configuration step. This seems like a good idea, as there will be no stamp left if configuration fails. Change generic rules to work like this, so package- specific rules can be dropped. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* build: allow PKG_PREPARED_DEPENDS and PKG_CONFIG_DEPENDS to be changed after ↵Felix Fietkau2017-12-121-2/+5
| | | | | | | | | including package.mk Reverts commit a9c96ef0ac7ac99e4928f5312f3d0d1252c98328 and replaces it with a different approach Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: fix QUILT related overridesFelix Fietkau2017-05-251-10/+12
| | | | | | They need to be defined before including quilt.mk Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: remove package makefile overlay functionalityFelix Fietkau2017-04-121-7/+0
| | | | | | | | Recent attempts to use it have shown that it does not work properly except for a few undocumented cases. It's better to remove this now to avoid having more people fall into the same trap Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: fix STAMP_PREPARED with quiltFelix Fietkau2017-03-221-1/+1
| | | | | | | quilt.mk needs to be included first, to ensure that STAMP_PREPARED does not include the hash if quilt is used. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: improve performance by avoiding lazy-eval for make shell callsFelix Fietkau2017-03-161-2/+2
| | | | | | | Avoids lots of redundant calls to mkhash on things like package/kernel/linux Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: clean up redundant touching of the package install info fileFelix Fietkau2017-02-261-2/+2
| | | | | | | Instead of using a separate .clean stamp file, remove the install info file on compile, then append the install package list afterwards Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: get rid of host.mkFelix Fietkau2017-02-261-1/+0
| | | | | | Defined required host related variables in toplevel.mk instead Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: keep recursive dependency check stampfiles up to dateFelix Fietkau2017-02-011-0/+3
| | | | | | | | | Since the main stamp file depends on the _check stampfile, the _check stampfile needs to be created on the first run as well. Fixes spurious rebuilds with CONFIG_AUTOREBUILD=y Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: make the touch .autoremove call non-fatalFelix Fietkau2017-01-241-1/+1
| | | | | | | Fixes build issues when there is nothing to do on the compile step (e.g. with unselected packages). Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: do not auto-clean packages where the autoremove step has not runFelix Fietkau2017-01-231-2/+5
| | | | | | | This avoids repeatedly unpacking and rebuilding packages that are failing the build. Re-running the failing step should be much faster. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: fix CONFIG_AUTOREMOVE for packages with multiple variantsFelix Fietkau2017-01-221-2/+4
| | | | | | | | Calling the clean target removes all .ipk files and un-stages the package. Add a new target just for clearing the build dir and call that one instead of the full clean target Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: disable CONFIG_AUTOREMOVE for packages/tools where QUILT is usedFelix Fietkau2017-01-191-5/+7
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* build: include CONFIG_AUTOREMOVE in STAMP_PREPAREDFelix Fietkau2017-01-191-1/+1
| | | | | | Fixes build issues when changing the CONFIG_AUTOREMOVE setting Signed-off-by: Felix Fietkau <nbd@nbd.name>