#!/bin/sh set -eu if [ "$#" -ne 9 ]; then printf '%s\n' \ "usage: configure-cross-toolchain.sh DEST SYSROOT CLANG CLANGXX LLD BUILTINS RUST_EH_PERSONALITY LLVM_AR LLVM_STRIP" >&2 exit 2 fi script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) repo_dir=$(dirname "$script_dir") . "$script_dir/mouse-arch.sh" destination=$1 sysroot=$2 clang=$3 clangxx=$4 lld=$5 builtins=$6 rust_eh_personality=$7 llvm_ar=$8 llvm_strip=$9 target=$MOUSE_CROSS_TARGET for requirement in \ "$clang" "$clangxx" "$lld" "$builtins" "$rust_eh_personality" "$llvm_ar" "$llvm_strip" do if [ ! -f "$requirement" ]; then printf '%s\n' "missing cross-toolchain input: $requirement" >&2 exit 1 fi done install -d -m 0755 "$destination/bin" install -m 0755 \ "$repo_dir/base/support/cross-compiler-driver" \ "$destination/bin/compiler-driver" printf '%s\n' \ "$clang" \ "$clangxx" \ "$sysroot" \ "$lld" \ "$builtins" \ "$rust_eh_personality" \ "$MOUSE_RUST_TARGET" \ >"$destination/compiler.conf" ln -sf compiler-driver "$destination/bin/$target-cc" ln -sf compiler-driver "$destination/bin/$target-c++" ln -sf compiler-driver "$destination/bin/$target-bootstrap-c++" ln -sf "$llvm_ar" "$destination/bin/$target-ar" ln -sf "$llvm_ar" "$destination/bin/$target-ranlib" ln -sf "$llvm_strip" "$destination/bin/$target-strip"