diff --git a/SOURCES/352.patch b/SOURCES/352.patch new file mode 100644 index 0000000..9afa864 --- /dev/null +++ b/SOURCES/352.patch @@ -0,0 +1,574 @@ +From d50a978efb8e538db90dad7128cc74f19ec2bc8d Mon Sep 17 00:00:00 2001 +From: kpcyrd +Date: Sat, 11 Nov 2023 19:45:00 +0100 +Subject: [PATCH 1/2] Add version_suffix_components setting + +--- + README.md | 4 ++ + src/build.rs | 102 +++++++++++++++++++++++++++++++++++++++++- + src/install.rs | 25 ++++++----- + src/lib.rs | 15 ------- + src/pkg_config_gen.rs | 1 + + src/target.rs | 7 ++- + 6 files changed, 122 insertions(+), 32 deletions(-) + +diff --git a/README.md b/README.md +index e53231b..5a651d0 100644 +--- a/README.md ++++ b/README.md +@@ -135,6 +135,10 @@ version = "1.2.3" + install_subdir = "gstreamer-1.0" + # Used to disable versioning links when installing the dynamic library + versioning = false ++# Instead of using semver, select a fixed number of version components for your SONAME version suffix: ++# Setting this to 1 with a version of 0.0.0 allows a suffix of `.so.0` ++# Setting this to 3 always includes the full version in the SONAME (indicate any update is ABI breaking) ++#version_suffix_components = 2 + # Add `-Cpanic=abort` to the RUSTFLAGS automatically, it may be useful in case + # something might panic in the crates used by the library. + rustflags = "-Cpanic=abort" +diff --git a/src/build.rs b/src/build.rs +index 4e8279f..45c4538 100644 +--- a/src/build.rs ++++ b/src/build.rs +@@ -14,6 +14,7 @@ use cargo::util::command_prelude::{ArgMatches, ArgMatchesExt, CompileMode, Profi + use cargo::util::interning::InternedString; + use cargo::{CliResult, Config}; + ++use anyhow::Context as _; + use cargo_util::paths::{copy, create, create_dir_all, open, read, read_bytes, write}; + use semver::Version; + +@@ -406,10 +407,33 @@ pub struct LibraryCApiConfig { + pub version: Version, + pub install_subdir: Option, + pub versioning: bool, ++ pub version_suffix_components: Option, + pub import_library: bool, + pub rustflags: Vec, + } + ++impl LibraryCApiConfig { ++ pub fn sover(&self) -> anyhow::Result { ++ let major = self.version.major; ++ let minor = self.version.minor; ++ let patch = self.version.patch; ++ ++ let sover = match self.version_suffix_components { ++ None => match (major, minor, patch) { ++ (0, 0, patch) => format!("0.0.{patch}"), ++ (0, minor, _) => format!("0.{minor}"), ++ (major, _, _) => format!("{major}"), ++ }, ++ Some(1) => format!("{major}"), ++ Some(2) => format!("{major}.{minor}"), ++ Some(3) => format!("{major}.{minor}.{patch}"), ++ Some(num) => anyhow::bail!("Unexpected number of suffix components: {num}"), ++ }; ++ ++ Ok(sover) ++ } ++} ++ + #[derive(Debug, Default)] + pub struct InstallCApiConfig { + pub include: Vec, +@@ -619,6 +643,7 @@ fn load_manifest_capi_config(pkg: &Package) -> anyhow::Result { + let mut version = pkg.version().clone(); + let mut install_subdir = None; + let mut versioning = true; ++ let mut version_suffix_components = None; + let mut import_library = true; + let mut rustflags = Vec::new(); + +@@ -636,6 +661,17 @@ fn load_manifest_capi_config(pkg: &Package) -> anyhow::Result { + .get("versioning") + .and_then(|v| v.as_bool()) + .unwrap_or(true); ++ ++ if let Some(value) = library.get("version_suffix_components") { ++ let value = value.as_integer().with_context(|| { ++ format!("Value for `version_suffix_components` is not an integer: {value:?}") ++ })?; ++ let value = value ++ .try_into() ++ .with_context(|| format!("Value is too large: {value:?}"))?; ++ version_suffix_components = Some(value); ++ } ++ + import_library = library + .get("import_library") + .and_then(|v| v.as_bool()) +@@ -655,6 +691,7 @@ fn load_manifest_capi_config(pkg: &Package) -> anyhow::Result { + version, + install_subdir, + versioning, ++ version_suffix_components, + import_library, + rustflags, + }; +@@ -886,7 +923,7 @@ fn compile_with_exec( + let pkg_rustflags = &capi_config.library.rustflags; + + let mut leaf_args: Vec = rustc_target +- .shared_object_link_args(&capi_config, &install_paths.libdir, root_output) ++ .shared_object_link_args(&capi_config, &install_paths.libdir, root_output)? + .into_iter() + .flat_map(|l| vec!["-C".to_string(), format!("link-arg={l}")]) + .collect(); +@@ -1246,3 +1283,66 @@ pub fn ctest( + + ops::run_tests(ws, &ops, &test_args) + } ++ ++#[cfg(test)] ++mod tests { ++ use super::*; ++ use semver::Version; ++ ++ fn make_test_library_config(version: &str) -> LibraryCApiConfig { ++ LibraryCApiConfig { ++ name: "example".to_string(), ++ version: Version::parse(version).unwrap(), ++ install_subdir: None, ++ versioning: true, ++ version_suffix_components: None, ++ import_library: true, ++ rustflags: vec![], ++ } ++ } ++ ++ #[test] ++ pub fn test_semver_zero_zero_zero() { ++ let library = make_test_library_config("0.0.0"); ++ let sover = library.sover().unwrap(); ++ assert_eq!(sover, "0.0.0"); ++ } ++ ++ #[test] ++ pub fn test_semver_zero_one_zero() { ++ let library = make_test_library_config("0.1.0"); ++ let sover = library.sover().unwrap(); ++ assert_eq!(sover, "0.1"); ++ } ++ ++ #[test] ++ pub fn test_semver_one_zero_zero() { ++ let library = make_test_library_config("1.0.0"); ++ let sover = library.sover().unwrap(); ++ assert_eq!(sover, "1"); ++ } ++ ++ #[test] ++ pub fn text_one_fixed_zero_zero_zero() { ++ let mut library = make_test_library_config("0.0.0"); ++ library.version_suffix_components = Some(1); ++ let sover = library.sover().unwrap(); ++ assert_eq!(sover, "0"); ++ } ++ ++ #[test] ++ pub fn text_two_fixed_one_zero_zero() { ++ let mut library = make_test_library_config("1.0.0"); ++ library.version_suffix_components = Some(2); ++ let sover = library.sover().unwrap(); ++ assert_eq!(sover, "1.0"); ++ } ++ ++ #[test] ++ pub fn text_three_fixed_one_zero_zero() { ++ let mut library = make_test_library_config("1.0.0"); ++ library.version_suffix_components = Some(3); ++ let sover = library.sover().unwrap(); ++ assert_eq!(sover, "1.0.0"); ++ } ++} +diff --git a/src/install.rs b/src/install.rs +index d0725b9..9ad4104 100644 +--- a/src/install.rs ++++ b/src/install.rs +@@ -3,11 +3,9 @@ use std::path::{Component, Path, PathBuf}; + + use cargo::core::Workspace; + use cargo_util::paths::{copy, create_dir_all}; +-use semver::Version; + + use crate::build::*; + use crate::build_targets::BuildTargets; +-use crate::VersionExt; + + fn append_to_destdir(destdir: Option<&Path>, path: &Path) -> PathBuf { + if let Some(destdir) = destdir { +@@ -107,8 +105,13 @@ pub(crate) struct UnixLibNames { + } + + impl UnixLibNames { +- pub(crate) fn new(lib_type: LibType, lib_name: &str, lib_version: &Version) -> Option { +- let main_version = lib_version.main_version(); ++ pub(crate) fn new( ++ lib_type: LibType, ++ library: &LibraryCApiConfig, ++ ) -> anyhow::Result> { ++ let lib_name = &library.name; ++ let lib_version = &library.version; ++ let main_version = library.sover()?; + + match lib_type { + LibType::So => { +@@ -119,11 +122,11 @@ impl UnixLibNames { + ); + let lib_with_main_ver = format!("{}.{}", lib, main_version); + +- Some(Self { ++ Ok(Some(Self { + canonical: lib, + with_main_ver: lib_with_main_ver, + with_full_ver: lib_with_full_ver, +- }) ++ })) + } + LibType::Dylib => { + let lib = format!("lib{lib_name}.dylib"); +@@ -133,13 +136,13 @@ impl UnixLibNames { + "lib{}.{}.{}.{}.dylib", + lib_name, lib_version.major, lib_version.minor, lib_version.patch + ); +- Some(Self { ++ Ok(Some(Self { + canonical: lib, + with_main_ver: lib_with_main_ver, + with_full_ver: lib_with_full_ver, +- }) ++ })) + } +- LibType::Windows => None, ++ LibType::Windows => Ok(None), + } + } + +@@ -236,12 +239,10 @@ pub fn cinstall(ws: &Workspace, packages: &[CPackage]) -> anyhow::Result<()> { + if let Some(ref shared_lib) = build_targets.shared_lib { + ws.config().shell().status("Installing", "shared library")?; + +- let lib_name = &capi_config.library.name; + let lib_type = LibType::from_build_targets(build_targets); + match lib_type { + LibType::So | LibType::Dylib => { +- let lib = UnixLibNames::new(lib_type, lib_name, &capi_config.library.version) +- .unwrap(); ++ let lib = UnixLibNames::new(lib_type, &capi_config.library)?.unwrap(); + lib.install(capi_config, shared_lib, &install_path_lib)?; + } + LibType::Windows => { +diff --git a/src/lib.rs b/src/lib.rs +index 66d7b9b..c63a297 100644 +--- a/src/lib.rs ++++ b/src/lib.rs +@@ -5,18 +5,3 @@ pub mod config; + pub mod install; + pub mod pkg_config_gen; + pub mod target; +- +-trait VersionExt { +- /// build the main version string +- fn main_version(&self) -> String; +-} +- +-impl VersionExt for semver::Version { +- fn main_version(&self) -> String { +- match (self.major, self.minor, self.patch) { +- (0, 0, patch) => format!("0.0.{patch}"), +- (0, minor, _) => format!("0.{minor}"), +- (major, _, _) => format!("{major}"), +- } +- } +-} +diff --git a/src/pkg_config_gen.rs b/src/pkg_config_gen.rs +index 91d8b4d..c825d95 100644 +--- a/src/pkg_config_gen.rs ++++ b/src/pkg_config_gen.rs +@@ -298,6 +298,7 @@ mod test { + version: Version::parse("0.1.0").unwrap(), + install_subdir: None, + versioning: true, ++ version_suffix_components: None, + import_library: true, + rustflags: Vec::default(), + }, +diff --git a/src/target.rs b/src/target.rs +index 136cf54..7ada1be 100644 +--- a/src/target.rs ++++ b/src/target.rs +@@ -3,7 +3,6 @@ use std::path::Path; + use anyhow::*; + + use crate::build::CApiConfig; +-use crate::VersionExt; + + /// Split a target string to its components + /// +@@ -57,7 +56,7 @@ impl Target { + capi_config: &CApiConfig, + libdir: &Path, + target_dir: &Path, +- ) -> Vec { ++ ) -> anyhow::Result> { + let mut lines = Vec::new(); + + let lib_name = &capi_config.library.name; +@@ -70,7 +69,7 @@ impl Target { + let os = &self.os; + let env = &self.env; + +- let sover = version.main_version(); ++ let sover = capi_config.library.sover()?; + + if os == "android" { + lines.push(format!("-Wl,-soname,lib{lib_name}.so")); +@@ -112,6 +111,6 @@ impl Target { + // See: https://github.com/emscripten-core/emscripten/blob/3.1.39/emcc.py#L92-L94 + // else if os == "emscripten" + +- lines ++ Ok(lines) + } + } + +From 3f9e452500b37204efce3091c9d0fd9366393e5b Mon Sep 17 00:00:00 2001 +From: kpcyrd +Date: Sun, 12 Nov 2023 14:47:40 +0100 +Subject: [PATCH 2/2] Refactor to validate version_suffix_components while + parsing + +--- + src/build.rs | 54 ++++++++++++++++++++++++++++---------------------- + src/install.rs | 19 ++++++++---------- + src/target.rs | 6 +++--- + 3 files changed, 41 insertions(+), 38 deletions(-) + +diff --git a/src/build.rs b/src/build.rs +index 45c4538..33b77f2 100644 +--- a/src/build.rs ++++ b/src/build.rs +@@ -401,36 +401,40 @@ pub struct PkgConfigCApiConfig { + pub strip_include_path_components: usize, + } + ++#[derive(Debug)] ++pub enum VersionSuffix { ++ Major, ++ MajorMinor, ++ MajorMinorPatch, ++} ++ + #[derive(Debug)] + pub struct LibraryCApiConfig { + pub name: String, + pub version: Version, + pub install_subdir: Option, + pub versioning: bool, +- pub version_suffix_components: Option, ++ pub version_suffix_components: Option, + pub import_library: bool, + pub rustflags: Vec, + } + + impl LibraryCApiConfig { +- pub fn sover(&self) -> anyhow::Result { ++ pub fn sover(&self) -> String { + let major = self.version.major; + let minor = self.version.minor; + let patch = self.version.patch; + +- let sover = match self.version_suffix_components { ++ match self.version_suffix_components { + None => match (major, minor, patch) { + (0, 0, patch) => format!("0.0.{patch}"), + (0, minor, _) => format!("0.{minor}"), + (major, _, _) => format!("{major}"), + }, +- Some(1) => format!("{major}"), +- Some(2) => format!("{major}.{minor}"), +- Some(3) => format!("{major}.{minor}.{patch}"), +- Some(num) => anyhow::bail!("Unexpected number of suffix components: {num}"), +- }; +- +- Ok(sover) ++ Some(VersionSuffix::Major) => format!("{major}"), ++ Some(VersionSuffix::MajorMinor) => format!("{major}.{minor}"), ++ Some(VersionSuffix::MajorMinorPatch) => format!("{major}.{minor}.{patch}"), ++ } + } + } + +@@ -666,10 +670,12 @@ fn load_manifest_capi_config(pkg: &Package) -> anyhow::Result { + let value = value.as_integer().with_context(|| { + format!("Value for `version_suffix_components` is not an integer: {value:?}") + })?; +- let value = value +- .try_into() +- .with_context(|| format!("Value is too large: {value:?}"))?; +- version_suffix_components = Some(value); ++ version_suffix_components = Some(match value { ++ 1 => VersionSuffix::Major, ++ 2 => VersionSuffix::MajorMinor, ++ 3 => VersionSuffix::MajorMinorPatch, ++ _ => anyhow::bail!("Out of range value for version suffix components: {value}"), ++ }); + } + + import_library = library +@@ -923,7 +929,7 @@ fn compile_with_exec( + let pkg_rustflags = &capi_config.library.rustflags; + + let mut leaf_args: Vec = rustc_target +- .shared_object_link_args(&capi_config, &install_paths.libdir, root_output)? ++ .shared_object_link_args(&capi_config, &install_paths.libdir, root_output) + .into_iter() + .flat_map(|l| vec!["-C".to_string(), format!("link-arg={l}")]) + .collect(); +@@ -1304,45 +1310,45 @@ mod tests { + #[test] + pub fn test_semver_zero_zero_zero() { + let library = make_test_library_config("0.0.0"); +- let sover = library.sover().unwrap(); ++ let sover = library.sover(); + assert_eq!(sover, "0.0.0"); + } + + #[test] + pub fn test_semver_zero_one_zero() { + let library = make_test_library_config("0.1.0"); +- let sover = library.sover().unwrap(); ++ let sover = library.sover(); + assert_eq!(sover, "0.1"); + } + + #[test] + pub fn test_semver_one_zero_zero() { + let library = make_test_library_config("1.0.0"); +- let sover = library.sover().unwrap(); ++ let sover = library.sover(); + assert_eq!(sover, "1"); + } + + #[test] + pub fn text_one_fixed_zero_zero_zero() { + let mut library = make_test_library_config("0.0.0"); +- library.version_suffix_components = Some(1); +- let sover = library.sover().unwrap(); ++ library.version_suffix_components = Some(VersionSuffix::Major); ++ let sover = library.sover(); + assert_eq!(sover, "0"); + } + + #[test] + pub fn text_two_fixed_one_zero_zero() { + let mut library = make_test_library_config("1.0.0"); +- library.version_suffix_components = Some(2); +- let sover = library.sover().unwrap(); ++ library.version_suffix_components = Some(VersionSuffix::MajorMinor); ++ let sover = library.sover(); + assert_eq!(sover, "1.0"); + } + + #[test] + pub fn text_three_fixed_one_zero_zero() { + let mut library = make_test_library_config("1.0.0"); +- library.version_suffix_components = Some(3); +- let sover = library.sover().unwrap(); ++ library.version_suffix_components = Some(VersionSuffix::MajorMinorPatch); ++ let sover = library.sover(); + assert_eq!(sover, "1.0.0"); + } + } +diff --git a/src/install.rs b/src/install.rs +index 9ad4104..c087e74 100644 +--- a/src/install.rs ++++ b/src/install.rs +@@ -105,13 +105,10 @@ pub(crate) struct UnixLibNames { + } + + impl UnixLibNames { +- pub(crate) fn new( +- lib_type: LibType, +- library: &LibraryCApiConfig, +- ) -> anyhow::Result> { ++ pub(crate) fn new(lib_type: LibType, library: &LibraryCApiConfig) -> Option { + let lib_name = &library.name; + let lib_version = &library.version; +- let main_version = library.sover()?; ++ let main_version = library.sover(); + + match lib_type { + LibType::So => { +@@ -122,11 +119,11 @@ impl UnixLibNames { + ); + let lib_with_main_ver = format!("{}.{}", lib, main_version); + +- Ok(Some(Self { ++ Some(Self { + canonical: lib, + with_main_ver: lib_with_main_ver, + with_full_ver: lib_with_full_ver, +- })) ++ }) + } + LibType::Dylib => { + let lib = format!("lib{lib_name}.dylib"); +@@ -136,13 +133,13 @@ impl UnixLibNames { + "lib{}.{}.{}.{}.dylib", + lib_name, lib_version.major, lib_version.minor, lib_version.patch + ); +- Ok(Some(Self { ++ Some(Self { + canonical: lib, + with_main_ver: lib_with_main_ver, + with_full_ver: lib_with_full_ver, +- })) ++ }) + } +- LibType::Windows => Ok(None), ++ LibType::Windows => None, + } + } + +@@ -242,7 +239,7 @@ pub fn cinstall(ws: &Workspace, packages: &[CPackage]) -> anyhow::Result<()> { + let lib_type = LibType::from_build_targets(build_targets); + match lib_type { + LibType::So | LibType::Dylib => { +- let lib = UnixLibNames::new(lib_type, &capi_config.library)?.unwrap(); ++ let lib = UnixLibNames::new(lib_type, &capi_config.library).unwrap(); + lib.install(capi_config, shared_lib, &install_path_lib)?; + } + LibType::Windows => { +diff --git a/src/target.rs b/src/target.rs +index 7ada1be..1cbdef4 100644 +--- a/src/target.rs ++++ b/src/target.rs +@@ -56,7 +56,7 @@ impl Target { + capi_config: &CApiConfig, + libdir: &Path, + target_dir: &Path, +- ) -> anyhow::Result> { ++ ) -> Vec { + let mut lines = Vec::new(); + + let lib_name = &capi_config.library.name; +@@ -69,7 +69,7 @@ impl Target { + let os = &self.os; + let env = &self.env; + +- let sover = capi_config.library.sover()?; ++ let sover = capi_config.library.sover(); + + if os == "android" { + lines.push(format!("-Wl,-soname,lib{lib_name}.so")); +@@ -111,6 +111,6 @@ impl Target { + // See: https://github.com/emscripten-core/emscripten/blob/3.1.39/emcc.py#L92-L94 + // else if os == "emscripten" + +- Ok(lines) ++ lines + } + } diff --git a/SOURCES/cargo-c-0.9.27+cargo-0.74.0.crate b/SOURCES/cargo-c-0.9.27+cargo-0.74.0.crate new file mode 100644 index 0000000..e134df3 Binary files /dev/null and b/SOURCES/cargo-c-0.9.27+cargo-0.74.0.crate differ diff --git a/SOURCES/cargo-c-fix-metadata-auto.diff b/SOURCES/cargo-c-fix-metadata-auto.diff new file mode 100644 index 0000000..e9a3e67 --- /dev/null +++ b/SOURCES/cargo-c-fix-metadata-auto.diff @@ -0,0 +1,28 @@ +--- cargo-c-0.9.27+cargo-0.74.0/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ cargo-c-0.9.27+cargo-0.74.0/Cargo.toml 2023-11-11T11:12:03.277637+00:00 +@@ -13,7 +13,7 @@ + edition = "2021" + rust-version = "1.70" + name = "cargo-c" +-version = "0.9.27+cargo-0.74.0" ++version = "0.9.27" + authors = ["Luca Barbato "] + description = "Helper program to build and install c-like libraries" + readme = "README.md" +@@ -103,15 +103,4 @@ + default = [] + vendored-openssl = ["cargo/vendored-openssl"] + +-[target."cfg(windows)".dependencies.windows-sys] +-version = "0.48" +-features = [ +- "Win32_Foundation", +- "Win32_Storage_FileSystem", +- "Win32_System_IO", +- "Win32_System_Console", +- "Win32_System_Threading", +- "Win32_System_JobObjects", +- "Win32_Security", +- "Win32_System_SystemServices", +-] ++ diff --git a/SOURCES/cargo-c-fix-metadata.diff b/SOURCES/cargo-c-fix-metadata.diff index 1929a39..93271fa 100644 --- a/SOURCES/cargo-c-fix-metadata.diff +++ b/SOURCES/cargo-c-fix-metadata.diff @@ -1,16 +1,9 @@ ---- cargo-c-0.9.12+cargo-0.64/Cargo.toml 1970-01-01T00:00:01+00:00 -+++ cargo-c-0.9.12+cargo-0.64/Cargo.toml 2022-08-25T10:44:01.925899+00:00 -@@ -12,7 +12,7 @@ - [package] - edition = "2021" - name = "cargo-c" --version = "0.9.12+cargo-0.64" -+version = "0.9.12" - authors = ["Luca Barbato "] - description = "Helper program to build and install c-like libraries" - readme = "README.md" -@@ -96,4 +96,3 @@ +--- cargo-c-0.9.27+cargo-0.74.0/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ cargo-c-0.9.27+cargo-0.74.0/Cargo.toml 2023-11-11T11:12:10.373660+00:00 +@@ -101,6 +101,5 @@ [features] default = [] -vendored-openssl = ["cargo/vendored-openssl"] + + diff --git a/SOURCES/macros.cargo-c b/SOURCES/macros.cargo-c new file mode 100644 index 0000000..a037810 --- /dev/null +++ b/SOURCES/macros.cargo-c @@ -0,0 +1,26 @@ +%cargo_cbuild(naf:)\ +%{shrink: \ + %{__cargo} cbuild \ + %{__cargo_common_opts} \ + --profile rpm \ + %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ + --destdir=%{buildroot} \ + --prefix=%{_prefix} \ + --libdir=%{_libdir} \ + --includedir=%{_includedir} \ + --pkgconfigdir=%{_libdir}/pkgconfig \ +} + +%cargo_cinstall(naf:)\ +%{shrink: \ + %{__cargo} cinstall \ + %{__cargo_common_opts} \ + --profile rpm \ + %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ + --destdir=%{buildroot} \ + --prefix=%{_prefix} \ + --libdir=%{_libdir} \ + --includedir=%{_includedir} \ + --pkgconfigdir=%{_libdir}/pkgconfig \ +} + diff --git a/SPECS/rust-cargo-c.spec b/SPECS/rust-cargo-c.spec index ed34040..1979b04 100644 --- a/SPECS/rust-cargo-c.spec +++ b/SPECS/rust-cargo-c.spec @@ -2,38 +2,43 @@ ## (rpmautospec version 0.3.5) ## RPMAUTOSPEC: autorelease, autochangelog %define autorelease(e:s:pb:n) %{?-p:0.}%{lua: - release_number = 4; + release_number = 2; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} ## END: Set by rpmautospec -# Generated by rust2rpm 22 +# Generated by rust2rpm 25 %bcond_without check # reduce debuginfo verbosity to work around OOM problems on 32-bit arches %global rustflags_debuginfo 1 %global crate cargo-c -%global upstream_version 0.9.12+cargo-0.64 +%global upstream_version 0.9.27+cargo-0.74.0 Name: rust-cargo-c -Version: 0.9.12 +Version: 0.9.27 Release: %autorelease Summary: Helper program to build and install c-like libraries License: MIT URL: https://crates.io/crates/cargo-c Source0: %{crates_source %{crate} %{upstream_version}} -Source1: LICENSE.dependencies +Source1: macros.cargo-c +# Automatically generated patch to strip dependencies and normalize metadata +Patch: cargo-c-fix-metadata-auto.diff # Manually created patch for downstream crate metadata changes # * drop +cargo version suffix from crate version # * remove vendored OpenSSL feature Patch: cargo-c-fix-metadata.diff +# * backport upstream change: Add version_suffix_components setting +# This is required to work around breaking changes in the default +# behaviour of cargo-c v0.9.26 and newer (using "0." as the soname +# for versions < 1.0.0 instead of just "0"). +Patch: https://github.com/lu-zero/cargo-c/pull/352.patch -ExclusiveArch: %{rust_arches} - -BuildRequires: rust-packaging >= 21 +BuildRequires: cargo-rpm-macros >= 24 %global _description %{expand: Helper program to build and install c-like libraries.} @@ -42,19 +47,25 @@ Helper program to build and install c-like libraries.} %package -n %{crate} Summary: %{summary} +# (Apache-2.0 OR MIT) AND BSD-3-Clause +# (MIT OR Apache-2.0) AND BSD-3-Clause AND GPL-2.0-only WITH GCC-exception-2.0 AND MIT # (MIT OR Apache-2.0) AND Unicode-DFS-2016 +# 0BSD OR MIT OR Apache-2.0 # Apache-2.0 # Apache-2.0 OR BSL-1.0 # Apache-2.0 OR MIT +# Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT +# BSD-3-Clause +# ISC # MIT -# MIT AND GPL-2.0-only WITH GCC-exception-2.0 AND BSD-3-Clause # MIT OR Apache-2.0 +# MIT OR Apache-2.0 OR BSD-1-Clause # MIT OR Apache-2.0 OR Zlib +# MIT OR Zlib OR Apache-2.0 # MPL-2.0 -# MPL-2.0+ # Unlicense OR MIT # Zlib OR Apache-2.0 OR MIT -License: MIT AND Apache-2.0 AND BSD-3-Clause AND GPL-2.0-only WITH GCC-exception-2.0 AND MPL-2.0 AND Unicode-DFS-2016 +License: MIT AND Apache-2.0 AND BSD-3-Clause AND GPL-2.0-only WITH GCC-exception-2.0 AND ISC AND MPL-2.0 AND Unicode-DFS-2016 AND (0BSD OR MIT OR Apache-2.0) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (MIT OR Apache-2.0 OR BSD-1-Clause) AND (MIT OR Apache-2.0 OR Zlib) AND (Unlicense OR MIT) # LICENSE.dependencies contains a full license breakdown %description -n %{crate} %{_description} @@ -67,6 +78,7 @@ License: MIT AND Apache-2.0 AND BSD-3-Clause AND GPL-2.0-only WITH GCC-ex %{_bindir}/cargo-cbuild %{_bindir}/cargo-cinstall %{_bindir}/cargo-ctest +%{_rpmmacrodir}/macros.cargo-c %package devel Summary: %{summary} @@ -96,7 +108,6 @@ use the "default" feature of the "%{crate}" crate. %prep %autosetup -n %{crate}-%{upstream_version} -p1 -cp -pav %{SOURCE1} . %cargo_prep %generate_buildrequires @@ -104,9 +115,12 @@ cp -pav %{SOURCE1} . %build %cargo_build +%{cargo_license_summary} +%{cargo_license} > LICENSE.dependencies %install %cargo_install +install -D -p -m 0644 -t %{buildroot}/%{_rpmmacrodir} %{SOURCE1} %if %{with check} %check @@ -114,8 +128,29 @@ cp -pav %{SOURCE1} . %endif %changelog -* Fri Oct 13 2023 Arkady L. Shane - 0.9.12-4 -- Rebuilt for MSVSphere 9.2 +* Mon Jan 15 2024 Arkady L. Shane - 0.9.27-2 +- Rebuilt for MSVSphere 9.3 + +* Tue Dec 05 2023 Fabio Valentini - 0.9.27-2 +- Backport upstream change to add the version_suffix_components setting + +* Sat Nov 11 2023 Fabio Valentini - 0.9.27-1 +- Update to version 0.9.27+cargo-0.74.0; Fixes RHBZ#2130183 + +* Sat Sep 30 2023 Fabio Valentini - 0.9.19-5 +- Adapt cargo-c macros to support the same flags as the cargo counterparts + +* Tue Aug 22 2023 Fabio Valentini - 0.9.19-4 +- Fix license tag for binary subpackage to exclude invalid MPL-2.0+ + +* Fri Jul 21 2023 Fedora Release Engineering - 0.9.19-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Fri Jul 07 2023 Fabio Valentini - 0.9.19-2 +- Add RPM macros for cargo-cbuild and cargo-cinstall + +* Fri Jun 16 2023 Fabio Valentini - 0.9.19-1 +- Update to version 0.9.19+cargo-0.70 * Wed May 03 2023 Fabio Valentini - 0.9.12-4 - Rebuild for openssl crate >= v0.10.48 (RUSTSEC-2023-{0022,0023,0024})