Update to version 2.0.7+zstd.1.5.4; Fixes RHBZ#2145250

epel9
Fabio Valentini 2 years ago
parent 7a1fe57ea6
commit 901ee1ef93
No known key found for this signature in database
GPG Key ID: 5AC5F572E5D410AF

1
.gitignore vendored

@ -7,3 +7,4 @@
/zstd-sys-1.6.2+zstd.1.5.1.crate
/zstd-sys-1.6.3+zstd.1.5.2.crate
/zstd-sys-2.0.1+zstd.1.5.2.crate
/zstd-sys-2.0.7+zstd.1.5.4.crate

@ -1,45 +1,42 @@
From d68956f4ce606077a716b7fba3148d8986dd6165 Mon Sep 17 00:00:00 2001
From dfbd6b8c91aa8f35eef5afa6593b8ef06ce2bfe1 Mon Sep 17 00:00:00 2001
From: Fabio Valentini <decathorpe@gmail.com>
Date: Sat, 6 Aug 2022 18:54:46 +0200
Date: Thu, 23 Feb 2023 18:50:32 +0100
Subject: [PATCH] unconditionally use bindgen and pkg-config to link against
system libzstd
---
build.rs | 170 +------------------------------------------------------
1 file changed, 1 insertion(+), 169 deletions(-)
build.rs | 218 +------------------------------------------------------
1 file changed, 3 insertions(+), 215 deletions(-)
diff --git a/build.rs b/build.rs
index 83f2dc2..2336d61 100644
index 04fb94f..44f36b0 100644
--- a/build.rs
+++ b/build.rs
@@ -2,7 +2,6 @@ use std::ffi::OsStr;
use std::path::{Path, PathBuf};
use std::{env, fs};
@@ -1,8 +1,6 @@
-use std::ffi::OsStr;
-use std::path::{Path, PathBuf};
-use std::{env, fmt, fs};
+use std::path::PathBuf;
+use std::{env, fmt};
-#[cfg(feature = "bindgen")]
fn generate_bindings(defs: Vec<&str>, headerpaths: Vec<PathBuf>) {
let bindings = bindgen::Builder::default()
.header("zstd.h");
@@ -36,10 +35,6 @@ fn generate_bindings(defs: Vec<&str>, headerpaths: Vec<PathBuf>) {
let bindings = bindgen::Builder::default().header("zstd.h");
#[cfg(feature = "zdict_builder")]
@@ -35,9 +33,6 @@ fn generate_bindings(defs: Vec<&str>, headerpaths: Vec<PathBuf>) {
.expect("Could not write bindings");
}
-#[cfg(not(feature = "bindgen"))]
-fn generate_bindings(_: Vec<&str>, _: Vec<PathBuf>) {}
-
-#[cfg(feature = "pkg-config")]
fn pkg_config() -> (Vec<&'static str>, Vec<PathBuf>) {
let library = pkg_config::Config::new()
.statik(true)
@@ -49,171 +44,8 @@ fn pkg_config() -> (Vec<&'static str>, Vec<PathBuf>) {
@@ -47,189 +42,6 @@ fn pkg_config() -> (Vec<&'static str>, Vec<PathBuf>) {
(vec!["PKG_CONFIG"], library.include_paths)
}
-#[cfg(not(feature = "pkg-config"))]
-fn pkg_config() -> (Vec<&'static str>, Vec<PathBuf>) {
- unimplemented!()
-}
-
-#[cfg(not(feature = "legacy"))]
-fn set_legacy(_config: &mut cc::Build) {}
-
@ -65,6 +62,19 @@ index 83f2dc2..2336d61 100644
-#[cfg(not(feature = "zstdmt"))]
-fn enable_threading(_config: &mut cc::Build) {}
-
-/// This function would find the first flag in `flags` that is supported
-/// and add that to `config`.
-#[allow(dead_code)]
-fn flag_if_supported_with_fallbacks(config: &mut cc::Build, flags: &[&str]) {
- let option = flags
- .iter()
- .find(|flag| config.is_flag_supported(flag).unwrap_or_default());
-
- if let Some(flag) = option {
- config.flag(flag);
- }
-}
-
-fn compile_zstd() {
- let mut config = cc::Build::new();
-
@ -78,56 +88,91 @@ index 83f2dc2..2336d61 100644
- #[cfg(feature = "legacy")]
- "zstd/lib/legacy",
- ] {
- for entry in fs::read_dir(dir).unwrap() {
- let path = entry.unwrap().path();
- // Skip xxhash*.c files: since we are using the "PRIVATE API"
- // mode, it will be inlined in the headers.
- if path
- .file_name()
- .and_then(|p| p.to_str())
- .map_or(false, |p| p.contains("xxhash"))
- {
- continue;
- }
- if path.extension() == Some(OsStr::new("c")) {
- config.file(path);
- }
- }
- let mut entries: Vec<_> = fs::read_dir(dir)
- .unwrap()
- .map(Result::unwrap)
- .filter_map(|entry| {
- let filename = entry.file_name();
-
- if Path::new(&filename).extension() == Some(OsStr::new("c"))
- // Skip xxhash*.c files: since we are using the "PRIVATE API"
- // mode, it will be inlined in the headers.
- && !filename.to_string_lossy().contains("xxhash")
- {
- Some(entry.path())
- } else {
- None
- }
- })
- .collect();
- entries.sort();
-
- config.files(entries);
- }
-
- // Either include ASM files, or disable ASM entirely.
- // Also disable it on windows, apparently it doesn't do well with these .S files at the moment.
- if cfg!(any(target_os = "windows", feature = "no_asm")) {
- if cfg!(feature = "no_asm") || std::env::var("CARGO_CFG_WINDOWS").is_ok() {
- config.define("ZSTD_DISABLE_ASM", Some(""));
- } else {
- config.file("zstd/lib/decompress/huf_decompress_amd64.S");
- }
-
- let is_wasm_unknown_unknown = env::var("TARGET").ok() == Some("wasm32-unknown-unknown".into());
- let is_wasm = env::var("TARGET")
- .map_or(false, |target| target.starts_with("wasm32-"));
-
- if is_wasm_unknown_unknown {
- println!("cargo:rerun-if-changed=wasm-shim/stdlib.h");
- println!("cargo:rerun-if-changed=wasm-shim/string.h");
- if is_wasm {
- cargo_print(&"rerun-if-changed=wasm-shim/stdlib.h");
- cargo_print(&"rerun-if-changed=wasm-shim/string.h");
-
- config.include("wasm-shim/");
- config.define("XXH_STATIC_ASSERT", Some("0"));
- }
-
- // Some extra parameters
- config.opt_level(3);
- config.include("zstd/lib/");
- config.include("zstd/lib/common");
- config.warnings(false);
-
- config.define("ZSTD_LIB_DEPRECATED", Some("0"));
-
- config
- .flag_if_supported("-ffunction-sections")
- .flag_if_supported("-fdata-sections")
- .flag_if_supported("-fmerge-all-constants");
-
- if cfg!(feature = "fat-lto") {
- config.flag_if_supported("-flto");
- } else if cfg!(feature = "thin-lto") {
- flag_if_supported_with_fallbacks(
- &mut config,
- &["-flto=thin", "-flto"],
- );
- }
-
- #[cfg(feature = "thin")]
- {
- config.define("HUF_FORCE_DECOMPRESS_X1", Some("1"));
- config.define("ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT", Some("1"));
- config.define("ZSTD_NO_INLINE ", Some("1"));
- config.flag_if_supported("-flto=thin");
- config.flag_if_supported("-Oz");
- // Here we try to build a lib as thin/small as possible.
- // We cannot use ZSTD_LIB_MINIFY since it is only
- // used in Makefile to define other options.
-
- config
- .define("HUF_FORCE_DECOMPRESS_X1", Some("1"))
- .define("ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT", Some("1"))
- .define("ZSTD_NO_INLINE", Some("1"))
- // removes the error messages that are
- // otherwise returned by ZSTD_getErrorName
- .define("ZSTD_STRIP_ERROR_STRINGS", Some("1"));
-
- // Disable use of BMI2 instructions since it involves runtime checking
- // of the feature and fallback if no BMI2 instruction is detected.
- config.define("DYNAMIC_BMI2", Some("0"));
-
- // Disable support for all legacy formats
- #[cfg(not(feature = "legacy"))]
- config.define("ZSTD_LEGACY_SUPPORT", Some("0"));
-
- config.opt_level_str("z");
- }
-
- // Hide symbols from resulting library,
@ -152,7 +197,7 @@ index 83f2dc2..2336d61 100644
- * 7+: events at every position (*very* verbose)
- */
- #[cfg(feature = "debug")]
- if !is_wasm_unknown_unknown {
- if !is_wasm {
- config.define("DEBUGLEVEL", Some("5"));
- }
-
@ -172,20 +217,28 @@ index 83f2dc2..2336d61 100644
- .unwrap();
- #[cfg(feature = "zdict_builder")]
- fs::copy(src.join("zdict.h"), include.join("zdict.h")).unwrap();
- println!("cargo:root={}", dst.display());
- cargo_print(&format_args!("root={}", dst.display()));
-}
-
/// Print a line for cargo.
///
/// If non-cargo is set, do not print anything.
@@ -242,32 +54,8 @@ fn cargo_print(content: &dyn fmt::Display) {
fn main() {
cargo_print(&"rerun-if-env-changed=ZSTD_SYS_USE_PKG_CONFIG");
- let target_arch =
- std::env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default();
- let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
-
- if target_arch == "wasm32" || target_os == "hermit" {
- println!("cargo:rustc-cfg=feature=\"std\"");
- cargo_print(&"rustc-cfg=feature=\"std\"");
- }
-
- // println!("cargo:rustc-link-lib=zstd");
- let (defs, headerpaths) = if cfg!(feature = "pkg-config") {
// println!("cargo:rustc-link-lib=zstd");
- let (defs, headerpaths) = if cfg!(feature = "pkg-config")
- || env::var_os("ZSTD_SYS_USE_PKG_CONFIG").is_some()
- {
- pkg_config()
- } else {
- if !Path::new("zstd/lib").exists() {
@ -193,7 +246,7 @@ index 83f2dc2..2336d61 100644
- }
-
- let manifest_dir = PathBuf::from(
- env::var("CARGO_MANIFEST_DIR")
- env::var_os("CARGO_MANIFEST_DIR")
- .expect("Manifest dir is always set by cargo"),
- );
-
@ -205,5 +258,5 @@ index 83f2dc2..2336d61 100644
let includes: Vec<_> = headerpaths
.iter()
--
2.37.1
2.39.2

@ -1,3 +0,0 @@
# rust-zstd-sys
The rust-zstd-sys package

@ -1,12 +1,12 @@
# Generated by rust2rpm 22
# Generated by rust2rpm 24
%bcond_without check
%global debug_package %{nil}
%global crate zstd-sys
%global upstream_version 2.0.1+zstd.1.5.2
%global upstream_version 2.0.7+zstd.1.5.4
Name: rust-zstd-sys
Version: 2.0.1
Version: 2.0.7
Release: %autorelease
Summary: Low-level bindings for the zstd compression library
@ -16,14 +16,12 @@ URL: https://crates.io/crates/zstd-sys
Source: %{crates_source %{crate} %{upstream_version}}
# Manually created patch for downstream crate metadata changes
# * remove zstd version from version field
# * make bindgen and pkg-config build-dependencies non-optional
# * make bindgen build-dependency non-optional
# * fix logic for included / excluded files
Patch: zstd-sys-fix-metadata.diff
# * unconditionally use bindgen and pkg-config to link against system libzstd
Patch: 0001-unconditionally-use-bindgen-and-pkg-config-to-link-a.patch
ExclusiveArch: %{rust_arches}
BuildRequires: rust-packaging >= 21
%global _description %{expand:
@ -96,6 +94,18 @@ use the "experimental" feature of the "%{crate}" crate.
%files -n %{name}+experimental-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+fat-lto-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+fat-lto-devel %{_description}
This package contains library source intended for building other packages which
use the "fat-lto" feature of the "%{crate}" crate.
%files -n %{name}+fat-lto-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+legacy-devel
Summary: %{summary}
BuildArch: noarch
@ -168,6 +178,18 @@ use the "thin" feature of the "%{crate}" crate.
%files -n %{name}+thin-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+thin-lto-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+thin-lto-devel %{_description}
This package contains library source intended for building other packages which
use the "thin-lto" feature of the "%{crate}" crate.
%files -n %{name}+thin-lto-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+zdict_builder-devel
Summary: %{summary}
BuildArch: noarch

@ -1 +1 @@
SHA512 (zstd-sys-2.0.1+zstd.1.5.2.crate) = a54ff4159640d31f898cbd374b9117d1e7ee4b54c5b4a8e1ed6286d9e954341e077088c52161e086ef0f28dfec13e03f64013712fa9bc59d471191cffd8e0e1e
SHA512 (zstd-sys-2.0.7+zstd.1.5.4.crate) = dcddc4f0d7486ee144df4e2173536dc02c9714b6f702edb9a9e04b4c02f4d347b5a70fbc020c1d08c079d38a423c4dc8b6b86e7e43ec3ccfcc8e3ff9861be11b

@ -1,11 +1,11 @@
--- zstd-sys-2.0.1+zstd.1.5.2/Cargo.toml 1970-01-01T00:00:01+00:00
+++ zstd-sys-2.0.1+zstd.1.5.2/Cargo.toml 2022-08-06T17:03:27.974126+00:00
@@ -12,20 +12,15 @@
[package]
--- zstd-sys-2.0.7+zstd.1.5.4/Cargo.toml 1970-01-01T00:00:01+00:00
+++ zstd-sys-2.0.7+zstd.1.5.4/Cargo.toml 2023-02-23T17:56:59.578432+00:00
@@ -13,20 +13,15 @@
edition = "2018"
rust-version = "1.43"
name = "zstd-sys"
-version = "2.0.1+zstd.1.5.2"
+version = "2.0.1"
-version = "2.0.7+zstd.1.5.4"
+version = "2.0.7"
authors = ["Alexandre Bury <alexandre.bury@gmail.com>"]
build = "build.rs"
links = "zstd"
@ -27,30 +27,19 @@
]
description = "Low-level bindings for the zstd compression library."
readme = "Readme.md"
@@ -52,7 +47,6 @@
[build-dependencies.bindgen]
version = "0.59"
@@ -57,7 +52,6 @@
"runtime",
"which-rustfmt",
]
-optional = true
default-features = false
[build-dependencies.cc]
version = "1.0.45"
@@ -60,9 +54,9 @@
[build-dependencies.pkg-config]
@@ -68,6 +62,7 @@
version = "0.3"
-optional = true
[features]
+bindgen = []
debug = []
default = [
"legacy",
@@ -72,6 +66,7 @@
legacy = []
no_asm = []
non-cargo = []
+pkg-config = []
std = []
thin = []
zdict_builder = []

Loading…
Cancel
Save