commit
1e8a402859
@ -0,0 +1,127 @@
|
|||||||
|
From 8a87f94f09c98f2c503da541239b819d2fe0178c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabio Valentini <decathorpe@gmail.com>
|
||||||
|
Date: Mon, 12 Dec 2022 23:28:52 +0100
|
||||||
|
Subject: [PATCH] build: unconditionally link against system liblzma
|
||||||
|
|
||||||
|
---
|
||||||
|
build.rs | 107 ++-----------------------------------------------------
|
||||||
|
1 file changed, 2 insertions(+), 105 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/build.rs b/build.rs
|
||||||
|
index 6bec545..22ab405 100644
|
||||||
|
--- a/build.rs
|
||||||
|
+++ b/build.rs
|
||||||
|
@@ -1,108 +1,5 @@
|
||||||
|
-use std::env;
|
||||||
|
-use std::fs;
|
||||||
|
-use std::path::PathBuf;
|
||||||
|
-
|
||||||
|
-const SKIP_FILENAMES: &[&str] = &["crc32_small", "crc64_small"];
|
||||||
|
-
|
||||||
|
fn main() {
|
||||||
|
- let target = env::var("TARGET").unwrap();
|
||||||
|
-
|
||||||
|
println!("cargo:rerun-if-changed=build.rs");
|
||||||
|
- println!("cargo:rerun-if-env-changed=LZMA_API_STATIC");
|
||||||
|
- let want_static = cfg!(feature = "static") || env::var("LZMA_API_STATIC").is_ok();
|
||||||
|
- let msvc = target.contains("msvc");
|
||||||
|
-
|
||||||
|
- // If a static link is desired, we compile from source.
|
||||||
|
- // If we're compiling for MSVC, pkg-config runs a risk of picking up MinGW
|
||||||
|
- // libraries by accident, so disable it.
|
||||||
|
- //
|
||||||
|
- // Otherwise check the system to see if it has an lzma library already
|
||||||
|
- // installed that we can use.
|
||||||
|
- if !want_static && !msvc && pkg_config::probe_library("liblzma").is_ok() {
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- let out_dir = env::var("OUT_DIR").unwrap();
|
||||||
|
- println!("cargo:root={}", out_dir);
|
||||||
|
- let include_dir = env::current_dir().unwrap().join("xz-5.2/src/liblzma/api");
|
||||||
|
- println!("cargo:include={}", include_dir.display());
|
||||||
|
-
|
||||||
|
- let mut src_files = [
|
||||||
|
- "xz-5.2/src/liblzma/common",
|
||||||
|
- "xz-5.2/src/liblzma/lzma",
|
||||||
|
- "xz-5.2/src/liblzma/lz",
|
||||||
|
- "xz-5.2/src/liblzma/check",
|
||||||
|
- "xz-5.2/src/liblzma/delta",
|
||||||
|
- "xz-5.2/src/liblzma/rangecoder",
|
||||||
|
- "xz-5.2/src/liblzma/simple",
|
||||||
|
- ]
|
||||||
|
- .iter()
|
||||||
|
- .flat_map(|dir| read_dir_files(dir))
|
||||||
|
- .chain(vec![
|
||||||
|
- "xz-5.2/src/common/tuklib_cpucores.c".into(),
|
||||||
|
- "xz-5.2/src/common/tuklib_physmem.c".into(),
|
||||||
|
- ])
|
||||||
|
- .collect::<Vec<_>>();
|
||||||
|
-
|
||||||
|
- // sort to make build reproducible.
|
||||||
|
- src_files.sort();
|
||||||
|
-
|
||||||
|
- let mut build = cc::Build::new();
|
||||||
|
-
|
||||||
|
- build
|
||||||
|
- .files(src_files)
|
||||||
|
- // all C preproc defines are in `./config.h`
|
||||||
|
- .define("HAVE_CONFIG_H", "1")
|
||||||
|
- .include("xz-5.2/src/liblzma/api")
|
||||||
|
- .include("xz-5.2/src/liblzma/lzma")
|
||||||
|
- .include("xz-5.2/src/liblzma/lz")
|
||||||
|
- .include("xz-5.2/src/liblzma/check")
|
||||||
|
- .include("xz-5.2/src/liblzma/simple")
|
||||||
|
- .include("xz-5.2/src/liblzma/delta")
|
||||||
|
- .include("xz-5.2/src/liblzma/common")
|
||||||
|
- .include("xz-5.2/src/liblzma/rangecoder")
|
||||||
|
- .include("xz-5.2/src/common")
|
||||||
|
- .include(env::current_dir().unwrap());
|
||||||
|
-
|
||||||
|
- if !target.ends_with("msvc") {
|
||||||
|
- build.flag("-std=c99").flag("-pthread");
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if let Ok(s) = env::var("CARGO_CFG_TARGET_ENDIAN") {
|
||||||
|
- if s == "big" {
|
||||||
|
- build.define("WORDS_BIGENDIAN", None);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- build.compile("liblzma.a");
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-fn read_dir_files(dir: &str) -> impl Iterator<Item = PathBuf> {
|
||||||
|
- fs::read_dir(dir)
|
||||||
|
- .expect(&format!("failed to read dir {}", dir))
|
||||||
|
- .filter_map(|ent| {
|
||||||
|
- let ent = ent.expect("failed to read entry");
|
||||||
|
-
|
||||||
|
- if ent.file_type().unwrap().is_dir() {
|
||||||
|
- return None;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- let path = ent.path();
|
||||||
|
-
|
||||||
|
- if path.extension().unwrap() != "c" {
|
||||||
|
- return None;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- {
|
||||||
|
- let file_stem = path.file_stem().unwrap().to_str().unwrap();
|
||||||
|
- if SKIP_FILENAMES.contains(&file_stem) {
|
||||||
|
- return None;
|
||||||
|
- }
|
||||||
|
- if file_stem.ends_with("tablegen") {
|
||||||
|
- return None;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- Some(path)
|
||||||
|
- })
|
||||||
|
+ pkg_config::probe_library("liblzma").unwrap();
|
||||||
|
+ return;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.38.1
|
||||||
|
|
Binary file not shown.
@ -0,0 +1,9 @@
|
|||||||
|
--- lzma-sys-0.1.20/Cargo.toml 1970-01-01T00:00:01+00:00
|
||||||
|
+++ lzma-sys-0.1.20/Cargo.toml 2022-12-12T22:25:47.846905+00:00
|
||||||
|
@@ -36,6 +36,3 @@
|
||||||
|
|
||||||
|
[build-dependencies.pkg-config]
|
||||||
|
version = "0.3.14"
|
||||||
|
-
|
||||||
|
-[features]
|
||||||
|
-static = []
|
@ -0,0 +1,159 @@
|
|||||||
|
## START: Set by rpmautospec
|
||||||
|
## (rpmautospec version 0.3.0)
|
||||||
|
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
|
||||||
|
release_number = 1;
|
||||||
|
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 23
|
||||||
|
%bcond_without check
|
||||||
|
%global debug_package %{nil}
|
||||||
|
|
||||||
|
%global crate lzma-sys
|
||||||
|
|
||||||
|
Name: rust-lzma-sys
|
||||||
|
Version: 0.1.20
|
||||||
|
Release: %autorelease
|
||||||
|
Summary: Raw bindings to liblzma
|
||||||
|
|
||||||
|
# Upstream license specification: MIT/Apache-2.0
|
||||||
|
License: MIT OR Apache-2.0
|
||||||
|
URL: https://crates.io/crates/lzma-sys
|
||||||
|
Source: %{crates_source}
|
||||||
|
# Manually created patch for downstream crate metadata changes
|
||||||
|
# * drop feature for statically linking against the bundled version of liblzma
|
||||||
|
Patch: lzma-sys-fix-metadata.diff
|
||||||
|
Patch: 0001-build-unconditionally-link-against-system-liblzma.patch
|
||||||
|
|
||||||
|
BuildRequires: rust-packaging >= 21
|
||||||
|
|
||||||
|
%global _description %{expand:
|
||||||
|
Raw bindings to liblzma which contains an implementation of LZMA and xz stream
|
||||||
|
encoding/decoding.
|
||||||
|
High level Rust bindings are available in the `xz2` crate.}
|
||||||
|
|
||||||
|
%description %{_description}
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Summary: %{summary}
|
||||||
|
BuildArch: noarch
|
||||||
|
Requires: (pkgconfig(liblzma) >= 5.2.4 with pkgconfig(liblzma) < 6.0.0)
|
||||||
|
|
||||||
|
%description devel %{_description}
|
||||||
|
|
||||||
|
This package contains library source intended for building other packages which
|
||||||
|
use the "%{crate}" crate.
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%license %{crate_instdir}/LICENSE-APACHE
|
||||||
|
%license %{crate_instdir}/LICENSE-MIT
|
||||||
|
%{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
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -n %{crate}-%{version_no_tilde} -p1
|
||||||
|
# remove bundled dependencies
|
||||||
|
rm -r xz-*
|
||||||
|
rm config.h
|
||||||
|
%cargo_prep
|
||||||
|
|
||||||
|
%generate_buildrequires
|
||||||
|
%cargo_generate_buildrequires
|
||||||
|
echo '(pkgconfig(liblzma) >= 5.2.4 with pkgconfig(liblzma) < 6.0.0)'
|
||||||
|
|
||||||
|
%build
|
||||||
|
%cargo_build
|
||||||
|
|
||||||
|
%install
|
||||||
|
%cargo_install
|
||||||
|
|
||||||
|
%if %{with check}
|
||||||
|
%check
|
||||||
|
%cargo_test
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Mon Jan 15 2024 Arkady L. Shane <tigro@msvsphere-os.ru> - 0.1.20-1
|
||||||
|
- Rebuilt for MSVSphere 9.3
|
||||||
|
|
||||||
|
* Mon Dec 12 2022 Fabio Valentini <decathorpe@gmail.com> 0.1.20-1
|
||||||
|
- Update to version 0.1.20; Fixes RHBZ#2138901
|
||||||
|
|
||||||
|
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> 0.1.19-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sat Jul 16 2022 Fabio Valentini <decathorpe@gmail.com> 0.1.19-1
|
||||||
|
- Update to version 0.1.19; Fixes RHBZ#2094053
|
||||||
|
|
||||||
|
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.17-4
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.17-3
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||||
|
|
||||||
|
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.17-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Nov 06 2020 Fabio Valentini <decathorpe@gmail.com> - 0.1.17-1
|
||||||
|
- Update to version 0.1.17.
|
||||||
|
- Fixes RHBZ#1887198
|
||||||
|
|
||||||
|
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.16-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri May 15 2020 Josh Stone <jistone@redhat.com> - 0.1.16-1
|
||||||
|
- Update to 0.1.16
|
||||||
|
|
||||||
|
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.15-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sat Nov 23 2019 Josh Stone <jistone@redhat.com> - 0.1.15-1
|
||||||
|
- Update to 0.1.15
|
||||||
|
|
||||||
|
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.14-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu Mar 07 2019 Josh Stone <jistone@redhat.com> - 0.1.14-1
|
||||||
|
- Update to 0.1.14
|
||||||
|
|
||||||
|
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.13-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||||
|
|
||||||
|
* Tue Jan 08 2019 Josh Stone <jistone@redhat.com> - 0.1.13-1
|
||||||
|
- Update to 0.1.13
|
||||||
|
|
||||||
|
* Fri Dec 07 2018 Josh Stone <jistone@redhat.com> - 0.1.12-1
|
||||||
|
- Update to 0.1.12
|
||||||
|
- Adapt to new packaging
|
||||||
|
|
||||||
|
* Thu Oct 11 2018 Josh Stone <jistone@redhat.com> - 0.1.11-1
|
||||||
|
- Update to 0.1.11
|
||||||
|
|
||||||
|
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.10-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Jul 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.1.10-1
|
||||||
|
- Update to 0.1.10
|
||||||
|
|
||||||
|
* Wed Apr 25 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.1.9-3
|
||||||
|
- Bump filetime to 0.2
|
||||||
|
|
||||||
|
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.9-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sat Jan 13 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.1.9-1
|
||||||
|
- Initial package
|
||||||
|
|
Loading…
Reference in new issue