1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/rustc/rustc.conf
3 # Copyright (C) 2018 - 2022 The T2 SDE Project
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License version 2.
10 # --- T2-COPYRIGHT-NOTE-END ---
12 if [ $stagelevel -gt 1 ] && [ $prefix_auto = 1 ]; then
13 prefix=opt/rust # TODO: maybe a config option
18 cp -v vendor/rustc-ap-rustc_target/src/spec/riscv32{gc,}_unknown_linux_gnu.rs
19 cp -v vendor/rustc-ap-rustc_target/src/spec/riscv64{gc,}_unknown_linux_gnu.rs
20 cp -v compiler/rustc_target/src/spec/riscv32{gc,}_unknown_linux_gnu.rs
21 cp -v compiler/rustc_target/src/spec/riscv64{gc,}_unknown_linux_gnu.rs
23 hook_add prepatch 5 rustc_prepatch
25 # AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore
26 # keep in sync w/ llvm!;-)
29 arm) var_insert targets ';' 'ARM' ;;
30 arm64) var_insert targets ';' 'AArch64' ;;
31 mips*) var_insert targets ';' 'Mips' ;;
32 sparc*) var_insert targets ';' 'Sparc' ;;
33 powerpc*) var_insert targets ';' 'PowerPC' ;;
34 riscv*) var_insert targets ';' 'RISCV' ;;
35 x86*|*) var_insert targets ';' 'X86' ;;
38 rust_target=${arch_target/sparcv*-t2/sparc-t2}
41 sed "/^\[target.${rust_target/-t2-/-unknown-}\]/,/^\[target./ {
42 s,^#*\(cc =\) .*,\1 \"${archprefix}cc\",
43 s,^#*\(cxx =\) .*,\1 \"${archprefix}c++\",
44 s,^#*\(ar =\) .*,\1 \"${archprefix}ar\",
45 s,^#*\(ranlib =\) .*,\1 \"${archprefix}ranlib\",
46 s,^#*\(linker =\) .*,\1 \"${archprefix}cc\",
47 s,^#*\(llvm-config =\).*,\1 \"$sysroot/TOOLCHAIN/tools.cross/bin/llvm-config-x\",
48 }; s,^#*\(targets =\) .*,\1 \"$targets\"," -i config.toml
54 [ $stagelevel -eq 1 ] &&
55 var_append confopt " " "--prefix=$sysroot/TOOLCHAIN/$toolsdir" ||
56 var_append confopt " " "--prefix=$root/$prefix --libdir=$root$libdir"
58 var_append confopt " " "--release-channel=stable"
59 var_append confopt " " "--disable-codegen-tests" # needs llvm's FileCheck
60 var_append confopt " " "--disable-docs"
62 if atstage native; then
63 var_append confopt " " "--llvm-config=llvm-config"
65 var_append confopt " " "--llvm-config=$sysroot/TOOLCHAIN/tools.cross/bin/llvm-config"
66 var_append confopt ' ' "--build=${arch_build/nocross/unknown}"
68 hook_add premake 5 "rustc_config_toml"
70 # rustc specific pseudo toolchain
71 if [ $stagelevel -eq 1 ]; then
72 var_append confopt ' ' "--host=${arch_build/nocross/unknown}"
73 var_append confopt ' ' "--target=${rust_target/-t2-/-unknown-},${arch_build/-nocross-/-unknown-}"
74 var_append confopt " " "--enable-extended" # build cargo, too
76 var_append confopt " " "--enable-local-rust"
77 var_append confopt ' ' "--host=${arch_target/-t2-/-unknown-}"
78 var_append confopt ' ' "--target=${rust_target/-t2-/-unknown-}"
86 hook_add inmake 5 "./x.py build"
87 hook_add postmake 5 "./x.py install"