Remove the c-library feature for the librsvg_c_api crate

parent 78219898
......@@ -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
......
......@@ -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"] }
......
......@@ -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(())
}
......@@ -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::*;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment