[librsvg: 7/8] Remove the c-library feature for the librsvg_c_api crate
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 7/8] Remove the c-library feature for the librsvg_c_api crate
- Date: Mon, 26 Aug 2019 12:53:07 +0000 (UTC)
commit 38fe68c2c3165a923dee9cfaa9a9f57960fb9b95
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Aug 26 15:49:39 2019 +0300
Remove the c-library feature for the librsvg_c_api crate
Makefile.am | 2 +-
librsvg/Cargo.toml | 4 ----
librsvg/build.rs | 12 ++++++------
librsvg/c_api.rs | 16 ----------------
4 files changed, 7 insertions(+), 27 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 0bf04599..53506ce3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -185,7 +185,7 @@ librsvg_c_api.la: $(LIBRSVG_INTERNALS_SOURCES) $(LIBRSVG_C_API_SOURCES)
CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) \
LIBRSVG_BUILD_DIR=$(LIBRSVG_BUILD_DIR) \
LIBRSVG_TARGET_DIR=$(LIBRSVG_TARGET_DIR) \
- $(CARGO) --locked build $(CARGO_VERBOSE) $(CARGO_TARGET_ARGS) $(CARGO_RELEASE_ARGS) --features
"c-library" \
+ $(CARGO) --locked build $(CARGO_VERBOSE) $(CARGO_TARGET_ARGS) $(CARGO_RELEASE_ARGS) \
&& if [[ $$($(NM) -g $(RUST_LIB) | grep "T __clzsi2" -c) -gt 1 ]] ; then \
$(AR) d $(RUST_LIB) clzsi2.o; \
fi
diff --git a/librsvg/Cargo.toml b/librsvg/Cargo.toml
index 39fb945b..ce31aea8 100644
--- a/librsvg/Cargo.toml
+++ b/librsvg/Cargo.toml
@@ -11,10 +11,6 @@ name = "rsvg_c_api"
path = "lib.rs"
crate-type = [ "staticlib" ]
-[features]
-# Enables calling g_warning() when built as part of librsvg.so
-c-library = []
-
[dependencies]
bitflags = "1.0"
cairo-rs = { version="0.7.0", features=["v1_16"] }
diff --git a/librsvg/build.rs b/librsvg/build.rs
index 0dcdb6f3..cd1aa9f3 100644
--- a/librsvg/build.rs
+++ b/librsvg/build.rs
@@ -2,15 +2,15 @@ use std::env;
use std::fs::File;
use std::io::prelude::*;
-#[cfg(all(unix, feature = "c-library"))]
+#[cfg(unix)]
use std::os::unix::fs::symlink;
-#[cfg(all(windows, not(target_env = "msvc"), feature="c-library"))]
+#[cfg(all(windows, not(target_env = "msvc")))]
use std::os::windows::fs::symlink_file as symlink;
-#[cfg(all(not(target_env = "msvc"), feature="c-library"))]
+#[cfg(not(target_env = "msvc"))]
use std::fs;
-#[cfg(all(not(target_env = "msvc"), feature="c-library"))]
+#[cfg(not(target_env = "msvc"))]
use std::path::PathBuf;
fn main() {
@@ -19,7 +19,7 @@ fn main() {
/// Generate libtool archive file librsvg_c_api.la
/// From: https://docs.rs/libtool/0.1.1/libtool/
-#[cfg(all(feature = "c-library", not(target_env = "msvc")))]
+#[cfg(not(target_env = "msvc"))]
pub fn generate_convenience_lib() -> std::io::Result<()> {
let target = env::var("TARGET").expect("TARGET was not set");
let build_dir = env::var("LIBRSVG_BUILD_DIR").expect("LIBRSVG_BUILD_DIR was not set");
@@ -64,7 +64,7 @@ pub fn generate_convenience_lib() -> std::io::Result<()> {
Ok(())
}
-#[cfg(not(all(feature = "c-library", not(target_env = "msvc"))))]
+#[cfg(target_env = "msvc")]
pub fn generate_convenience_lib() -> std::io::Result<()> {
Ok(())
}
diff --git a/librsvg/c_api.rs b/librsvg/c_api.rs
index 4bc211a5..e084068b 100644
--- a/librsvg/c_api.rs
+++ b/librsvg/c_api.rs
@@ -1404,7 +1404,6 @@ fn warn_on_invalid_id(e: RenderingError) -> RenderingError {
e
}
-#[cfg(feature = "c-library")]
pub fn rsvg_g_warning(msg: &str) {
unsafe {
extern "C" {
@@ -1415,19 +1414,7 @@ pub fn rsvg_g_warning(msg: &str) {
}
}
-#[cfg(not(feature = "c-library"))]
-pub fn rsvg_g_warning(_msg: &str) {
- // This, and rsvg_g_critical() below, are intended to be called
- // from Rust code which is directly called from the C API. When
- // this crate is being built as part of the c-library, the purpose
- // of the functions is to call the corresponding glib macros to
- // print a warning or a critical error message. When this crate
- // is being built as part of the standalone Rust crate, they do
- // nothing, since the Rust code is able to propagate an error code
- // all the way to the crate's public API.
-}
-#[cfg(feature = "c-library")]
pub fn rsvg_g_critical(msg: &str) {
unsafe {
extern "C" {
@@ -1438,9 +1425,6 @@ pub fn rsvg_g_critical(msg: &str) {
}
}
-#[cfg(not(feature = "c-library"))]
-pub fn rsvg_g_critical(_msg: &str) {}
-
#[cfg(test)]
mod tests {
use super::*;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]