Commit Graph

134 Commits

Author SHA1 Message Date
Doug Kerr 7d0fb2cc34 build: drop support for python 3.6
python 3.6 EOL was Dec. 2021
buildbot is running debian 10 which ships with 3.7
meson 0.62+ requires 3.7

Signed-off-by: Doug Kerr <dek3rr@gmail.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz> [rebased]
2023-05-22 13:23:35 +02:00
Michael Pratt e2f9fa4204
prereq-build: remove python 2 cleanup recipe
This reverts commit 3b68fb57c9.

After refactoring build checks to update old symlinks,
and after a long time of no python 2 support,
this is no longer needed.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
2023-05-21 19:39:35 +02:00
Michael Pratt ffd7c05aa7
prereq-build: add check for true and false
Some uses cases, like with autotools, need a path for 'true'
if we use them to force something to skip.

This will work by default on Linux hosts,
and require MacOS hosts to get coreutils,
which is currently installed in the CI
for 'macos-latest' host.

In the future, prereq stage can be reworked
to search for the actual binary
instead of relying on env.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
2023-05-04 06:07:23 +02:00
Christian Marangi 7af1713a29
prereq-build: limit argp/fts/obstack/libintl.h to Linux OS
BSD based OS have different fixup and doesn't require these header.
Limit these Header to Linux based OS.

Fixes: 36bc306ae6 ("prereq-build: add extra check for elfutils required header")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-01-10 13:07:14 +01:00
Christian Marangi 36bc306ae6
prereq-build: add extra check for elfutils required header
While testing tools build on an alpine image it was found that with musl
libc some header are missing for elfutils tool.

Add extra prereq-build check to make sure these header are present in
the system to correctly compile host tools.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-01-09 21:25:06 +01:00
Christian Marangi 848b3445fb
prereq-build: use RequireCHeader test for ncurses prereq
RequireCHeader is a generilized version of the ncurses prereq test. Use
that indetad.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-01-09 21:25:06 +01:00
Tony Butler f595bebc7f
build: add gzip to prereq-build.mk
gzip has never been checked for, a system without it would be rare, fix
it anyway

Signed-off-by: Tony Butler <spudz76@gmail.com>
2022-12-06 23:53:45 +01:00
Christian Marangi c092b3ba63
include/prereq-build: fix ldconfig-stub symlink on macos and BSD OSs
Some OS may have the true bin to a different location than /bin/true.
BSD based system and macos have true on /usr/bin/true.

Fix this by checking both location and take the one available in the
system.

Reported-by: Sergey V. Lobanov <sergey@lobanov.in>
Suggested-by: Huangbin Zhan <zhanhb88@gmail.com>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2022-09-27 16:54:42 +02:00
Rosen Penev 805be7e90e
prereq-build: add check for stdlib
One way to solve the python3 dependency check is to install
python3-minimal instead of python3 on Debian based systems.
Unfortunately, this results in a fairly unusable python.

Added check for ntpath, which is how the issue originally presented
itself.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-09-11 16:12:29 +02:00
Rosen Penev be6f012551
prereq-build: fix python distutils detection
Debian and by extension Ubuntu packages distutils in a suboptimal way
where import distutils works but none of the methods do.

This alternative check verifies that distutils is actually usable.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-09-11 16:12:24 +02:00
Petr Štetiar eae2fb8027 build: provide xxd -i with scripts/xxdi.pl
Dependency on xxd was added in commit c4dd2441e7 ("tools: add xxd
(from vim)") as U-Boot requires xxd to create the default environment
from an external file.

Later in commit 2b94aac7a1 ("tools: xxd: use more convenient source
tarball"), xxd from another source was used instead, but that source is
currently unavailable, so let's fix it by using simple xxdi.pl Perl
script instead.

Fixes: #10555
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2022-09-06 08:04:53 +02:00
Oscar Molnar a9e8eec221 build: add support for python3.11 and higher
python3.11 beta is out but fails to run the makefile currently
this supports python versions from 3.6 to 3.99 with the python3 binary
it also checks specifically for 3.11 as it is the latest version out

Signed-off-by: Oscar Molnar <oscar@tymscar.com>
2022-08-13 21:13:08 +02:00
Paul Spooren fd2f3136ca
build: do not require git/rsync for ImageBuilder
The ImageBuilder does not need git or rsync since it only glues files
together, packages are downloaded via wget and not rsync.

Signed-off-by: Paul Spooren <mail@aparcar.org>
[ solve conflict with additional git prereq test ]
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2022-07-06 01:17:52 +02:00
Mark Mentovai f614332197 include/prereq-build.mk: macOS cross build improvements
This updates prereq-build.mk to find a suitable realpath utility, and
adds another place to look for a suitable getopt utility.

realpath has been used most notably by scripts/ipkg-build since
commit bb95be9265 ("scripts,ipkg-build: use realpath for pkg_dir")
and there are assorted other uses of it during a build.
It is ordinarily provided by GNU coreutils. This adds a SetupHostCommand
to locate it either under its own name or under grealpath, the name that
it will be available as under MacPorts or Homebrew, which use
--program-prefix=g.

Similarly, update the SetupHostCommand for getopt to be able to locate a
util-linux getopt at the default path used by MacPorts, in the same
fashion that
commit cc16f5d73e ("build: try to find getopt in macOS homebrew's standard location")'
did for Homebrew. As there is no standard alternative --program-prefix
for util-linux utilities in the way that GNU packages often use a "g"
prefix, this path-based approach is required in case a non-util-linux
getopt (such as one provided by an OS) shadows the util-linux getopt
in the PATH.

Signed-off-by: Mark Mentovai <mark@moxienet.com>
2022-06-24 17:07:56 +02:00
Christian 'Ansuel' Marangi ab1f3a8706 prereq-build: add additional git detection
With some OS (Guix) the git submodule command is wrapped in
a script. Current logic parse the git submodule script directly.
If it's wrapped the prereq check wrongly fails while 'git submodule
--recursive' is actually available.
Add an additional check that try to directly use the 'git submodule'
command to check if the prereq is satisfied.

Fixes: #9986
Reported-by: Attila Lendvai <attila@lendvai.name>
Suggested-by: Attila Lendvai <attila@lendvai.name>
Signed-off-by: Christian 'Ansuel' Marangi <ansuelsmth@gmail.com>
2022-06-09 15:30:33 +02:00
Damien Mascord 6a5b4228e3 build: fix ldconfig executable error in python
The empty executable is causing problems with meson builds, due to the
error: OSError: [Errno 8] Exec format error: 'ldconfig'

This patch changes the empty ldconfig stub to symlink to /bin/true to
work around this issue.

Fixes: FS#4117
Fixes: 3bd31cc4d2 ("tools/meson: update to 0.60.0")

Signed-off-by: Damien Mascord <tusker@tusker.org>
Tested-by: Aleksander Jan Bajkowski <olek2@wp.pl> # Tested on Debian 11
Tested-By: Lucian Cristian <lucian.cristian@gmail.com>
Tested-By: Baptiste Jonglez <git@bitsofnetworks.org>
Cc: Rosen Penev <rosenp@gmail.com>
2021-11-02 18:18:00 +01:00
Paul Spooren 56ea2bf2ee build: prereq detect Python 3.10 for `python3` binary
While the binary `python3.10` is correctly detected by the build system
the default `python3` binary is currently not detected if pointing to a
Python 3.10 installation.

Fix this by extending the grep regex.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-10-10 15:25:58 +01:00
Paul Spooren 0d1ebf0d6d build: fix `which` detection on Fedora & MacOS
Fix Fedora 34/35 issue where 'which' detection of 'which' wasn't working
because Fedora use alias and proc

Fixup of fca5ad55d2 prereq-build: fix `which` detection on Fedora

Reported-by: Jani Partanen <rtfm@iki.fi>
Suggest-by: Etienne Champetier <champetier.etienne@gmail.com>
Tested-by: Georgi Valkov <gvalkov@abv.bg>
Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-10-02 19:53:24 -10:00
Paul Spooren 16e83a7491 prereq-build: revert "fix `which` detection on Fedora"
This reverts commit fca5ad55d2.

Causes problems on MacOS host systems.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-09-30 18:32:20 -10:00
Jani Partanen fca5ad55d2 prereq-build: fix `which` detection on Fedora
Fix Fedora 34/35 issue where 'which' detection of 'which' wasn't working
because Fedora use alias and proc

Signed-off-by: Jani Partanen <rtfm@iki.fi>
[fix commit subject and message]
Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-09-30 12:31:41 -10:00
Marcin Juszkiewicz e1c03ca185 prereq-build: recognize Python 3.10
Fedora 35 contains Python 3.10 as default version. Make use of it.

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
[fix commit subject]
Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-09-28 23:49:02 -10:00
Andre Heider 60af8d7533 prereq-build: require python3-distutils
Debian and Ubuntu ship a python3-minimal package which does not include
the distutils module. This is not supported by upstream and can be
considered a broken python distribution.

In practice, many scripts depend on said module, and this is a reoccuring
pain point for building various OpenWrt packages.

Require and check for said module, enough time has been wasted on this.

A list of just the most recent issues:
https://github.com/openwrt/packages/pull/16304
https://github.com/openwrt/packages/pull/16027
https://github.com/openwrt/packages/pull/15443
https://github.com/openwrt/packages/pull/14394
https://github.com/openwrt/packages/pull/12909
https://github.com/openwrt/packages/issues/12443
https://github.com/openwrt/packages/pull/11035
https://github.com/openwrt/packages/issues/10993

Signed-off-by: Andre Heider <a.heider@gmail.com>
2021-08-21 16:31:20 +02:00
Rosen Penev 9bf654ac47 prereq-build: diff requirement to GNU
tools/quilt requires GNU diffutils to compile. Failure can be simulated
by installing Alpine Linux without diffutils.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-06-12 15:54:13 -10:00
Karl Palsson 81d0ddc806 prereq-build: g++ formatting and consistency fixes
Remove \n that mangles output, and fix inconsistent version name check.

Example before:

Build dependency: Please install the GNU C++ Compiler (g++) 6 or later
Build dependency: \nPlease reinstall the GNU C++ Compiler (4.8 or later) - it appears to be broken
Build dependency: Please install ncurses. (Missing libncurses.so or ncurses.h)

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2021-05-23 15:11:38 +02:00
Bas Mevissen f68c9474ac Extend checks on build prerequisites for building OpenWRT core
OpenWRT requires a number of Perl modules to be installed. It wasn't checking on all of them.
This patch adds checks for Perl FindBin, File::Copy, File::Compare and Thread::Queue modules.

Failing to install these, will have the build break at some point. By adding these to the
prereq-build.mk script, they are checked on forehand.

Tested on a Fedora 33 and 34 (beta) that was freshly installed. Fedora appears to
break up Perl modules into small packages that need to be installed for the build to succeed.

Signed-off-by: Bas Mevissen <abuse@basmevissen.nl>
2021-05-08 12:43:45 +02:00
Kevin Darbyshire-Bryant 8c8496435a build: add GNU install to prerequisites
The recent removal of usbutils from core and replacement by hwdata in
packages has exposed hwdata's requirement for certain GNU options on
'install' (-T)  Other packages (sqm-scripts) have openwrt specific
makefile sections to avoid GNU options but I suspect this is going to
get harder in the future.

Add GNU install as a prerequisite and link into
$STAGING_DIR/host/etc/bin as per similar GNU utils

This resolves an issue building under MacOS which would otherwise use a
non-GNU options aware version of 'install'

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2021-03-24 23:51:57 +00:00
Andre Heider 7379f8bd3e build: prereq: drop support for Python 3.5
The final Python 3.5 release was 3.5.10 in September 2020 [0].
This release series is now End-of-Life (EOL).

The only LTS distribution that still only ships Python 3.5 is Ubuntu 16.04,
which will be EOL in April 2021 [1].

The meson build system bumped their python requirement to 3.6 for the 0.57.0
release. This patch ensures that OpenWrt can update meson while still
relying on the host python.

[0] https://www.python.org/dev/peps/pep-0478/#id4
[1] https://ubuntu.com/about/release-cycle
[2] https://mesonbuild.com/Release-notes-for-0-57-0.html#minimum-required-python-version-updated-to-36

Signed-off-by: Andre Heider <a.heider@gmail.com>
[python3.6+ in README.md]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2021-03-15 14:00:44 +01:00
Petr Štetiar 13069b1a1d build: add which command to build requirements
`which` utility is not shipped by default for example on recent Arch
Linux and then any steps relying on its presence fails, like for example
following Python3 prereq build check:

 $ python3 --version
 Python 3.9.1

 $ make
 /bin/sh: line 1: which: command not found
 ...
 Checking 'python3'... failed.

So make `which` utility host build requirement.

References: PR#3820 FS#3525
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2021-03-03 22:51:39 +01:00
Petr Štetiar cae69d5581 build: fix checks for GCC11
Fedora 34 already uses GCC11.

Reported-by: Marcin Juszkiewicz <marcin-openwrt@juszkiewicz.com.pl>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2021-03-03 22:51:39 +01:00
Petr Štetiar ac7034cd12 build: make GCC version 6+ minimal host build requirement
Currently minimal GNU supported GCC version is 7 (from May 2, 2017),
buildbots are using default GCC version 6 on Debian 9 (old stable),
current Debian stable has GCC version 8.3.0.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2021-03-03 22:51:39 +01:00
Paul Spooren 6dba010157 build/prereq: require make 4.1 or later
FS#2086 "IS_TTY in the makefile is broken" reports flawed detection of
stdout piping to a file. The issue describes how e.g. terminal color
codes and up in log files if running make like `make > log.txt`.

The proposed solution uses the make variable "MAKE_TERMOUT", which was
introduced in make 4.1. All major distributions seem to updated to 4.1
or later, so this ideally dosen't break anything.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-02-15 16:35:49 -10:00
Paul Spooren a17b8eaa2e build: use SPDX license tags
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>
2021-02-05 14:54:47 +01:00
Paul Spooren cc9d5b5a48 build/prereq: merge ifndef IB block together
Multiple prereq checks are only required within the build system but not
for the ImageBuilder. These checks are excluded by using ifndef IB.

This commit merges the three ifndef IB blocks together.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2020-12-31 09:30:01 -10:00
Stijn Tintel 0ba83a7577 build: require rsync
It seems to be required to build toolchain/kernel-headers.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2020-12-07 18:23:13 +02:00
Rosen Penev e224a9a98f prereq-build: add python 3.9 support
Fixes unmet dependency issue.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-11-24 23:40:39 -10:00
Felix Fietkau cc16f5d73e build: try to find getopt in macOS homebrew's standard location
It is not symlinked to /usr/local/bin by default

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-11-14 14:48:30 +01:00
Sven Roederer ae12a747ca build, imagebuilder: Do not require compilers
The buildroot and SDK both require the compilers (gcc, g++) to be
installed on the host system, however the ImageBuilder uses precompiled
binaries.

This patch changes the prerequirements checks to skip the checking for
the compilers if running as ImageBuilder. A similar change has been
made for libncurses-dev in 4a1a58a3e2.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
Acked-by: Paul Spooren <mail@aparcar.org>
2020-10-09 01:48:47 +01:00
Felix Fietkau 6c29604438 build: set up host command for egrep
It is used for the kernel build and uses GNU specific features

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-08-06 13:17:13 +02:00
Paul Spooren 4a1a58a3e2 build, imagebuilder: Do not require libncurses-dev
The buildroot and SDK both require `libncurses-dev` to be installed on
the system, however the ImageBuilder uses precompiled binaries.

This patch changes the prerequirements checks to skip the
`libncurses-dev` part if running as ImageBuilder.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2020-06-03 16:49:28 +02:00
Rosen Penev dc467eac38 prereq-build: test for perl's Data::Dumper
Required for installation of autoconf:

make[5]: Entering directory `/openwrt/build_dir/host/autoconf-2.69'
Making all in bin
make[6]: Entering directory `/openwrt/build_dir/host/autoconf-2.69/bin'
autom4te_perllibdir='..'/lib AUTOM4TE_CFG='../lib/autom4te.cfg'
../bin/autom4te -B '..'/lib -B '..'/lib         --language M4sh --cache
 '' --melt ./autoconf.as -o autoconf.in

Can't locate Data/Dumper.pm in @INC (@INC contains: ../lib
/usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at
../lib/Autom4te/C4che.pm line 33.
BEGIN failed--compilation aborted at ../lib/Autom4te/C4che.pm line 33.
Compilation failed in require at ../bin/autom4te line 40.
BEGIN failed--compilation aborted at ../bin/autom4te line 40.
make[6]: *** [autoconf.in] Error 2

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-03 16:49:28 +02:00
Kevin Darbyshire-Bryant 35a8657a40 build: prereq: change minimum make version to 3.82
undefine was added in make 3.82 which is now some 10 years ago, some
make scripts are beginning to use 'undefine'

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2020-04-29 14:26:23 +01:00
Kevin Darbyshire-Bryant 1fb3c003d6 build: prereq: tidy gcc version checks
There is a restriction in the number of parameters(10)  that may be passed to
the SetupHostCommand macro so continually adding explicit gcc'n' version
checks ends up breaking the compiler check for the later versions and
oddballs like Darwin as was done in 835d1c68a0 which added gcc10.

Drop all the explicitly specified gcc version checks.  If a suitable gcc
compiler is not found, it may be specified at the dependency checking
stage after which that version will be symlinked into the build staging
host directory.

eg. 'CC=gccfoo CXX=g++foo make prereq'

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Acked-by: Jo-Philipp Wich <jo@mein.io>
2020-03-24 14:42:52 +00:00
Robert Marko 835d1c68a0
build: add GCC 10 version detection
Lets add GCC 10 detection to the build system as distributions like Fedora 32 have started shipping with it.
Some tools like mtd-utils need work to compile under GCC10, but that will be next step.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2020-03-23 02:12:30 +01:00
Kevin Darbyshire-Bryant a5100a0bd1 build: simplify gnu-getopt search
getopt is the only command where /usr/local/bin is specified explicitly.
All other commands are assumed to exist in the PATH in one form or
another.  Remove this exception and require gnugetopt/getopt to be in
the user's PATH.

In the case of macos Homebrew, getopt is 'keg only' hence not linked
into /usr/local/bin whilst other commands are linked and likely found by
virtue of /usr/local/bin being in PATH.

Since 2019 Homebrew is very reluctant to install links that have
potential to override default OS behaviour, eg: following instructions
on our current 'how to build on macos' wiki page:

$ brew ln gnu-getopt --force
Warning: Refusing to link macOS-provided software: gnu-getopt
If you need to have gnu-getopt first in your PATH run:
  echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc

A better option for macos is to link getopt as 'gnugetopt' in
/usr/local/bin, thus the build system will find 'gnugetopt' but other
applications looking for just 'getopt' will find the original macos
binary.

Ultimately it makes sense that 'GNU' dependencies are placed in
/usr/local/bin and /usr/local/bin is included in the user's PATH.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2020-03-02 11:42:31 +00:00
Kevin Darbyshire-Bryant 4d87963381 build: add xargs as prerequisite
Build system needs an 'xargs' that supports '-r' which darwin doesn't.
Homebrew installs a 'gxargs' with the findutils package so look for
'gxargs' as well as 'xargs'

This is a bit of a 'fun' corner case anyway. xargs is only required by
the build if 'CONFIG_AUTOREMOVE' is set and after the build system has
built 'tools/findutils' we have a fully working xargs for host anyway.
Until that time we have to rely on the host's xargs implementation.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2020-02-29 20:55:37 +00:00
Thomas Weißschuh 2066ee09d9 build: prereq: add support for Python 3.8
Add support for Python 3.8 which was released Oct. 14, 2019.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
[added missing commit description, simplified version check]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-11-14 22:53:31 +01:00
Petr Štetiar c001ace8bd build: prereq: simplify Python 3 version checks
We don't need to check if python3.5 binary is actually Python 3.5+.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-11-14 22:53:31 +01:00
Jo-Philipp Wich 9bb5dac593 build: fix seq host tool check
Problem found on alpine linux when trying to `./scripts/feeds update -a`,
which results in `Build dependency: Missing seq command`.

Ref: https://github.com/openwrt/openwrt/pull/1926
Suggested-by: imShara <shara@protonmail.com>
[reworded commit and turned faulty Sob into Suggested-by]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-18 19:48:49 +02:00
Felix Fietkau 46a129194d build: adjust gcc/g++ version checks for newer apple compilers
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-10-10 13:43:04 +02:00
Petr Štetiar 3b68fb57c9 build: cleanup possibly dangling Python 2 host symlink
When bumping buildroot to Python 3, we need to assure, that Python
symlink in staging bin directory points to Python >= 3.5 as well.

We can't rely completly just on SetupHostCommand as its executed only in
cases when the $(STAGING_DIR_HOST)/bin/python doesn't already exist, so
we need to remove it before running SetupHostCommand.

Acked-by: Yousong Zhou <yszhou4tech@gmail.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-07-26 08:09:16 +02:00