Commit Graph

13 Commits

Author SHA1 Message Date
Jessica Clarke
35921bba73 tools/build/make.py: Drop problematic Linux hack for bmake bootstrap
Since e2eeea75eb ("Merge bmake-20201117") missing/sys/cdefs.h has
been present in bmake, and _GNU_SOURCE seems to have been defined by
config.h for much longer than that, possibly for the entire time OS
cross-build support has been in-tree, so these are obsolete. Moreover,
since 79e02149fc ("Fix dtrace tools bootstrap on non-FreeBSD after
OpenZFS import"), HAVE_STRLCAT and HAVE_STRLCPY have been defined by our
cross-build headers in order to placate DTrace tools (which is not the
right way to solve that problem, but motivates fixing this one). Commit
4fde40d9b5 ("Merge/update to bmake-20230126") changed the strlcpy.c in
bmake from including config.h directly to including make.h, which means
it includes string.h and thus sees these bogus definitions, causing it
to not define the strlcpy compat function on Linux even though it needs
to and thus failing to link. Thus, fix this whole mess by removing the
hack we no longer need.
2023-01-29 23:53:04 +00:00
Alfredo Dal'Ava Junior
b7ac17b48b tools/build/make.py: fix cross build on Fedora Linux
Fedora defines shell functions for some commands used by FreeBSD build
scripts. Unortunatelly it makes them behave incorrectly for our purposes.

For instance 'which which' returns something like:

which ()
{
    ( alias;
    eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias ...
}

instead of

/usr/bin/which

This patch unsets those functions to restore original/expected behavior

Reviewed by:	emaste, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D36900
2022-11-01 21:04:10 -03:00
Alex Richardson
31ba4ce889 Allow bootstrapping llvm-tblgen on macOS and Linux
This is needed in order to build various LLVM binutils (e.g. addr2line)
as well as clang/lld/lldb.

Co-authored-by: Jessica Clarke <jrtc27@FreeBSD.org>
Test Plan:	Compiles on ubuntu 18.04 and macOS 11.4
Reviewed By:	dim
Differential Revision: https://reviews.freebsd.org/D31057
2021-08-02 14:36:03 +01:00
Alex Richardson
2b181156c8 tools/build/make.py: Avoid calling brew --prefix on macOS unnecessarily
If all the require variables (XCC/XCXX/XCPP/XLD) are already set in the
environment, we don't have to infer a default value for the cross toolchain
path. This avoids an additional `brew --prefix` call when building with
cheribuild (since it already sets all these variables).
2021-03-22 11:55:07 +00:00
Alex Richardson
a26ace4db6 tools/build/make.py: Don't call brew --prefix if --cross-bindir is set
Also updated the logic to use subprocess.run() instead of the old
subprocess.getoutput() which also includes stderr and therefore
can trigger an exception inside Path().exists().

Reported by:	gnn
2021-03-01 12:53:46 +00:00
Alex Richardson
88db1cc9f1 tools/build/make.py: drop workaround for cc --version not being parsed
Previously bsd.compiler.mk was not able to detect the compiler type for
Ubuntu's /usr/bin/cc unless we were invoking the /usr/bin/gcc symlink.
This problem has been fixed by 9c6954329a
so we can drop the workaround from make.py.

Reviewed By:	jrtc27
Differential Revision: https://reviews.freebsd.org/D28323
2021-02-13 13:54:25 +00:00
Alex Richardson
43e083be81 tools/build/make.py: -DNO_CLEAN -> -DWITHOUT_CLEAN 2021-02-03 17:06:07 +00:00
Alex Richardson
d037edf820 tools/build/make.py: Fix macOS build after a920b9817
If we set STRIPBIN, we also have to set XSTRIPBIN since we otherwise
use the host /usr/bin/strip during buildworld. However, this does not
work on macOS since /usr/bin/strip doesn't handle ELF binaries.
2021-01-07 10:55:21 +00:00
Alex Richardson
a920b9817e make.py: Also pass STRIPBIN
This is required for cross-building to allow stripping the installed binaries.

Submitted By:	Henry Vogt <hv@tue.mpg.de>
2020-12-04 15:53:44 +00:00
Ulrich Spörlein
accf961151 GH Actions: Use pre-installed clang packages
Also fix the run by setting up the environment in non-deprecated way.

Always run with --debug to understand better what sort of stuff is happening in
the background. Also split out the bmake bootstrap stage (takes about 31s on
ubuntu, but 1m14 on macOS?)

Drops the dependency on coreutils (realpath, nproc) and thus (?) fixes macOS to
be just as fast (4 logical cores vs 2 physical cores before, go figure.)

Reviewed by:		arichardson
2020-11-26 14:42:16 +00:00
Alex Richardson
d34f599cd2 Revert "When building on Ubuntu bootstrap bmake with bash as the default shell"
This reverts r365950 since the latest bmake update includes fixes for the test
failures that prompted the change.
2020-11-16 11:38:51 +00:00
Alex Richardson
b1365a26e9 When building on Ubuntu bootstrap bmake with bash as the default shell
The Ubuntu /bin/sh (dash) removes all environment variables that contain
characters outside the [a-zA-Z0-9_] range and this breaks the bmake tests that
run as part of bootstrapping bmake.
This can be reverted when the bmake tests have been updated.
2020-09-21 15:49:02 +00:00
Alex Richardson
af6a4c1716 Add a tools/build/make.py script that bootstraps bmake and then runs the build
This makes it possible to compile on non-FreeBSD systems since make will
usually be GNU make there. Even if they include bmake, it will often
either be a broken version or too old to build FreeBSD.

This should be the last commit needed to compile FreeBSD on Linux+macOS.
After over two years, I've finally managed to upstream all our local CheriBSD
changes to allow building on Linux (and as a result of being reviewed by more
people they are slightly less ugly than they were before).

It should now be possible to run the following to build on Linux+macOS if you
have LLVM/Clang 10 or newer installed:
MAKEOBJDIRPREFIX=/somewhere ./tools/build/make.py TARGET=amd64 TARGET_ARCH=amd64 buildworld

I have only tested macOS 15, Ubuntu 18.04 and openSUSE Leap, but other Linux
distributions might also work (as long as they ship a recent GLibc and compiler).

Reviewed By:	emaste (should be fine to commit to tools/)
Differential Revision: https://reviews.freebsd.org/D16767
2020-09-21 15:48:57 +00:00