[packages/rpm-pld-macros] 2.020: rust macros improvements

atler atler at pld-linux.org
Thu Dec 1 13:05:44 CET 2022


commit 80b8e8a4a79a54dad2c0a7cdd0268482539c2b78
Author: Jan Palus <atler at pld-linux.org>
Date:   Thu Dec 1 13:02:55 2022 +0100

    2.020: rust macros improvements
    
    - add %__rustc macro
    - move --target %rust_target from %cargo* to %rpmrustflags so it applies
      more broadly (specifing --target more than once is forbidden so it
      cannot stay in %cargo*)
    - add RUSTC env var to %cargo* macros
    - add RUSTC/RUSTFLAGS env vars to %meson macro

 macros.pld          | 2 ++
 macros.rust         | 8 +++++---
 rpm-pld-macros.spec | 4 ++--
 3 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/rpm-pld-macros.spec b/rpm-pld-macros.spec
index f9bd2fa..0aeb70c 100644
--- a/rpm-pld-macros.spec
+++ b/rpm-pld-macros.spec
@@ -1,4 +1,4 @@
-%define		rpm_macros_rev	2.019
+%define		rpm_macros_rev	2.020
 %define		find_lang_rev	1.41
 # split into individual X_prov_ver if there is a reason to desync
 %define		prov_ver	4.15
@@ -6,7 +6,7 @@ Summary:	PLD Linux RPM macros
 Summary(pl.UTF-8):	Makra RPM dla Linuksa PLD
 Name:		rpm-pld-macros
 Version:	%{rpm_macros_rev}
-Release:	5
+Release:	1
 License:	GPL v2+
 Group:		Development/Building
 Source0:	macros.pld
diff --git a/macros.pld b/macros.pld
index c188760..349821a 100644
--- a/macros.pld
+++ b/macros.pld
@@ -549,6 +549,8 @@ CFLAGS="${CFLAGS:-%{rpmcflags}}" \
 CPPFLAGS="${CPPFLAGS:-%{rpmcppflags}}" \
 CXXFLAGS="${CXXFLAGS:-%{rpmcxxflags}}" \
 LDFLAGS="${LDFLAGS:-%{rpmldflags}}" \
+RUSTC="${RUSTC:-%{__rustc}}" \
+RUSTFLAGS="${RUSTFLAGS:-%{rpmrustflags}}" \
 LC_ALL=C.UTF-8 %{__meson} \
 	--buildtype=plain \
 	--bindir=%{_bindir} \
diff --git a/macros.rust b/macros.rust
index 51f8fe4..bfb937e 100644
--- a/macros.rust
+++ b/macros.rust
@@ -1,5 +1,5 @@
 %debuginforustflags	-C debuginfo=%{expand:%%define __dic_%{?_enable_debug_packages} 1}%{?__dic_1:2}%{!?__dic_1:0}%{expand:%%undefine __dic_%{?_enable_debug_packages}} -C strip=none
-%rpmrustflags	%debuginforustflags
+%rpmrustflags	--target %rust_target %debuginforustflags
 %rust_arches	%{x8664} %{ix86} x32 aarch64 armv6hl armv7hl armv7hnl
 
 %rust_target	\\\
@@ -33,6 +33,7 @@ thumbv7neon-unknown-linux-gnueabihf\\\
 %cargo_targetdir	target
 %cargo_objdir		%{?buildsubdir:%{_builddir}/%{buildsubdir}/}%{cargo_targetdir}/%{rust_target}/%{!?debug:release}%{?debug:debug}
 
+%__rustc	/usr/bin/rustc
 %__cargo	/usr/bin/cargo
 %__cargo_common_opts	-v --offline
 %cargo_build \\\
@@ -42,11 +43,11 @@ thumbv7neon-unknown-linux-gnueabihf\\\
 	CXXFLAGS="%{rpmcppflags} %{rpmcxxflags}" \\\
 	LDFLAGS="%{rpmldflags}" \\\
 	PKG_CONFIG_ALLOW_CROSS=1 \\\
+	RUSTC="${RUSTC:-%__rustc}" \\\
 	%{?rustc_wrapper:RUSTC_WRAPPER="${RUSTC_WRAPPER:-%rustc_wrapper}"} \\\
 	RUSTFLAGS="${RUSTFLAGS:-%rpmrustflags}" \\\
 	%{?__jobs:CARGO_BUILD_JOBS="${CARGO_BUILD_JOBS:-%{__jobs}}"} \\\
 	%{__cargo} %{__cargo_common_opts} build %{!?debug:--release} \\\
-	--target %{rust_target} \\\
 	--target-dir %{cargo_targetdir} \\\
 %{nil}
 
@@ -57,9 +58,10 @@ thumbv7neon-unknown-linux-gnueabihf\\\
 	CXXFLAGS="%{rpmcppflags} %{rpmcxxflags}" \\\
 	LDFLAGS="%{rpmldflags}" \\\
 	PKG_CONFIG_ALLOW_CROSS=1 \\\
+	RUSTC="${RUSTC:-%__rustc}" \\\
+	%{?rustc_wrapper:RUSTC_WRAPPER="${RUSTC_WRAPPER:-%rustc_wrapper}"} \\\
 	RUSTFLAGS="${RUSTFLAGS:-%rpmrustflags}" \\\
 	%{?__jobs:CARGO_BUILD_JOBS="${CARGO_BUILD_JOBS:-%{__jobs}}"} \\\
 	%{__cargo} %{__cargo_common_opts} install \\\
-	--target %{rust_target} \\\
 	--target-dir %{cargo_targetdir} \\\
 %{nil}
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-pld-macros.git/commitdiff/80b8e8a4a79a54dad2c0a7cdd0268482539c2b78



More information about the pld-cvs-commit mailing list