aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlex Richardson <Alexander.Richardson@cl.cam.ac.uk>2020-12-22 16:14:32 +0000
committerAlex Richardson <arichardson@FreeBSD.org>2021-01-07 10:55:21 +0000
commitd037edf82071d8efb5a58d8d1a923cdfea2e0a7c (patch)
tree0b1e0b62324d65fdb07a3f5d63704faa9cc6eb08 /tools
parent7fa2f2a62f04f095e1e27ad55aa22a8f59b1df8f (diff)
downloadsrc-d037edf82071d8efb5a58d8d1a923cdfea2e0a7c.tar.gz
src-d037edf82071d8efb5a58d8d1a923cdfea2e0a7c.zip
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.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/build/make.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/tools/build/make.py b/tools/build/make.py
index d06686f8be63..146d4a7b6d47 100755
--- a/tools/build/make.py
+++ b/tools/build/make.py
@@ -207,8 +207,8 @@ if __name__ == "__main__":
parsed_args.host_bindir)
# Using the default value for LD is fine (but not for XLD!)
- use_cross_gcc = parsed_args.cross_compiler_type == "gcc"
# On non-FreeBSD we need to explicitly pass XCC/XLD/X_COMPILER_TYPE
+ use_cross_gcc = parsed_args.cross_compiler_type == "gcc"
check_required_make_env_var("XCC", "gcc" if use_cross_gcc else "clang",
parsed_args.cross_bindir)
check_required_make_env_var("XCXX",
@@ -219,9 +219,26 @@ if __name__ == "__main__":
parsed_args.cross_bindir)
check_required_make_env_var("XLD", "ld" if use_cross_gcc else "ld.lld",
parsed_args.cross_bindir)
- check_required_make_env_var("STRIPBIN",
- "strip" if use_cross_gcc else "llvm-strip",
- parsed_args.cross_bindir)
+
+ # We also need to set STRIPBIN if there is no working strip binary
+ # in $PATH.
+ if not shutil.which("strip"):
+ if sys.platform.startswith("darwin"):
+ # On macOS systems we have to use /usr/bin/strip.
+ sys.exit("Cannot find required tool 'strip'. Please install the"
+ " host compiler and command line tools.")
+ if parsed_args.host_compiler_type == "clang":
+ strip_binary = "llvm-strip"
+ else:
+ strip_binary = "strip"
+ check_required_make_env_var("STRIPBIN", strip_binary,
+ parsed_args.cross_bindir)
+ if os.getenv("STRIPBIN") or "STRIPBIN" in new_env_vars:
+ # If we are setting STRIPBIN, we have to set XSTRIPBIN to the
+ # default if it is not set otherwise already.
+ if not os.getenv("XSTRIPBIN") and not is_make_var_set("XSTRIPBIN"):
+ # Use the bootstrapped elftoolchain strip:
+ new_env_vars["XSTRIPBIN"] = "strip"
bmake_binary = bootstrap_bmake(source_root, objdir_prefix)
# at -j1 cleandir+obj is unbearably slow. AUTO_OBJ helps a lot