[rust] add ohos build config

Signed-off-by: wuhuiquan <wuhuiquan4@huawei.com>
This commit is contained in:
wuhuiquan
2024-11-14 12:07:27 +08:00
parent f003e97a6a
commit 13d48ae1a4
8 changed files with 49 additions and 8 deletions
+5 -2
View File
@@ -56,7 +56,10 @@ if [ "${host_platform}" = "linux" ] && [ ${host_cpu} = "x86_64" ]; then
cp ${shell_path}/config.toml ${rust_source_dir}
chmod 750 ${shell_path}/tools/*
cp ${shell_path}/tools/* ${rust_source_dir}/build/
update_config_toml_clang ${rust_tools}/clang/ohos/linux-x86_64/llvm/bin clang llvm-ar
update_config_toml_clang ${rust_tools}/ohos-sdk/linux/12/native/llvm/bin clang llvm-ar
update_config_toml_clang ${rust_tools}/ohos-sdk/linux/12/native/llvm/bin aarch64-unknown-linux-ohos-clang llvm-ar
update_config_toml_clang ${rust_tools}/ohos-sdk/linux/12/native/llvm/bin armv7-unknown-linux-ohos-clang llvm-ar
update_config_toml_clang ${rust_tools}/ohos-sdk/linux/12/native/llvm/bin x86_64-unknown-linux-ohos-clang llvm-ar
update_config_toml_clang ${rust_tools}/mingw-w64/ohos/linux-x86_64/clang-mingw/bin x86_64-w64-mingw32-clang x86_64-w64-mingw32-ar
elif [ "${host_platform}" = "darwin" ] && [ ${host_cpu} = "x86_64" ]; then
curl -O -k -m 300 ${rust_down_net}/2023-07-13/rustc-1.71.0-x86_64-apple-darwin.tar.xz
@@ -72,7 +75,7 @@ else
echo "Unsupported platform: $(uname -s) $(uname -m)"
fi
mv ${rust_down_dir}/*.tar.xz ${rust_source_dir}/build/cache/2023-07-13/
cp ${rust_down_dir}/*.tar.xz ${rust_source_dir}/build/cache/2023-07-13/
curl -O -k -m 300 ${rust_down_net}/rustc-1.72.0-src.tar.gz
tar xf rustc-1.72.0-src.tar.gz
+26 -6
View File
@@ -4,9 +4,11 @@ changelog-seen = 2
[llvm]
download-ci-llvm = false
targets = "X86;AArch64;ARM"
cflags = "-fstack-protector-all"
cxxflags = "-fstack-protector-all"
[build]
target = ["x86_64-unknown-linux-gnu", "x86_64-pc-windows-gnullvm"]
target = ["x86_64-unknown-linux-gnu", "x86_64-pc-windows-gnullvm", "armv7-unknown-linux-ohos", "x86_64-unknown-linux-ohos", "aarch64-unknown-linux-ohos"]
submodules = false
compiler-docs = false
extended = true
@@ -16,8 +18,8 @@ tools = [
docs = false
vendor = true
#verbose = 1
#sanitizers = true
#profiler = true
sanitizers = true
profiler = true
[rust]
optimize = true
@@ -27,8 +29,8 @@ lto = "thin-local"
backtrace = false
description = "xxxxx"
channel = "nightly"
#strip = true
#stack-protector = "all"
strip = true
stack-protector = "strong"
[install]
bindir = "bin"
@@ -38,7 +40,25 @@ libdir = "lib"
cc = "clang"
cxx = "clang++"
linker = "clang"
ar = "ar"
ar = "llvm-ar"
[target.aarch64-unknown-linux-ohos]
cc = "aarch64-unknown-linux-ohos-clang"
cxx = "aarch64-unknown-linux-ohos-clang++"
linker = "aarch64-unknown-linux-ohos-clang"
ar = "llvm-ar"
[target.armv7-unknown-linux-ohos]
cc = "armv7-unknown-linux-ohos-clang"
cxx = "armv7-unknown-linux-ohos-clang++"
linker = "armv7-unknown-linux-ohos-clang"
ar = "llvm-ar"
[target.x86_64-unknown-linux-ohos]
cc = "x86_64-unknown-linux-ohos-clang"
cxx = "x86_64-unknown-linux-ohos-clang++"
linker = "x86_64-unknown-linux-ohos-clang"
ar = "llvm-ar"
[target.x86_64-pc-windows-gnullvm]
cc = "x86_64-w64-mingw32-clang"
@@ -0,0 +1,3 @@
#!/bin/bash
exec aarch64-unknown-linux-ohos-clang -fstack-protector-all "$@"
@@ -0,0 +1,3 @@
#!/bin/bash
exec aarch64-unknown-linux-ohos-clang++ -fstack-protector-all "$@"
@@ -0,0 +1,3 @@
#!/bin/bash
exec armv7-unknown-linux-ohos-clang -fstack-protector-all "$@"
@@ -0,0 +1,3 @@
#!/bin/bash
exec armv7-unknown-linux-ohos-clang++ -fstack-protector-all "$@"
@@ -0,0 +1,3 @@
#!/bin/bash
exec x86_64-unknown-linux-ohos-clang -fstack-protector-all "$@"
@@ -0,0 +1,3 @@
#!/bin/bash
exec x86_64-unknown-linux-ohos-clang++ -fstack-protector-all "$@"