mirror of
https://github.com/openharmony/third_party_rust_rust.git
synced 2026-07-18 17:34:40 -04:00
[build] add include musl head file path
Signed-off-by: wuhuiquan <wuhuiquan4@huawei.com>
This commit is contained in:
@@ -46,8 +46,9 @@ python3 ./build/scripts/download_sdk.py --branch OpenHarmony-5.0.0-Release --pro
|
||||
3、download build code
|
||||
|
||||
```
|
||||
git clone --depth=1 https://gitee.com/openharmony/third_party_llvm-project.git third_party/llvm-project
|
||||
git clone --depth=1 https://gitee.com/openharmony/third_party_rust_rust.git third_party/rust/rust
|
||||
repo init -u https://gitee.com/OpenHarmony/manifest.git -b master -m rust-toolchain.xml
|
||||
repo sync -c
|
||||
repo forall -c 'git lfs pull'
|
||||
```
|
||||
|
||||
4、start to build
|
||||
|
||||
+12
-1
@@ -52,14 +52,25 @@ update_config_clang_path() {
|
||||
sed -i "s/ar = \"${3}\"/ar = \"${sys_clang_dir}\/${3}\"/g" ${rust_source_dir}/config.toml
|
||||
}
|
||||
|
||||
update_musl_head_file_path() {
|
||||
# $1:musl head file path, $2 clang name
|
||||
# add musl head file path to shell tools
|
||||
musl_head_file_dir="$(echo ${1} | sed 's/\//\\\//g')"
|
||||
sed -i "s/-Imusl/-I${musl_head_file_dir}/g" ${rust_source_dir}/build/${2}
|
||||
sed -i "s/-Imusl/-I${musl_head_file_dir}/g" ${rust_source_dir}/build/${2}++
|
||||
}
|
||||
|
||||
update_config_clang() {
|
||||
# $1:OH clang path $2:mingw clang path
|
||||
# $1:OH clang path $2:mingw clang path $3:musl head file path
|
||||
if [ "${host_platform}" = "linux" ] && [ ${host_cpu} = "x86_64" ]; then
|
||||
update_config_clang_path ${1} clang llvm-ar
|
||||
update_config_clang_path ${1} aarch64-unknown-linux-ohos-clang llvm-ar
|
||||
update_config_clang_path ${1} armv7-unknown-linux-ohos-clang llvm-ar
|
||||
update_config_clang_path ${1} x86_64-unknown-linux-ohos-clang llvm-ar
|
||||
update_config_clang_path ${2} x86_64-w64-mingw32-clang x86_64-w64-mingw32-ar
|
||||
update_musl_head_file_path ${3} aarch64-unknown-linux-ohos-clang
|
||||
update_musl_head_file_path ${3} armv7-unknown-linux-ohos-clang
|
||||
update_musl_head_file_path ${3} x86_64-unknown-linux-ohos-clang
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ readonly output_install="${root_build_dir}/output/"
|
||||
readonly rust_static_dir="${root_build_dir}/rust_download"
|
||||
readonly oh_tools="${rust_tools}/ohos-sdk/linux/12/native/llvm/bin"
|
||||
readonly mingw_tools="${rust_tools}/mingw-w64/ohos/linux-x86_64/clang-mingw/bin"
|
||||
readonly musl_head_file_path="${root_build_dir}/third_party/musl/include/linux"
|
||||
readonly old_version="xxxxx"
|
||||
new_version="xxxxx"
|
||||
|
||||
@@ -44,7 +45,7 @@ main() {
|
||||
clean
|
||||
download_rust_at_net
|
||||
copy_config
|
||||
update_config_clang ${oh_tools} ${mingw_tools}
|
||||
update_config_clang ${oh_tools} ${mingw_tools} ${musl_head_file_path}
|
||||
get_new_version
|
||||
update_version
|
||||
move_static_rust_source ${rust_static_dir} ${rust_source_dir}
|
||||
|
||||
@@ -8,6 +8,7 @@ readonly rust_tools="${root_build_dir}/prebuilts"
|
||||
readonly rust_static_dir="${root_build_dir}/rust_download"
|
||||
readonly oh_tools="${rust_tools}/ohos-sdk/linux/12/native/llvm/bin"
|
||||
readonly mingw_tools="${rust_tools}/mingw-w64/ohos/linux-x86_64/clang-mingw/bin"
|
||||
readonly musl_head_file_path="${root_build_dir}/third_party/musl/include/linux"
|
||||
exclude_file=""
|
||||
all_test_suite=""
|
||||
|
||||
@@ -18,7 +19,7 @@ main() {
|
||||
rm -rf ${rust_source_dir}/build/*
|
||||
download_rust_at_net
|
||||
copy_config
|
||||
update_config_clang ${oh_tools} ${mingw_tools}
|
||||
update_config_clang ${oh_tools} ${mingw_tools} ${musl_head_file_path}
|
||||
sed -i "s/target = .*/target = [\"x86_64-unknown-linux-gnu\"]/g" ${rust_source_dir}/config.toml
|
||||
move_static_rust_source ${rust_static_dir} ${rust_source_dir}
|
||||
rm -rf ${rust_source_dir}/src/llvm-project/*
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exec aarch64-unknown-linux-ohos-clang -fstack-protector-all "$@"
|
||||
exec aarch64-unknown-linux-ohos-clang -Imusl -fstack-protector-all "$@"
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exec aarch64-unknown-linux-ohos-clang++ -fstack-protector-all "$@"
|
||||
exec aarch64-unknown-linux-ohos-clang++ -Imusl -fstack-protector-all "$@"
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exec armv7-unknown-linux-ohos-clang -fstack-protector-all "$@"
|
||||
exec armv7-unknown-linux-ohos-clang -Imusl -fstack-protector-all "$@"
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exec armv7-unknown-linux-ohos-clang++ -fstack-protector-all "$@"
|
||||
exec armv7-unknown-linux-ohos-clang++ -Imusl -fstack-protector-all "$@"
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exec x86_64-unknown-linux-ohos-clang -fstack-protector-all "$@"
|
||||
exec x86_64-unknown-linux-ohos-clang -Imusl -fstack-protector-all "$@"
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exec x86_64-unknown-linux-ohos-clang++ -fstack-protector-all "$@"
|
||||
exec x86_64-unknown-linux-ohos-clang++ -Imusl -fstack-protector-all "$@"
|
||||
Reference in New Issue
Block a user