[librsvg: 1/3] Simplify the generation of the libtool archive file



commit ad86ab8580c8779fc3eb2bee2422bb116919844e
Author: Kleis Auke Wolthuizen <github kleisauke nl>
Date:   Sat Oct 12 17:19:19 2019 +0200

    Simplify the generation of the libtool archive file
    
    Commit e310e36 introduced the generation of a libtool archive file via Rust,
    this causes problems on Windows because creating symlinks requires admin privileges.
    
    It also caused problems with a plain `cargo build`, because it was necessary to set
    environment variables.
    
    This commit removes the Cargo build script for 'librsvg_c_api' and simply uses
    libtool to generate the archive file.
    
    Resolves #501.

 Makefile.am        | 20 +++++++---------
 librsvg/Cargo.toml |  1 -
 librsvg/build.rs   | 70 ------------------------------------------------------
 3 files changed, 9 insertions(+), 82 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 23341928..a04828c9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -119,7 +119,6 @@ LIBRSVG_CRATE_SRC =                                         \
 
 LIBRSVG_C_API_SRC =                                            \
        librsvg/Cargo.toml                                      \
-       librsvg/build.rs                                        \
        librsvg/c_api.rs                                        \
        librsvg/lib.rs                                          \
        librsvg/pixbuf_utils.rs                                 \
@@ -152,22 +151,22 @@ cargo_verbose_1 = --verbose
 
 LIBRSVG_BUILD_DIR=@abs_top_builddir@
 CARGO_TARGET_DIR=$(LIBRSVG_BUILD_DIR)/target
-LIBRSVG_TARGET_DIR=$(CARGO_TARGET_DIR)/$(RUST_TARGET_SUBDIR)
 
-RUST_LIB=$(LIBRSVG_BUILD_DIR)/.libs/librsvg_c_api.a
+if PLATFORM_WIN32
+# https://github.com/rust-lang/rust/issues/43749
+RUST_LIB=$(CARGO_TARGET_DIR)/$(RUST_TARGET_SUBDIR)/rsvg_c_api.lib
+else
+RUST_LIB=$(CARGO_TARGET_DIR)/$(RUST_TARGET_SUBDIR)/librsvg_c_api.a
+endif
 
 check-local:
        cd $(srcdir) && \
        CARGO_TARGET_DIR=$(CARGO_TARGET_DIR)    \
-       LIBRSVG_BUILD_DIR=$(LIBRSVG_BUILD_DIR)  \
-       LIBRSVG_TARGET_DIR=$(LIBRSVG_TARGET_DIR)        \
        $(CARGO) --locked test $(CARGO_VERBOSE) $(CARGO_TARGET_ARGS) $(CARGO_RELEASE_ARGS)
 
 clean-local:
        cd $(top_srcdir) && \
        CARGO_TARGET_DIR=$(CARGO_TARGET_DIR)    \
-       LIBRSVG_BUILD_DIR=$(LIBRSVG_BUILD_DIR)  \
-       LIBRSVG_TARGET_DIR=$(LIBRSVG_TARGET_DIR)        \
        $(CARGO) clean
 
 distcheck-hook:
@@ -188,12 +187,11 @@ librsvg_c_api.la: $(LIBRSVG_INTERNALS_SRC) $(LIBRSVG_C_API_SRC)
        PKG_CONFIG_ALLOW_CROSS=1                                                \
        PKG_CONFIG='$(PKG_CONFIG)'                                              \
        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) \
-       && if [[ $$($(NM) -g $(RUST_LIB) | grep "T __clzsi2" -c) -gt 1 ]] ; then \
+       && if [[ $$($(NM) -g $(RUST_LIB) | grep "T __*clzsi2" -c) -gt 1 ]] ; then \
                $(AR) d $(RUST_LIB) clzsi2.o;                                   \
-       fi
+       fi \
+       && cd $(LIBRSVG_BUILD_DIR) && $(LINK) && mv $(RUST_LIB) .libs/librsvg_c_api.a
 
 librsvg_@RSVG_API_MAJOR_VERSION@_la_CPPFLAGS = \
        -I$(top_srcdir)                         \
diff --git a/librsvg/Cargo.toml b/librsvg/Cargo.toml
index ce31aea8..55ae41e8 100644
--- a/librsvg/Cargo.toml
+++ b/librsvg/Cargo.toml
@@ -3,7 +3,6 @@ name = "librsvg_c_api"
 version = "0.0.1"
 authors = ["Federico Mena Quintero <federico gnome org>"]
 workspace = "../"
-build = "build.rs"
 edition = "2018"
 
 [lib]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]