commit
3ba37026b7
@ -0,0 +1 @@
|
||||
SOURCES/isal-sys-0.5.3+496255c.crate
|
@ -0,0 +1 @@
|
||||
246de28aa522acae1a17a81c706fcf80a581e75b SOURCES/isal-sys-0.5.3+496255c.crate
|
@ -0,0 +1,174 @@
|
||||
From 7774f87f17effff3affa6d04a7e9f7b5a8b5ade1 Mon Sep 17 00:00:00 2001
|
||||
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
|
||||
Date: Fri, 4 Oct 2024 13:28:53 -0400
|
||||
Subject: [PATCH] Downstream-only: always use the system isa-l shared library
|
||||
and regenerate bindings
|
||||
|
||||
---
|
||||
build.rs | 122 ++---------------------------------------------
|
||||
src/igzip_lib.rs | 6 +--
|
||||
2 files changed, 7 insertions(+), 121 deletions(-)
|
||||
|
||||
diff --git a/build.rs b/build.rs
|
||||
index b439804..dfe9780 100644
|
||||
--- a/build.rs
|
||||
+++ b/build.rs
|
||||
@@ -1,131 +1,17 @@
|
||||
use std::path::PathBuf;
|
||||
-use std::{
|
||||
- io::{self, Write},
|
||||
- process::{Command, Stdio},
|
||||
-};
|
||||
|
||||
fn main() {
|
||||
+ // Downstream patch: always use the system shared library, and always regenerate bindings.
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
+ println!("cargo:rustc-link-lib=isal");
|
||||
|
||||
- let is_static = cfg!(feature = "static");
|
||||
- let is_shared = cfg!(feature = "shared");
|
||||
- let target = std::env::var("TARGET").unwrap();
|
||||
- let out_dir = PathBuf::from(&std::env::var("OUT_DIR").unwrap());
|
||||
-
|
||||
- // Copy isa-l source into out; not allow to modify things outside of out dir
|
||||
- let src_dir = out_dir.join("isa-l");
|
||||
- if src_dir.exists() {
|
||||
- std::fs::remove_dir_all(&src_dir).unwrap(); // maybe from a previous build
|
||||
- }
|
||||
- copy_dir::copy_dir("isa-l", &src_dir).unwrap();
|
||||
-
|
||||
- let install_path = std::env::var("ISAL_INSTALL_PREFIX")
|
||||
- .map(|p| PathBuf::from(&p).clone())
|
||||
- .unwrap_or(out_dir.clone());
|
||||
-
|
||||
- let current_dir = std::env::current_dir().unwrap();
|
||||
- std::env::set_current_dir(&src_dir).unwrap();
|
||||
-
|
||||
- // build from source
|
||||
- #[cfg(not(feature = "use-system-isal"))]
|
||||
- {
|
||||
- #[cfg(not(target_os = "windows"))]
|
||||
- let cmd = {
|
||||
- let status = Command::new("./autogen.sh")
|
||||
- .stdout(Stdio::piped())
|
||||
- .stderr(Stdio::piped())
|
||||
- .output()
|
||||
- .unwrap();
|
||||
- io::stdout().write_all(&status.stdout).unwrap();
|
||||
- io::stderr().write_all(&status.stderr).unwrap();
|
||||
- if !status.status.success() {
|
||||
- panic!("autogen failed");
|
||||
- }
|
||||
-
|
||||
- let compiler = cc::Build::new().get_compiler();
|
||||
- let cflags = compiler.cflags_env().into_string().unwrap();
|
||||
-
|
||||
- let mut configure_args = vec![
|
||||
- format!("--prefix={}", install_path.display()),
|
||||
- format!("--host={}", target),
|
||||
- format!("--enable-static={}", if is_static { "yes" } else { "no" }),
|
||||
- format!("--enable-shared={}", if is_shared { "yes" } else { "no" }),
|
||||
- format!("CFLAGS={}", cflags),
|
||||
- format!("CC={}", compiler.path().display()),
|
||||
- ];
|
||||
-
|
||||
- if !cfg!(target_os = "macos") {
|
||||
- let ldflag = if is_static { "static" } else { "shared" };
|
||||
- configure_args.push(format!("LDFLAGS=-{}", ldflag));
|
||||
- configure_args.push("--with-pic=yes".to_string());
|
||||
- }
|
||||
-
|
||||
- let status = Command::new("./configure")
|
||||
- .args(&configure_args)
|
||||
- .stdout(Stdio::piped())
|
||||
- .stderr(Stdio::piped())
|
||||
- .output()
|
||||
- .unwrap();
|
||||
- io::stdout().write_all(&status.stdout).unwrap();
|
||||
- io::stderr().write_all(&status.stderr).unwrap();
|
||||
- if !status.status.success() {
|
||||
- panic!("configure failed");
|
||||
- }
|
||||
-
|
||||
- Command::new("make")
|
||||
- .args(&["install-libLTLIBRARIES"])
|
||||
- .stdout(Stdio::piped())
|
||||
- .stderr(Stdio::piped())
|
||||
- .spawn()
|
||||
- };
|
||||
-
|
||||
- #[cfg(target_os = "windows")]
|
||||
- let mut cmd = {
|
||||
- Command::new("nmake")
|
||||
- .args(["-f", "Makefile.nmake"])
|
||||
- .stdout(Stdio::piped())
|
||||
- .stderr(Stdio::piped())
|
||||
- .spawn()
|
||||
- };
|
||||
-
|
||||
- std::env::set_current_dir(¤t_dir).unwrap();
|
||||
-
|
||||
- let output = cmd.unwrap().wait_with_output().unwrap();
|
||||
- io::stdout().write_all(&output.stdout).unwrap();
|
||||
- io::stderr().write_all(&output.stderr).unwrap();
|
||||
- if !output.status.success() {
|
||||
- panic!("Building isa-l failed");
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- let libname = if cfg!(target_os = "windows") {
|
||||
- println!("cargo:rustc-link-search=native={}", src_dir.display());
|
||||
- if cfg!(feature = "static") {
|
||||
- "isa-l_static"
|
||||
- } else {
|
||||
- "isa-l"
|
||||
- }
|
||||
- } else {
|
||||
- for subdir in ["bin", "lib", "lib64"] {
|
||||
- let search_path = install_path.join(subdir);
|
||||
- println!("cargo:rustc-link-search=native={}", search_path.display());
|
||||
- }
|
||||
- "isal"
|
||||
- };
|
||||
-
|
||||
- #[cfg(feature = "static")]
|
||||
- println!("cargo:rustc-link-lib=static={}", libname);
|
||||
-
|
||||
- #[cfg(feature = "shared")]
|
||||
- println!("cargo:rustc-link-lib={}", libname);
|
||||
-
|
||||
- #[cfg(feature = "regenerate-bindings")]
|
||||
{
|
||||
let out = PathBuf::from(&(format!("{}/igzip_lib.rs", std::env::var("OUT_DIR").unwrap())));
|
||||
bindgen::Builder::default()
|
||||
// The input header we would like to generate
|
||||
// bindings for.
|
||||
- .header("isa-l/include/igzip_lib.h")
|
||||
+ // Downstream patch: use the system header.
|
||||
+ .header("/usr/include/isa-l/igzip_lib.h")
|
||||
// Tell cargo to invalidate the built crate whenever any of the
|
||||
// included header files changed.
|
||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
||||
diff --git a/src/igzip_lib.rs b/src/igzip_lib.rs
|
||||
index dff227e..c6cbe31 100644
|
||||
--- a/src/igzip_lib.rs
|
||||
+++ b/src/igzip_lib.rs
|
||||
@@ -1,12 +1,12 @@
|
||||
pub use bindings::*;
|
||||
|
||||
-#[cfg(feature = "regenerate-bindings")]
|
||||
+// Downstream patch: always regenerate bindings
|
||||
pub mod bindings {
|
||||
include!(concat!(env!("OUT_DIR"), "/igzip_lib.rs"));
|
||||
}
|
||||
|
||||
-// copy from target dir when updating bindings
|
||||
-#[cfg(not(feature = "regenerate-bindings"))]
|
||||
+// Downstream patch: always regenerate bindings. cfg(any()) is false
|
||||
+#[cfg(any())]
|
||||
pub mod bindings {
|
||||
/* automatically generated by rust-bindgen 0.69.4 */
|
||||
|
||||
--
|
||||
2.46.1
|
||||
|
@ -0,0 +1,16 @@
|
||||
--- isal-sys-0.5.3+496255c/Cargo.toml 1970-01-01T00:00:01+00:00
|
||||
+++ isal-sys-0.5.3+496255c/Cargo.toml 2024-10-15T11:25:03.536732+00:00
|
||||
@@ -12,7 +12,7 @@
|
||||
[package]
|
||||
edition = "2021"
|
||||
name = "isal-sys"
|
||||
-version = "0.5.3+496255c"
|
||||
+version = "0.5.3"
|
||||
authors = ["Miles Granger <miles59923@gmail.com>"]
|
||||
build = "build.rs"
|
||||
autobins = false
|
||||
@@ -48,3 +48,4 @@
|
||||
shared = []
|
||||
static = []
|
||||
use-system-isal = []
|
||||
+
|
@ -0,0 +1,22 @@
|
||||
--- isal-sys-0.5.3+496255c/Cargo.toml 1970-01-01T00:00:01+00:00
|
||||
+++ isal-sys-0.5.3+496255c/Cargo.toml 2024-10-15T11:25:32.697092+00:00
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
[build-dependencies.bindgen]
|
||||
version = "^0.69"
|
||||
-optional = true
|
||||
|
||||
[build-dependencies.cc]
|
||||
version = "^1"
|
||||
@@ -43,9 +42,8 @@
|
||||
version = "0.1.3"
|
||||
|
||||
[features]
|
||||
-default = ["static"]
|
||||
-regenerate-bindings = ["dep:bindgen"]
|
||||
+default = ["shared"]
|
||||
+regenerate-bindings = []
|
||||
shared = []
|
||||
-static = []
|
||||
use-system-isal = []
|
||||
|
@ -0,0 +1,151 @@
|
||||
## START: Set by rpmautospec
|
||||
## (rpmautospec version 0.7.2)
|
||||
## RPMAUTOSPEC: autorelease, autochangelog
|
||||
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
|
||||
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 26
|
||||
%bcond_without check
|
||||
%global debug_package %{nil}
|
||||
|
||||
%global crate isal-sys
|
||||
%global upstream_version 0.5.3+496255c
|
||||
|
||||
Name: rust-isal-sys
|
||||
Version: 0.5.3
|
||||
Release: %autorelease
|
||||
Summary: Isa-l sys crate
|
||||
|
||||
License: BSD-3-Clause
|
||||
URL: https://crates.io/crates/isal-sys
|
||||
Source: %{crates_source %{crate} %{upstream_version}}
|
||||
# Automatically generated patch to strip dependencies and normalize metadata
|
||||
Patch: isal-sys-fix-metadata-auto.diff
|
||||
# Manually created patch for downstream crate metadata changes
|
||||
# * Remove the static feature, and replace it with shared in the default
|
||||
# features
|
||||
# * Make bindgen non-optional
|
||||
Patch: isal-sys-fix-metadata.diff
|
||||
# * Downstream-only: always use the system isa-l shared library and regenerate
|
||||
# bindings
|
||||
Patch10: 0001-Downstream-only-always-use-the-system-isa-l-shared-l.patch
|
||||
|
||||
# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
|
||||
# Additionally, the isa-l package is ExcludeArch: %%{ix86}.
|
||||
ExcludeArch: %{ix86}
|
||||
|
||||
BuildRequires: cargo-rpm-macros >= 24
|
||||
BuildRequires: tomcli
|
||||
BuildRequires: isa-l-devel
|
||||
|
||||
%global _description %{expand:
|
||||
Isa-l sys crate.}
|
||||
|
||||
%description %{_description}
|
||||
|
||||
%package devel
|
||||
Summary: %{summary}
|
||||
BuildArch: noarch
|
||||
Requires: isa-l-devel
|
||||
|
||||
%description devel %{_description}
|
||||
|
||||
This package contains library source intended for building other packages which
|
||||
use the "%{crate}" crate.
|
||||
|
||||
%files devel
|
||||
%license %{crate_instdir}/LICENSE
|
||||
%{crate_instdir}/
|
||||
|
||||
%package -n %{name}+default-devel
|
||||
Summary: %{summary}
|
||||
BuildArch: noarch
|
||||
|
||||
%description -n %{name}+default-devel %{_description}
|
||||
|
||||
This package contains library source intended for building other packages which
|
||||
use the "default" feature of the "%{crate}" crate.
|
||||
|
||||
%files -n %{name}+default-devel
|
||||
%ghost %{crate_instdir}/Cargo.toml
|
||||
|
||||
%package -n %{name}+regenerate-bindings-devel
|
||||
Summary: %{summary}
|
||||
BuildArch: noarch
|
||||
|
||||
%description -n %{name}+regenerate-bindings-devel %{_description}
|
||||
|
||||
This package contains library source intended for building other packages which
|
||||
use the "regenerate-bindings" feature of the "%{crate}" crate.
|
||||
|
||||
%files -n %{name}+regenerate-bindings-devel
|
||||
%ghost %{crate_instdir}/Cargo.toml
|
||||
|
||||
%package -n %{name}+shared-devel
|
||||
Summary: %{summary}
|
||||
BuildArch: noarch
|
||||
|
||||
%description -n %{name}+shared-devel %{_description}
|
||||
|
||||
This package contains library source intended for building other packages which
|
||||
use the "shared" feature of the "%{crate}" crate.
|
||||
|
||||
%files -n %{name}+shared-devel
|
||||
%ghost %{crate_instdir}/Cargo.toml
|
||||
|
||||
%package -n %{name}+use-system-isal-devel
|
||||
Summary: %{summary}
|
||||
BuildArch: noarch
|
||||
|
||||
%description -n %{name}+use-system-isal-devel %{_description}
|
||||
|
||||
This package contains library source intended for building other packages which
|
||||
use the "use-system-isal" feature of the "%{crate}" crate.
|
||||
|
||||
%files -n %{name}+use-system-isal-devel
|
||||
%ghost %{crate_instdir}/Cargo.toml
|
||||
|
||||
%prep
|
||||
%autosetup -n %{crate}-%{upstream_version} -p1
|
||||
# Remove the bundled copy of isa-l
|
||||
rm -rv isa-l
|
||||
|
||||
# These would only be needed to build the bundled isa-l:
|
||||
tomcli set Cargo.toml del build-dependencies.cc
|
||||
tomcli set Cargo.toml del build-dependencies.copy_dir
|
||||
|
||||
# To be more pedantically correct, replace the hard-coded /usr/include patched
|
||||
# into build.rs with the expansion of %%{_includedir}.
|
||||
sed -r -i 's@/usr/include\b@%{_includedir}@' build.rs
|
||||
|
||||
%cargo_prep
|
||||
|
||||
%generate_buildrequires
|
||||
%cargo_generate_buildrequires
|
||||
|
||||
%build
|
||||
%cargo_build
|
||||
|
||||
%install
|
||||
%cargo_install
|
||||
|
||||
%if %{with check}
|
||||
%check
|
||||
%cargo_test
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Sun Jan 05 2025 Arkady L. Shane <tigro@msvsphere-os.ru> - 0.5.3-2
|
||||
- Rebuilt for MSVSphere 10
|
||||
|
||||
## START: Generated by rpmautospec
|
||||
* Thu Oct 17 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.3-2
|
||||
- Exclude i686 (where isa-l is not available)
|
||||
|
||||
* Thu Oct 17 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5.3-1
|
||||
- Initial commit (close RHBZ#2319246)
|
||||
## END: Generated by rpmautospec
|
Loading…
Reference in new issue