Commit Graph

133 Commits

Author SHA1 Message Date
Felix Fietkau
3104370455 build: detect broken make version on macOS
Apple ships a broken make version with the Xcode command line tools.
Homebrew installs make as gmake by default in order to not collide with
Apple's version.
Exit with an error if the broken one is used accidentally

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-11-14 14:48:30 +01:00
Adrian Schmutzler
e17529a3e3 Revert "build: process variable exports from toplevel.mk only once"
This reverts commit ef7c34c1d1.

The commit seems to break all buildbots with messages like:

/builder/shared-workdir/build/include/toplevel.mk:15:
  /builder/shared-workdir/build/include/toplevel-vars.mk: No such file or directory

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-16 22:58:44 +02:00
Felix Fietkau
ef7c34c1d1 build: process variable exports from toplevel.mk only once
These run a lot of expensive shell calls, so redundant calls should be
avoided

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-10-16 21:39:09 +02:00
Jo-Philipp Wich
0b82ebaccb Revert "build: create tmp/userids file"
This reverts commit 34cc2c9a99.

The reverted shell code is a very poor reimplementation of the existing
package-metadata.pl usergroup subcommand and the resulting file is not
used anymore, so drop this code.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-14 17:11:06 +02:00
Jo-Philipp Wich
7a29e24dbb build: dump effective user/group id mapping to file
This file can be subsequently used to resolve symbolic user or group names
to their numeric IDs when packing ipk archives.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-14 17:01:44 +02:00
Paul Spooren
34cc2c9a99 build: create tmp/userids file
Multiple packages contain a USERID variable defining required user and
group for the package to run. With the recent addition of
"PKG_FILE_MODES" it is possible to define user and group of specific
files, replacing (possibly insecure) post-inst scripts. These modes are
set during build time and put directly into the packages.

To allow user and group names rather than the numeric values, a mapping
like `/etc/passwd` is required by the `ipkg-build` script, mapping names
defined in "PKG_FILE_MODES" to a numeric value, as the build system does
not create any users during build.

This commit adds a single line to the `prepare-tmpinfo` target, so that
everytime the feeds are updated the *passwd like* content of
`./tmp/userids` is updated.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2020-09-14 10:54:52 +01:00
Adrian Schmutzler
751486b31f build: fix README.md reference after rename
The README file is displayed on "make help", but updating the
command has been overlooked during the README -> README.md
rename.

Fix it.

Fixes: d0113711a3 ("README: port to 21st century")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-12 14:03:17 +02:00
Roman Yeryomin
2ca084ccaa build: improve ccache support
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>
2020-07-11 15:19:53 +02:00
Sergio E. Nemirowski
645b1ec3e2 build: add 'make kernel_xconfig' command
This adds the kernel_xconfig make target.

Signed-off-by: Sergio E. Nemirowski <sergio@outerface.net>
2020-07-08 16:07:05 +02:00
Sergio E. Nemirowski
8fb0b15efd build: add nconfig
Add support for make target nconfig (ncurses)

Reviewed-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Signed-off-by: Sergio E. Nemirowski <sergio@outerface.net>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2020-07-07 19:47:24 +02:00
Eneas U de Queiroz
db6c1214e0 build: add option to treat recursive deps as error
Running make with RECURSIVE_DEP_IS_ERROR=1 will cause a hard failure
when a recursive dependency is detected.  This is useful to apply
stricter Ci tests, for example.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
2020-05-20 17:03:45 +02:00
Eneas U de Queiroz
f827f947ae build: show make output in scripts/config when V=s
This should make debugging build errors in scripts/config a bit easier.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
2020-05-20 17:03:45 +02:00
Jo-Philipp Wich
6c16d64b2a Revert "build: add option to warn on recursive dependency"
This reverts commit 3204430e38.

Reverting this commit in preparation for reverting
dcf3e63a35 ("build: scripts/config - update to kconfig-v5.6") which
introduces various unaddressed build breakages.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-12 00:10:30 +02:00
Eneas U de Queiroz
3204430e38 build: add option to warn on recursive dependency
This addes the option to treat recursive dependencies as warnings
instead of errors, by running make with WARN_RECURSIVE_DEP=1.

Note that the script/config targets will not get rebuilt when you add or
remove WARN_RECURSIVE_DEP while running make.  One must run
'make config-clean' before building config with a different setting.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
2020-04-09 12:51:10 +02:00
Eneas U de Queiroz
8636a17214 build: simplify building *config targets
Instead of passing pkg-config location through a variable when building
qconf (make xconfig), prepend its parent directory to the PATH, as it is
being done for other conf targets.

Use a Makefile pattern rule to group all 'scripts/config/%onf'
(currently conf, mconf, qconf) targets in a single rule.  Add -O2 to
CFLAGS when building them as well.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
2020-04-09 12:51:10 +02:00
Petr Štetiar
965f341aa9 build: fix host menu config targets using ncurses
On a recent Gentoo Linux installation, invoking `make menuconfig`, `make
kernel_menuconfig` or `make kernel_nconfig` in the build system fails,
whereas for example `make menuconfig` in the kernel tree alone works as
expected.

This is happening because STAGING_PREFIX is not defined when kernel's
{menu,n}config target calls pkg-config from the toolchain/host and thus
pkg-config returns an empty value, and the fallback values in the kernel
config script are applied but those are off and the linking fails.

Solution is to use system's pkg-config for all ncurses based menu config
targets in order to provide proper compiler/linker flags.

Ref: FS#2423
Cc: Thomas Albers <thomas.gameiro@gmail.com>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
Tested-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-09-25 12:50:24 +02:00
Petr Štetiar
83c0ee621b build: fix kernel_*config targets on 4.19
Recent kernel versions need toolchain in order to properly configure
kernel, for example to set CC_HAS_ASM_GOTO config symbol, so missing
toolchain leads to the following error while running `make
kernel_oldconfig` on ath79 target with 4.19 kernel in the clean tree:

 init/Kconfig:17: syntax error
 init/Kconfig:16: invalid option
 ./scripts/clang-version.sh: line 15: mips-openwrt-linux-musl-gcc: command not found
 ./scripts/gcc-plugin.sh: line 11: mips-openwrt-linux-musl-gcc: command not found
 net/sched/Kconfig:44: warning: menuconfig statement without prompt
 make[4]: *** [scripts/kconfig/Makefile:69: oldconfig] Error 1

So in order to support this new kernel versions, this patch adds
toolchain as a hard dependency to the kernel_*config targets.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-06-21 15:23:49 +02:00
Jo-Philipp Wich
2d9d57b9de build: rename .packagesubdirs to .packageauxvars
Subsequent commits will put more auxiliary information into this file,
such as the per-package ABI version, so rename the metadata script
subcommand and file names accordingly.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-01-19 14:31:56 +01:00
Felix Fietkau
29b2199eb0 build: fix target metadata scan dependencies
Move SCAN_DEPS to scan.mk to eliminate redundancy with scripts/feeds
Add image/*.mk to SCAN_DEPS for targets to pick up newly added devices

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-07-02 14:27:06 +02:00
Alif M. Ahmad
23dd6db2ea include/toplevel.mk: Add xconfig target
Add xconfig target to include/toplevel.mk, so that ``make xconfig`` can
be invoked from $TOPDIR to use Qt based configuration tool to prepare
.config file.

The qconf related sources are taken from linux 4.9.13 archive.

Signed-off-by: Alif M. Ahmad <alive4ever@live.com>
2017-11-02 15:58:45 +01:00
Alexander Couzens
acc5ab6b92
include/toplevel: set env GIT_ASKPASS=/bin/true
When git-https request a service (e.g. github) which ask for credentials
git will pass this request to the user resulting download.pl to wait for
user input. Set GIT_ASKPASS to stop asking.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
2017-06-08 17:20:55 +02:00
Felix Fietkau
737b063cc2 build: ensure that flock is available for make download
It ensures that make download can parallelize downloads, even when some
packages download the same files (e.g. gcc/initial, gcc/final)

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2017-06-08 11:43:15 +02:00
Sergey Ryazanov
e06d8f0f6f build: new fixes for symlinked .config handling
When running "make {config|defconfig|oldconfig}" with symlinked .config
(e.g. to env/.config) it renames symlink to .config.old, creates new
.config file, and writes the updated configuration into it.

This breaks the desired workflow when changes in the configuration can
be checked using "scripts/env diff" and commited using "scripts/env
save". Since the env/.config file is not updated.

The things become even worse when working with feeds, since feeds script
quite often silently invokes "make {oldconfig|defconfig}" and breaks the
symlink.

Fix this issue by exporting KCONFIG_OVERWRITECONFIG=1, which forces
mconf to overwrite the .config content, instead of renaming it and
creating a new file. This variable is set only if .config is a symlink,
otherwise the variable is not exported and the old behaviour is
preserved.

This change uses the same behaviour as "make menucofig", which has
already been fixed in commit 5bf98b1acc.

Also make a tiny cosmetic update to the "make menuconfig" target code
layout to make it look like other config handling targets.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
2017-05-11 00:53:05 +02:00
Felix Fietkau
ddbb036bbb build: allow val.% targets to bypass the prepare steps
Significantly reduces time spent processing those targets and should
also silence some log clutter which could confuse buildbot

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2017-05-05 13:14:00 +02:00
Sergey Ryazanov
5bf98b1acc build: fix symlinked .config handling
When running "make menuconfig" with symlinked .config (e.g. to
env/.config) it renames symlink to .config.old, creates new .config file
and writes updated configuration here.

This breaks the desired workflow when changes in the configuration could
be checked using "scripts/env diff" and commited with
"scripts/env save". Since the env/.config file is not updated.

Fix this issue by exporting KCONFIG_OVERWRITECONFIG=1, which forces
mconf to overwrite the .config content, instead of renaming it and
creating a new file. This variable is set only if .config is a symlink,
otherwise the variable is not exported and the old behaviour is
preserved.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
2017-04-26 11:34:41 +02:00
Felix Fietkau
b044bd5921 build: remove package makefile overlay functionality
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>
2017-04-12 09:53:06 +02:00
Felix Fietkau
9467ce42da build: get rid of host.mk
Defined required host related variables in toplevel.mk instead

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2017-02-26 13:31:44 +01:00
Baptiste Jonglez
f938de7914 build: fix dependency of kernel_menuconfig target
When running "make kernel_menuconfig" in a clean tree, it fails with:

    make[1]: *** No rule to make target 'tools/quilt/install'.  Stop.

Replacing the dependency with 'tools/quilt/compile' fixes the issue (quilt
and all its prerequisites will be built, and quilt will be installed in
staging_dir).

Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org>
2017-02-12 14:53:29 +01:00
Felix Fietkau
d2ddda691e build: ensure that prereq-build is run before metadata scan from feeds (FS#367)
Fixes ./scripts/feeds update

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2017-01-05 11:50:40 +01:00
Felix Fietkau
7a315b0b5d build: implement make check and make package/X/check
This is intended to be used for a wide array of package sanity checks.

The first check that is implemented is for the hash of downloaded files.
It checks:
  - Missing hash
  - Use of SHA256 instead of MD5
  - dl/<file> hash not matching hash in makefile
  - deprecated MD5SUM variable

The deprecated MD5SUM variable check is skipped for feeds/ until OpenWrt
is updated as well

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-12-17 10:36:25 +01:00
Mathias Kresin
59261cbf38 docs: remove all refrences in Makefiles/scripts
The SDK Makefile still trys to copy the docs folder which was removed
with 882f4d2d63. This causes an SDK build
error.

All other removals are just cleanup.

Signed-off-by: Mathias Kresin <dev@kresin.me>
2016-11-30 10:13:14 +01:00
Jo-Philipp Wich
8cc9224115 sdk: predefine SOURCE_DATE_EPOCH
When building packages within the SDK, there is no Git revision history
available so prepopulate SOURCE_DATE_EPOCH in version.mk, similar to
how we handle REVISION already.

Acked-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2016-10-21 12:43:45 +02:00
John Crispin
1b13b35231 include/toplevel.mk: fix defconfig when ~/.openwrt/defconfig exists - take 2
commit 5b72807416 ("include/toplevel.mk: fix defconfig when
~/.openwrt/defconfig exists") was missing a !

Signed-off-by: John Crispin <john@phrozen.org>
2016-07-06 10:40:12 +02:00
John Crispin
5b72807416 include/toplevel.mk: fix defconfig when ~/.openwrt/defconfig exists
./scripts/feeds update will reset the .config file if ~/.openwrt/defconfig
exists, thus resetting the target to ar71xx.

Signed-off-by: John Crispin <john@phrozen.org>
2016-07-06 09:07:25 +02:00
Felix Fietkau
9ae952cf8c build: split scripts/metadata.pl into target-metadata.pl and package-metadata.pl
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-06-07 08:58:40 +02:00
Hannu Nyman
3193053df7 Centralize setting of all version info to include/version.mk
Centralize setting all version information in include/version.mk
* Set RELEASE env variable in include/version.mk instead of toplevel.mk.
  Stop exporting the variable.
* Remove hardcoded release name from /etc/banner

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2016-05-24 13:30:58 +02:00
Felix Fietkau
470442ea0f build: fix make download in the SDK
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-05-16 11:20:26 +02:00
Felix Fietkau
471ca4197c toplevel.mk: rescan target metadata if the image makefile changes
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-05-11 19:03:35 +02:00
Felix Fietkau
82522dbaee build: introduce SOURCE_DATE_EPOCH variable
SOURCE_DATE_EPOCH is the date of the last modified file using git/svn
as date source.
See https://reproducible-builds.org/specs/source-date-epoch/

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48584
2016-01-31 23:29:07 +00:00
Jo-Philipp Wich
0333da8943 include: group kmod ipk files into a "kernel" subdirectory
This is useful to just use the kmods from an official build while supplying
base packages from a custom feed or the other way around; for just overriding
the kmods with a local repo while using official repos for the rest.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 48475
2016-01-24 15:36:05 +00:00
Felix Fietkau
830c308cf9 build: ignore the linux package in the sdk only for generating package data, not for dependencies
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48171
2016-01-10 16:35:24 +00:00
Felix Fietkau
c390359418 build: prevent host default LDFLAGS from leaking into packages
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48158
2016-01-08 23:18:22 +00:00
Felix Fietkau
dd537242a2 build: filter out relative directory entries from $PATH
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48107
2016-01-03 23:13:03 +00:00
Felix Fietkau
c3d3dbc191 toplevel.mk: fix distclean
- remove logs like "make dirclean" does
- remove key-build*

Signed-off-by: Dirk Neukirchen <dirkneukirchen@web.de>

SVN-Revision: 47397
2015-11-06 10:53:35 +00:00
Jo-Philipp Wich
dea417017e toplevel.mk: drop LD_LIBRARY_PATH overrides
Overriding LD_LIBRARY_PATH for host utilities frequently leads to problems
with host executables loading shared libraries from the staging_dir, leading
to crashes due to incompatible ABIs.

Since most host utilties either embed a proper rpath or are reworked to link
statically we do not need the workaround anymore.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 47103
2015-10-03 09:49:24 +00:00
Rafał Miłecki
164ac62643 include: toplevel: drop unused OPENWRTVERSION variable
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 46906
2015-09-14 07:40:40 +00:00
Steven Barth
d1f6bd2541 toplevel: fix release name
Signed-off-by: Steven Barth <steven@midlink.org>

SVN-Revision: 46899
2015-09-13 18:02:54 +00:00
Jo-Philipp Wich
b052a00c0b toplevel.mk: fix LD_LIBRARY_PATH for host binaries
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 46394
2015-07-17 11:37:20 +00:00
Felix Fietkau
5868331214 build: don't call prereq for any package/symlinks rules
Most of the time, we want to make sure OpenWrt has been configured and
setup before start running make. However, in case of package/symlinks,
forcing prereq as a dependency creates multiple issues:
*when executed on a clean workspace, it will prompt for user input
 and open a menuconfig window before executing the feeds command
*the only way around that is to provide a .config. However, the "prereq"
 target would then run a "make defconfig", which will remove all the
 packages in the .config but from external feeds, as feeds have not been
 installed yet.

The only way to currently work around this, is to generate a fake config
by running "make defconfig", then "make package/symlinks", copy the real
config (which at this point disregards the previously generated config),
and run make defconfig again. Something like this:

make defconfig
make package/symlinks
cp real.config .config
make defconfig

This change is removing the need for the first defconfig, making the
process more logical for OpenWrt users using the package/symlinks target.

Signed-off-by: Mathieu Olivari <mathieu@qca.qualcomm.com>

SVN-Revision: 45657
2015-05-10 11:17:29 +00:00
Felix Fietkau
a0ced5164a build: tell users to do non-paralle builds on errors
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 45457
2015-04-16 12:18:26 +00:00