Fix packaging issues

* Add debuginfos
* Make sure proper CFLAGS and LDFLAGS are used

Resolves: RHEL-57078
This commit is contained in:
Marian Csontos 2024-09-05 19:36:46 +02:00
parent 1c8142b753
commit b8de93da35

View File

@ -2,7 +2,7 @@
# Copyright (C) 2011-2017 Red Hat, Inc
#
%bcond_without check
%global debug_package %{nil}
#%%global debug_package %%{nil}
#%%global version_suffix -rc2
#%%global release_suffix .test3
@ -10,7 +10,7 @@
Summary: Device-mapper Persistent Data Tools
Name: device-mapper-persistent-data
Version: 1.0.9
Release: 3%{?dist}%{?release_suffix}
Release: 3%{?dist}%{?release_suffix}.1
License: GPLv3+
URL: https://github.com/jthornber/thin-provisioning-tools
#Source0: https://github.com/jthornber/thin-provisioning-tools/archive/thin-provisioning-tools-%%{version}.tar.gz
@ -48,15 +48,53 @@ snapshot eras
#%%cargo_prep
#%%cargo_generate_buildrequires
tar xf %{SOURCE1}
mkdir -p .cargo
cat > .cargo/config <<END
[source.crates-io]
replace-with = "vendored-sources"
(
# Part from %%cargo_prep:
set -euo pipefail
%{__mkdir} -p target/rpm
/usr/bin/ln -s rpm target/release
%{__rm} -rf .cargo/
%{__mkdir} -p .cargo
cat > .cargo/config.toml << EOF
[build]
rustc = "%{__rustc}"
rustdoc = "%{__rustdoc}"
[profile.rpm]
inherits = "release"
opt-level = 3 # %%{rustflags_opt_level}
codegen-units = 1 # %%{rustflags_codegen_units}
debug = 2 # %%{rustflags_debuginfo}
strip = "none"
[env]
CFLAGS = "%{build_cflags}"
CXXFLAGS = "%{build_cxxflags}"
LDFLAGS = "%{build_ldflags}"
[install]
root = "%{buildroot}%{_prefix}"
[term]
verbose = true
[net]
offline = true
EOF
cat >> .cargo/config.toml << EOF
[source.vendored-sources]
directory = "vendor"
END
[source.crates-io]
registry = "https://crates.io"
replace-with = "vendored-sources"
EOF
%{__rm} -f Cargo.toml.orig
cat .cargo/config.toml
)
echo %{version}-%{release} > VERSION
%generate_buildrequires
@ -73,7 +111,7 @@ RUST_BACKTRACE=1 %%cargo_test -- --nocapture --test-threads=1 || true
%endif
%install
make DESTDIR=%{buildroot} MANDIR=%{_mandir} install
%make_install MANDIR=%{_mandir} STRIP=true
%files
%doc COPYING README.md