Lines Matching +full:cross +full:- +full:toolchain

3 # -
4 # SPDX-License-Identifier: BSD-2-Clause
31 # This script makes it easier to build on non-FreeBSD systems by bootstrapping
35 # `MAKEOBJDIRPREFIX=~/obj ./tools/build/make.py buildworld -DWITH_FOO`
37 # On Linux and MacOS you may need to explicitly indicate the cross toolchain
39 # - setting XCC/XCXX/XLD/XCPP to the paths of each tool
40 # - using --cross-bindir to specify the path to the cross-compiler bindir:
42 # --cross-bindir=/path/to/cross/compiler buildworld -DWITH_FOO TARGET=foo
44 # - using --cross-toolchain to specify the package containing the cross-compiler
47 # --cross-toolchain=llvm@NN buildworld -DWITH_FOO TARGET=foo
50 # On MacOS, this tool will search for an llvm toolchain installed via brew and
51 # use it as the cross toolchain if an explicit toolchain is not specified.
69 "universe-toolchain",
73 "kernel-toolchains",
90 bmake_build_dir = objdir_prefix / "bmake-build"
91 bmake_install_dir = objdir_prefix / "bmake-install"
93 bmake_config = bmake_install_dir / ".make-py-config"
96 "sh", "-c", ". \"$0\"/VERSION; echo $_MAKE_VERSION", bmake_source_dir],
106 bmake_binary, "-r", "-f", "/dev/null", "-V", "MAKE_VERSION"],
115 "--with-default-sys-path=.../share/mk:" +
117 "--with-machine=amd64", # TODO? "--with-machine-arch=amd64",
118 "--without-filemon", "--prefix=" + str(bmake_install_dir)]
147 run(["sh", bmake_source_dir / "boot-strap"] + configure_args,
149 run(["sh", bmake_source_dir / "boot-strap", "op=install"] + configure_args,
165 x.startswith(var + "=") or x == ("-D" + var) for x in sys.argv[1:])
174 varname + " or pass --cross-bindir=/cross/compiler/dir/bin" +
175 " or --cross-toolchain=<package>")
185 run([guess, "--version"])
189 # Avoid calling brew --prefix on macOS if all variables are already set:
203 def brew_prefix(package: str) -> str:
204 path = subprocess.run(["brew", "--prefix", package], stdout=subprocess.PIPE,
207 return path.decode("utf-8")
209 def binary_path(bindir: str, binary_name: str) -> "Optional[str]":
217 def cross_toolchain_bindir(binary_name: str, package: "Optional[str]") -> str:
218 # default to homebrew-installed clang on MacOS if available
239 parser.add_argument("--host-bindir",
243 parser.add_argument("--cross-bindir", default=None,
247 parser.add_argument("--cross-compiler-type", choices=("clang", "gcc"),
249 help="Compiler type to find in --cross-bindir (only "
252 parser.add_argument("--cross-toolchain", default=None,
256 parser.add_argument("--host-compiler-type", choices=("cc", "clang", "gcc"),
258 help="Compiler type to find in --host-bindir (only "
260 parser.add_argument("--debug", action="store_true",
262 parser.add_argument("--bootstrap-toolchain", action="store_true",
263 help="Bootstrap the toolchain instead of using an "
265 parser.add_argument("--clean", action="store_true",
267 "-DWITHOUT_CLEAN")
268 parser.add_argument("--no-clean", action="store_false", dest="clean",
270 "-DWITHOUT_CLEAN")
293 "when building on non-FreeBSD")
298 # FIXME: this should take values like `clang-9` and then look for
299 # clang-cpp-9, etc. Would alleviate the need to set the bindir on
303 "clang", "clang++", "clang-cpp")
314 # On non-FreeBSD we need to explicitly pass XCC/XLD/X_COMPILER_TYPE
319 "cpp" if use_cross_gcc else "clang-cpp")
330 strip_binary = "llvm-strip"
343 # at -j1 cleandir+obj is unbearably slow. AUTO_OBJ helps a lot
344 debug("Adding -DWITH_AUTO_OBJ")
345 bmake_args.append("-DWITH_AUTO_OBJ")
347 bmake_args.append("-DWITHOUT_CLEAN")
351 # time cleaning directories instead of just doing a rm -rf ${.OBJDIR}
352 want_clean = input("You did not set -DWITHOUT_CLEAN/--(no-)clean."
355 bmake_args.append("-DWITHOUT_CLEAN")