2018-11-14 02:23:39 +01:00
|
|
|
#
|
2021-06-21 17:42:31 +02:00
|
|
|
# spec file
|
2018-11-14 02:23:39 +01:00
|
|
|
#
|
2021-01-12 14:20:42 +01:00
|
|
|
# Copyright (c) 2021 SUSE LLC
|
2018-11-14 02:23:39 +01:00
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
2018-11-19 19:34:09 +01:00
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
2018-11-14 02:23:39 +01:00
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
# Use hardening ldflags.
|
|
|
|
%global crate_name cbindgen
|
|
|
|
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
|
|
|
|
Name: rust-%{crate_name}
|
2021-06-09 02:44:26 +02:00
|
|
|
Version: 0.19.0+git0
|
2018-11-14 02:23:39 +01:00
|
|
|
Release: 0
|
|
|
|
Summary: A tool for generating C bindings from Rust code
|
|
|
|
License: MPL-2.0
|
|
|
|
Group: Development/Languages/Rust
|
2018-11-19 19:34:09 +01:00
|
|
|
URL: https://crates.io/crates/cbindgen
|
2021-06-09 02:44:26 +02:00
|
|
|
Source0: %{crate_name}-%{version}.tar.xz
|
2018-11-14 02:23:39 +01:00
|
|
|
Source1: vendor.tar.xz
|
2021-06-09 02:44:26 +02:00
|
|
|
Source2: cargo_config
|
2021-06-09 07:54:17 +02:00
|
|
|
Source99: UPDATING.md
|
2018-11-14 02:23:39 +01:00
|
|
|
BuildRequires: cargo >= 1.30.0
|
|
|
|
BuildRequires: rust >= 1.30.0
|
|
|
|
|
|
|
|
%description
|
|
|
|
A tool for generating C bindings from Rust code.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q -T -b 0 -n %{crate_name}-%{version}
|
|
|
|
%setup -q -D -T -a 1 -n %{crate_name}-%{version}
|
|
|
|
mkdir cargo-home
|
2021-06-09 02:44:26 +02:00
|
|
|
cp %{SOURCE2} cargo-home/config
|
2018-11-14 02:23:39 +01:00
|
|
|
|
|
|
|
%build
|
|
|
|
# This should eventually migrate to distro policy
|
|
|
|
# Enable optimization, debuginfo, and link hardening.
|
|
|
|
export RUSTFLAGS="%{rustflags}"
|
|
|
|
export CARGO_HOME=`pwd`/cargo-home/
|
|
|
|
|
|
|
|
cargo build --release
|
|
|
|
|
|
|
|
%install
|
|
|
|
# rustflags must be exported again at install as cargo build will
|
|
|
|
# rebuild the project if it detects flags have changed (to none or other)
|
|
|
|
export RUSTFLAGS="%{rustflags}"
|
|
|
|
# install stage also requires re-export of 'cargo-home' or cargo
|
|
|
|
# will try to download source deps and rebuild
|
|
|
|
export CARGO_HOME=`pwd`/cargo-home/
|
|
|
|
# cargo install appends /bin to the path
|
2020-03-08 16:16:12 +01:00
|
|
|
cargo install --root=%{buildroot}%{_prefix} --path .
|
2020-03-30 23:54:44 +02:00
|
|
|
# remove spurious files
|
|
|
|
rm -f %{buildroot}%{_prefix}/.crates.toml
|
|
|
|
rm -f %{buildroot}%{_prefix}/.crates2.json
|
2018-11-14 02:23:39 +01:00
|
|
|
|
|
|
|
%files
|
|
|
|
%license LICENSE
|
|
|
|
%{_bindir}/cbindgen
|
|
|
|
|
|
|
|
%changelog
|