From 58605f830c41fced6615905e60f18b41d0ae7234 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Tue, 21 Mar 2023 16:43:54 +0900 Subject: [PATCH] Add rustc target arch --- packaging/rust-linux-raw-sys.spec | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packaging/rust-linux-raw-sys.spec b/packaging/rust-linux-raw-sys.spec index 9509936..c3621f0 100644 --- a/packaging/rust-linux-raw-sys.spec +++ b/packaging/rust-linux-raw-sys.spec @@ -43,9 +43,31 @@ cp %{SOURCE1} . # crate-type : dylib, proc-macro, cdylib, bin, etc. # ========================================================== %build +%ifarch %{ix86} +export RUSTC_TARGET_ARCH=x86 +export RUSTC_TARGET_POINTER_WIDTH=32 +%endif +%ifarch x86_64 +export RUSTC_TARGET_ARCH=x86_64 +export RUSTC_TARGET_POINTER_WIDTH=64 +%endif +%ifarch armv7l +export RUSTC_TARGET_ARCH=arm +export RUSTC_TARGET_POINTER_WIDTH=32 +%endif +%ifarch aarch64 +export RUSTC_TARGET_ARCH=aarch64 +export RUSTC_TARGET_POINTER_WIDTH=64 +%endif +%ifarch armv7hl +export RUSTC_TARGET_ARCH=arm +export RUSTC_TARGET_POINTER_WIDTH=32 +%endif %{rustc_std_build} --crate-type=dylib \ --crate-name=%{real_crate_name} \ %{?rustc_edition:--edition=%{rustc_edition}} \ + --cfg="target_arch=\"$RUSTC_TARGET_ARCH\"" \ + --cfg="target_pointer_width=\"$RUSTC_TARGET_POINTER_WIDTH\"" \ --cfg='feature="std"' \ --cfg='feature="general"' \ --cfg='feature="errno"' \ -- 2.34.1