From 4272bbd95bd205fdd8f27fdb82d8f34a51a665db Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Fri, 20 Dec 2024 16:28:22 +0300 Subject: [PATCH] import rust-onig_sys-69.8.1-8.el10 --- .gitignore | 1 + .rust-onig_sys.metadata | 1 + ...use-bindgen-and-dynamic-linking-with.patch | 278 ++++++++++++++++++ SOURCES/onig_sys-fix-metadata.diff | 27 ++ SOURCES/rust2rpm.toml | 26 ++ SPECS/rust-onig_sys.spec | 239 +++++++++++++++ 6 files changed, 572 insertions(+) create mode 100644 .gitignore create mode 100644 .rust-onig_sys.metadata create mode 100644 SOURCES/0001-Unconditionally-use-bindgen-and-dynamic-linking-with.patch create mode 100644 SOURCES/onig_sys-fix-metadata.diff create mode 100644 SOURCES/rust2rpm.toml create mode 100644 SPECS/rust-onig_sys.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7d60aed --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/onig_sys-69.8.1.crate diff --git a/.rust-onig_sys.metadata b/.rust-onig_sys.metadata new file mode 100644 index 0000000..af196f6 --- /dev/null +++ b/.rust-onig_sys.metadata @@ -0,0 +1 @@ +85e654a06d36aa8313ee15f8c4c1625200b63d65 SOURCES/onig_sys-69.8.1.crate diff --git a/SOURCES/0001-Unconditionally-use-bindgen-and-dynamic-linking-with.patch b/SOURCES/0001-Unconditionally-use-bindgen-and-dynamic-linking-with.patch new file mode 100644 index 0000000..d56157e --- /dev/null +++ b/SOURCES/0001-Unconditionally-use-bindgen-and-dynamic-linking-with.patch @@ -0,0 +1,278 @@ +From de80f4dfd982fa7fc9954a631e739349193ca39f Mon Sep 17 00:00:00 2001 +From: Fabio Valentini +Date: Sat, 20 Aug 2022 22:23:23 +0200 +Subject: [PATCH] Unconditionally use bindgen and dynamic linking with + pkg-config + +--- + build.rs | 246 +++---------------------------------------------------- + 1 file changed, 11 insertions(+), 235 deletions(-) + +diff --git a/build.rs b/build.rs +index 138e9d8..e2d2596 100644 +--- a/build.rs ++++ b/build.rs +@@ -1,205 +1,7 @@ + use pkg_config::Config; + use std::env; +-use std::fmt; +-use std::fs; + use std::path::Path; +-use std::path::PathBuf; + +-/// # Link Type Enumeration +-/// +-/// Holds the different types of linking we support in this +-/// script. Used to keep track of what the default link type is and +-/// what override has been specified, if any, in the environment. +-#[derive(Eq, PartialEq)] +-enum LinkType { +- /// Static linking. This corresponds to the `static` type in Cargo. +- Static, +- /// Dynamic linking. This corresponds to the `dylib` type in Cargo. +- Dynamic, +-} +- +-impl fmt::Display for LinkType { +- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +- write!( +- f, +- "{}", +- match self { +- &LinkType::Static => "static", +- &LinkType::Dynamic => "dylib", +- } +- ) +- } +-} +- +-fn env_var_bool(name: &str) -> Option { +- if name.starts_with("RUSTONIG") { +- println!("cargo:rerun-if-env-changed={}", name); +- } +- env::var(name) +- .ok() +- .map(|s| match &s.to_string().to_lowercase()[..] { +- "0" | "no" | "false" => false, +- _ => true, +- }) +-} +- +-/// # Link Type Override +-/// +-/// Retuns the override from the environment, if any is set. +-fn link_type_override() -> Option { +- let dynamic_env = env_var_bool("RUSTONIG_DYNAMIC_LIBONIG").map(|b| match b { +- true => LinkType::Dynamic, +- false => LinkType::Static, +- }); +- let static_env = env_var_bool("RUSTONIG_STATIC_LIBONIG").map(|b| match b { +- true => LinkType::Static, +- false => LinkType::Dynamic, +- }); +- +- dynamic_env.or(static_env) +-} +- +-fn compile() { +- bindgen_headers("oniguruma/src/oniguruma.h"); +- +- let mut cc = cc::Build::new(); +- let out_dir = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR")); +- let ref src = Path::new("oniguruma").join("src"); +- let config_h = out_dir.join("config.h"); +- +- if env_var_bool("CARGO_FEATURE_PRINT_DEBUG").unwrap_or(false) { +- cc.define("ONIG_DEBUG_PARSE", Some("1")); +- cc.define("ONIG_DEBUG_COMPILE", Some("1")); +- cc.define("ONIG_DEBUG_SEARCH", Some("1")); +- cc.define("ONIG_DEBUG_MATCH", Some("1")); +- } +- +- if !src.exists() { +- panic!( +- "Unable to find source files in {}. Is oniguruma submodule checked out?\n\ +- Try git submodule init; git submodule update", +- src.display() +- ); +- } +- +- let arch = env::var("CARGO_CFG_TARGET_ARCH"); +- let os = env::var("CARGO_CFG_TARGET_OS"); +- let bits = env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap(); +- if let Ok("windows") = os.as_ref().map(String::as_str) { +- fs::copy(src.join(format!("config.h.win{}", bits)), config_h) +- .expect("Can't copy config.h.win??"); +- } else { +- let family = env::var("CARGO_CFG_TARGET_FAMILY"); +- if let Ok("unix") = family.as_ref().map(String::as_str) { +- cc.define("HAVE_UNISTD_H", Some("1")); +- cc.define("HAVE_SYS_TYPES_H", Some("1")); +- cc.define("HAVE_SYS_TIME_H", Some("1")); +- } +- +- // Can't use size_of::(), because it'd refer to build arch, not target arch. +- // so instead assume it's a non-exotic target (LP32/LP64). +- fs::write( +- config_h, +- format!( +- " +- #define HAVE_PROTOTYPES 1 +- #define STDC_HEADERS 1 +- #define HAVE_STRING_H 1 +- #define HAVE_STDARG_H 1 +- #define HAVE_STDLIB_H 1 +- #define HAVE_LIMITS_H 1 +- #define HAVE_INTTYPES_H 1 +- #define SIZEOF_INT 4 +- #define SIZEOF_SHORT 2 +- #define SIZEOF_LONG {0} +- #define SIZEOF_VOIDP {0} +- #define SIZEOF_LONG_LONG 8 +- ", +- if bits == "64" { "8" } else { "4" } +- ), +- ) +- .expect("Can't write config.h to OUT_DIR"); +- } +- if let Ok("wasm32") = arch.as_ref().map(String::as_str) { +- cc.define("ONIG_DISABLE_DIRECT_THREADING", Some("1")); +- if let Ok("unknown") = os.as_ref().map(String::as_str) { +- cc.define( +- "ONIG_EXTERN", +- Some(r#"__attribute__((visibility("default")))"#), +- ); +- } +- } +- +- cc.include(out_dir); // Read config.h from there +- cc.include(src); +- +- let files = [ +- "regexec.c", +- "regerror.c", +- "regparse.c", +- "regext.c", +- "regcomp.c", +- "reggnu.c", +- "regenc.c", +- "regsyntax.c", +- "regtrav.c", +- "regversion.c", +- "st.c", +- "onig_init.c", +- "unicode.c", +- "ascii.c", +- "utf8.c", +- "utf16_be.c", +- "utf16_le.c", +- "utf32_be.c", +- "utf32_le.c", +- "euc_jp.c", +- "sjis.c", +- "iso8859_1.c", +- "iso8859_2.c", +- "iso8859_3.c", +- "iso8859_4.c", +- "iso8859_5.c", +- "iso8859_6.c", +- "iso8859_7.c", +- "iso8859_8.c", +- "iso8859_9.c", +- "iso8859_10.c", +- "iso8859_11.c", +- "iso8859_13.c", +- "iso8859_14.c", +- "iso8859_15.c", +- "iso8859_16.c", +- "euc_tw.c", +- "euc_kr.c", +- "big5.c", +- "gb18030.c", +- "koi8_r.c", +- "cp1251.c", +- "euc_jp_prop.c", +- "sjis_prop.c", +- "unicode_unfold_key.c", +- "unicode_fold1_key.c", +- "unicode_fold2_key.c", +- "unicode_fold3_key.c", +- ]; +- for file in files.iter() { +- cc.file(src.join(file)); +- } +- +- if cfg!(feature = "posix-api") { +- cc.file(src.join("regposix.c")); +- cc.file(src.join("regposerr.c")); +- } +- +- cc.warnings(false); // not actionable by the end user +- cc.compile("onig"); +-} +- +-#[cfg(not(feature = "generate"))] +-fn bindgen_headers(_path: &str) {} +- +-#[cfg(feature = "generate")] + fn bindgen_headers(path: &str) { + let arch = env::var("CARGO_CFG_TARGET_ARCH"); + let mut bindgen = bindgen::Builder::default() +@@ -218,43 +20,17 @@ fn bindgen_headers(path: &str) { + } + + pub fn main() { +- let link_type = link_type_override(); +- let require_pkg_config = env_var_bool("RUSTONIG_SYSTEM_LIBONIG").unwrap_or(false); +- +- if require_pkg_config || link_type == Some(LinkType::Dynamic) { +- let mut conf = Config::new(); +- // dynamically-generated headers can work with an older version +- // pre-generated headers are for the latest +- conf.atleast_version(if cfg!(feature = "generate") { +- "6.8.0" +- } else { +- "6.9.3" +- }); +- if link_type == Some(LinkType::Static) { +- conf.statik(true); ++ let lib = Config::new().atleast_version("6.8.0").probe("oniguruma").unwrap(); ++ for path in &lib.include_paths { ++ let header = path.join("oniguruma.h"); ++ if header.exists() { ++ bindgen_headers(&header.display().to_string()); ++ return; + } +- match conf.probe("oniguruma") { +- Ok(lib) => { +- for path in &lib.include_paths { +- let header = path.join("oniguruma.h"); +- if header.exists() { +- bindgen_headers(&header.display().to_string()); +- return; +- } +- } +- if require_pkg_config { +- panic!( +- "Unable to find oniguruma.h in include paths from pkg-config: {:?}", +- lib.include_paths +- ); +- } +- } +- Err(ref err) if require_pkg_config => { +- panic!("Unable to find oniguruma in pkg-config, and RUSTONIG_SYSTEM_LIBONIG is set: {}", err); +- } +- _ => {} +- } +- } + +- compile(); ++ panic!( ++ "Unable to find oniguruma.h in include paths from pkg-config: {:?}", ++ lib.include_paths ++ ); ++ } + } +-- +2.37.2 + diff --git a/SOURCES/onig_sys-fix-metadata.diff b/SOURCES/onig_sys-fix-metadata.diff new file mode 100644 index 0000000..3c2dce9 --- /dev/null +++ b/SOURCES/onig_sys-fix-metadata.diff @@ -0,0 +1,27 @@ +--- onig_sys-69.8.1/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ onig_sys-69.8.1/Cargo.toml 2024-10-23T17:18:50.214423+00:00 +@@ -29,15 +29,13 @@ + instead check out the `onig` crate. + """ + documentation = "http://rust-onig.github.io/rust-onig/onig_sys/" +-readme = "README.md" + categories = ["external-ffi-bindings"] + license = "MIT" + repository = "http://github.com/iwillspeak/rust-onig" + + [build-dependencies.bindgen] +-version = "0.59" ++version = "0.69" + features = ["runtime"] +-optional = true + + [build-dependencies.cc] + version = "1.0" +@@ -46,6 +44,7 @@ + version = "^0.3.16" + + [features] ++bindgen = [] + default = ["generate"] + generate = ["bindgen"] + posix-api = [] diff --git a/SOURCES/rust2rpm.toml b/SOURCES/rust2rpm.toml new file mode 100644 index 0000000..81c441a --- /dev/null +++ b/SOURCES/rust2rpm.toml @@ -0,0 +1,26 @@ +[package] +summary = "Rust bindings for oniguruma" +cargo-toml-patch-comments = [ + "bump bindgen build-dependency from 0.59 to 0.69", + "remove reference to readme file that is not included in published crates", +] + +[[package.extra-patches]] +number = 1 +file = "0001-Unconditionally-use-bindgen-and-dynamic-linking-with.patch" +comments = ["unconditionally use bindgen and dynamic linking with pkg-config"] + +[requires] +build = [ + "pkgconfig(oniguruma) >= 6.8.0", +] +lib = [ + "pkgconfig(oniguruma) >= 6.8.0", +] + +[scripts] +prep.post = [ + "# remove bundled oniguruma sources", + "rm -r oniguruma/", +] + diff --git a/SPECS/rust-onig_sys.spec b/SPECS/rust-onig_sys.spec new file mode 100644 index 0000000..746712f --- /dev/null +++ b/SPECS/rust-onig_sys.spec @@ -0,0 +1,239 @@ +## START: Set by rpmautospec +## (rpmautospec version 0.7.3) +## RPMAUTOSPEC: autorelease, autochangelog +%define autorelease(e:s:pb:n) %{?-p:0.}%{lua: + release_number = 8; + 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 onig_sys + +Name: rust-onig_sys +Version: 69.8.1 +Release: %autorelease +Summary: Rust bindings for oniguruma + +License: MIT +URL: https://crates.io/crates/onig_sys +Source: %{crates_source} +# Manually created patch for downstream crate metadata changes +# * bump bindgen build-dependency from 0.59 to 0.69 +# * remove reference to readme file that is not included in published crates +Patch: onig_sys-fix-metadata.diff +# * unconditionally use bindgen and dynamic linking with pkg-config +Patch1: 0001-Unconditionally-use-bindgen-and-dynamic-linking-with.patch + +BuildRequires: cargo-rpm-macros >= 24 +BuildRequires: pkgconfig(oniguruma) >= 6.8.0 + +%global _description %{expand: +The `onig_sys` crate contains raw rust bindings to the oniguruma +library. This crate exposes a set of unsafe functions which can then be +used by other crates to create safe wrappers around Oniguruma. You +probably don't want to link to this crate directly; instead check out +the `onig` crate.} + +%description %{_description} + +%package devel +Summary: %{summary} +BuildArch: noarch +Requires: pkgconfig(oniguruma) >= 6.8.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.md +%{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}+bindgen-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+bindgen-devel %{_description} + +This package contains library source intended for building other packages which +use the "bindgen" feature of the "%{crate}" crate. + +%files -n %{name}+bindgen-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+generate-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+generate-devel %{_description} + +This package contains library source intended for building other packages which +use the "generate" feature of the "%{crate}" crate. + +%files -n %{name}+generate-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+posix-api-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+posix-api-devel %{_description} + +This package contains library source intended for building other packages which +use the "posix-api" feature of the "%{crate}" crate. + +%files -n %{name}+posix-api-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+print-debug-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+print-debug-devel %{_description} + +This package contains library source intended for building other packages which +use the "print-debug" feature of the "%{crate}" crate. + +%files -n %{name}+print-debug-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{crate}-%{version} -p1 +%cargo_prep +# remove bundled oniguruma sources +rm -r oniguruma/ + +%generate_buildrequires +%cargo_generate_buildrequires + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +* Fri Dec 20 2024 MSVSphere Packaging Team - 69.8.1-8 +- Rebuilt for MSVSphere 10 + +## START: Generated by rpmautospec +* Wed Oct 23 2024 Fabio Valentini - 69.8.1-8 +- Bump bindgen dependency from 0.63 to 0.69 + +* Sat Sep 14 2024 Fabio Valentini - 69.8.1-7 +- Remove reference to readme file that is not included in published crates + +* Sat Jul 20 2024 Fedora Release Engineering - 69.8.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Fri Jan 26 2024 Fedora Release Engineering - 69.8.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jul 21 2023 Fedora Release Engineering - 69.8.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Wed Apr 12 2023 Fabio Valentini - 69.8.1-3 +- Bump bindgen from 0.59 to 0.63 to fix builds with clang 16+ + +* Sat Jan 21 2023 Fedora Release Engineering - 69.8.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Sat Aug 20 2022 Fabio Valentini - 69.8.1-1 +- Update to version 69.8.1; Fixes RHBZ#2116720 + +* Mon Aug 08 2022 Fabio Valentini - 69.8.0-1 +- Update to version 69.8.0; Fixes RHBZ#2103341 + +* Sat Jul 23 2022 Fedora Release Engineering - 69.7.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Fri Jan 21 2022 Fedora Release Engineering - 69.7.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Sat Nov 13 2021 Robert-André Mauchin - 69.7.1-1 +- Update to 69.7.1 Close: rhbz#1970059 + +* Fri Jul 23 2021 Fedora Release Engineering - 69.6.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Wed Mar 31 20:46:59 CEST 2021 Robert-André Mauchin - 69.6.0-3 +- Bump bindgen to 0.57 + +* Wed Jan 27 2021 Fedora Release Engineering - 69.6.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Fri Nov 27 2020 Fabio Valentini - 69.6.0-1 +- Update to version 69.6.0. + +* Wed Sep 23 2020 Fabio Valentini - 69.5.1-1 +- Update to version 69.5.1. + +* Wed Jul 29 2020 Fedora Release Engineering - 69.5.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Fri May 29 2020 Josh Stone - 69.5.0-3 +- Bump to bindgen 0.54. + +* Sat May 23 22:37:42 CEST 2020 Igor Raits - 69.5.0-2 +- Always require bindgen + +* Thu Feb 27 2020 Josh Stone - 69.2.0-4 +- Bump bindgen to 0.53. + +* Thu Jan 30 2020 Fedora Release Engineering - 69.2.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Tue Dec 10 2019 Josh Stone - 69.2.0-2 +- Bump bindgen to 0.52. + +* Thu Sep 05 05:30:43 CEST 2019 Igor Gnatenko - 69.2.0-1 +- Update to 69.2.0 + +* Fri Jul 26 2019 Fedora Release Engineering - 69.1.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sun Jun 23 00:12:31 CEST 2019 Igor Gnatenko - 69.1.0-3 +- Regenerate + +* Sat Feb 02 2019 Fedora Release Engineering - 69.1.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Sat Jan 12 2019 Igor Gnatenko - 69.1.0-1 +- Update to 69.1.0 + +* Sat Nov 03 2018 Igor Gnatenko - 69.0.0-2 +- Adapt to new packaging + +* Sat Sep 08 2018 Igor Gnatenko - 69.0.0-1 +- Update to 69.0.0 + +* Wed Sep 05 2018 Igor Gnatenko - 68.2.1-1 +- Update to 68.2.1 + +* Mon Sep 03 2018 Igor Gnatenko - 68.2.0-1 +- Initial package + +## END: Generated by rpmautospec