Add rustc target arch
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 21 Mar 2023 07:43:54 +0000 (16:43 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 21 Mar 2023 07:43:54 +0000 (16:43 +0900)
packaging/rust-linux-raw-sys.spec

index 9509936e55df104cdeff38314e1ecaab8fd27181..c3621f058f1182103e9c0b61ef84cb441dbbc2da 100644 (file)
@@ -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"' \