Update to version 69.8.0; Fixes RHBZ#2103341

epel9
Fabio Valentini 3 years ago
parent 3b5e279b41
commit c45274cff4
No known key found for this signature in database
GPG Key ID: 5AC5F572E5D410AF

1
.gitignore vendored

@ -7,3 +7,4 @@
/onig_sys-69.5.1.crate
/onig_sys-69.6.0.crate
/onig_sys-69.7.1.crate
/onig_sys-69.8.0.crate

@ -1,75 +0,0 @@
From 5aabe30b197ae7d7c158065215855d8bd3274d75 Mon Sep 17 00:00:00 2001
From: Igor Raits <i.gnatenko.brain@gmail.com>
Date: Sat, 16 May 2020 20:01:33 +0200
Subject: [PATCH] Always use system onig
Signed-off-by: Igor Raits <i.gnatenko.brain@gmail.com>
---
build.rs | 6 ++----
src/lib.rs | 12 ------------
2 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/build.rs b/build.rs
index cf1b6f3..d704fce 100644
--- a/build.rs
+++ b/build.rs
@@ -1,4 +1,3 @@
-#[cfg(feature = "generate")]
extern crate bindgen;
extern crate cc;
extern crate pkg_config;
@@ -198,10 +197,6 @@ fn compile() {
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()
@@ -221,17 +216,13 @@ 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);
+ let require_pkg_config = true;
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"
- });
+ conf.atleast_version("6.8.0");
if link_type == Some(LinkType::Static) {
conf.statik(true);
}
diff --git a/src/lib.rs b/src/lib.rs
index 4d855ad..c9b6d20 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,19 +1,7 @@
-#[cfg(feature = "generate")]
mod bindgened;
-#[cfg(feature = "generate")]
pub use bindgened::*;
-#[cfg(not(feature = "generate"))]
-#[allow(non_upper_case_globals)]
-#[allow(non_camel_case_types)]
-#[allow(non_snake_case)]
-#[allow(clippy::all)]
-mod ffi;
-
-#[cfg(not(feature = "generate"))]
-pub use self::ffi::*;
-
// backfill types from the old hand-written bindings:
pub type OnigSyntaxBehavior = ::std::os::raw::c_uint;

@ -0,0 +1,283 @@
From 6b84166ffa2725391f548cb0c91c2e668a4769f6 Mon Sep 17 00:00:00 2001
From: Fabio Valentini <decathorpe@gmail.com>
Date: Mon, 8 Aug 2022 18:34:08 +0200
Subject: [PATCH] Unconditionally use bindgen and dynamic linking with
pkg-config
---
build.rs | 248 +++----------------------------------------------------
1 file changed, 11 insertions(+), 237 deletions(-)
diff --git a/build.rs b/build.rs
index d74ea68..9947dc5 100644
--- a/build.rs
+++ b/build.rs
@@ -1,210 +1,10 @@
-#[cfg(feature = "generate")]
extern crate bindgen;
-extern crate cc;
extern crate pkg_config;
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<bool> {
- 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<LinkType> {
- 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::<c_long>(), 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()
@@ -223,43 +23,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.1

@ -1,21 +1,19 @@
--- onig_sys-69.7.1/Cargo.toml 1970-01-01T00:00:00+00:00
+++ onig_sys-69.7.1/Cargo.toml 2021-11-13T17:55:04.245041+00:00
@@ -23,9 +23,7 @@
license = "MIT"
repository = "http://github.com/iwillspeak/rust-onig"
--- onig_sys-69.8.0/Cargo.toml 1970-01-01T00:00:01+00:00
+++ onig_sys-69.8.0/Cargo.toml 2022-08-08T16:21:32.174978+00:00
@@ -35,8 +35,6 @@
[build-dependencies.bindgen]
-version = "0.56"
version = "0.59"
-features = ["runtime"]
-optional = true
+version = "0.59"
[build-dependencies.cc]
version = "1.0"
@@ -35,6 +33,6 @@
@@ -45,6 +43,7 @@
version = "^0.3.16"
[features]
+bindgen = []
default = ["generate"]
-generate = ["bindgen"]
+generate = []
generate = ["bindgen"]
posix-api = []
print-debug = []

@ -1,31 +1,25 @@
# Generated by rust2rpm 18
# Generated by rust2rpm 22
%bcond_without check
%global debug_package %{nil}
%global crate onig_sys
Name: rust-%{crate}
Version: 69.7.1
Name: rust-onig_sys
Version: 69.8.0
Release: %autorelease
Summary: `onig_sys` crate contains raw rust bindings to the oniguruma library
Summary: Rust bindings for oniguruma
# Upstream license specification: MIT
License: MIT
URL: https://crates.io/crates/onig_sys
Source: %{crates_source}
# Initial patched metadata
# * Bump bindgen to 0.59
# * Mark bindgen as non-optional dep (for next patch)
Patch0: onig_sys-fix-metadata.diff
# Always use system onig
Patch0001: 0001-Always-use-system-onig.patch
# Manually created patch for downstream crate metadata changes
Patch: onig_sys-fix-metadata.diff
# * unconditionally use bindgen and dynamic linking with pkg-config
Patch: 0001-Unconditionally-use-bindgen-and-dynamic-linking-with.patch
ExclusiveArch: %{rust_arches}
%if %{__cargo_skip_build}
BuildArch: noarch
%endif
BuildRequires: rust-packaging
BuildRequires: rust-packaging >= 21
%global _description %{expand:
`onig_sys` crate contains raw rust bindings to the oniguruma library. This
@ -43,12 +37,12 @@ Requires: pkgconfig(oniguruma) >= 6.8.0
%description devel %{_description}
This package contains library source intended for building other packages
which use "%{crate}" crate.
This package contains library source intended for building other packages which
use the "%{crate}" crate.
%files devel
%license LICENSE.md
%{cargo_registry}/%{crate}-%{version_no_tilde}/
%license %{crate_instdir}/LICENSE.md
%{crate_instdir}/
%package -n %{name}+default-devel
Summary: %{summary}
@ -56,11 +50,23 @@ BuildArch: noarch
%description -n %{name}+default-devel %{_description}
This package contains library source intended for building other packages
which use "default" feature of "%{crate}" crate.
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 %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml
%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}
@ -68,11 +74,11 @@ BuildArch: noarch
%description -n %{name}+generate-devel %{_description}
This package contains library source intended for building other packages
which use "generate" feature of "%{crate}" crate.
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 %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+posix-api-devel
Summary: %{summary}
@ -80,11 +86,11 @@ BuildArch: noarch
%description -n %{name}+posix-api-devel %{_description}
This package contains library source intended for building other packages
which use "posix-api" feature of "%{crate}" crate.
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 %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+print-debug-devel
Summary: %{summary}
@ -92,15 +98,16 @@ BuildArch: noarch
%description -n %{name}+print-debug-devel %{_description}
This package contains library source intended for building other packages
which use "print-debug" feature of "%{crate}" crate.
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 %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml
%ghost %{crate_instdir}/Cargo.toml
%prep
%autosetup -n %{crate}-%{version_no_tilde} -p1
rm -vrf oniguruma/
# remove bundled oniguruma sources
rm -r oniguruma/
%cargo_prep
%generate_buildrequires

@ -1 +1 @@
SHA512 (onig_sys-69.7.1.crate) = 5be8c31049ad741fa06247bd22813374f71397481cea22be3d83bed720b512b9cb10d6028072fd92cc09ac0e9ca8fb977ca49fb59d934dd61f84c4634d28ffb3
SHA512 (onig_sys-69.8.0.crate) = e6040c27192cb7687fc39ddbe576e88c05e600f9117972ad1c5026bcbcfbf26a8f33e3e5b2dcee283945fdb694d1070311e660a1749f9b2ffbbac4a5edc80532

Loading…
Cancel
Save