[librsvg: 1/2] Support selecting a different Rust toolchain



commit 7bfc55e23ade78ef4bd69084b75fa1fe632d1372
Author: Tobias Kortkamp <tobik FreeBSD org>
Date:   Wed Jan 16 21:36:53 2019 +0100

    Support selecting a different Rust toolchain
    
    At the moment the values passed through the RUSTC and CARGO environment
    variables when running configure are ignored and just `rustc`/`cargo`
    as found on the PATH are used.
    
    This is problematic during package builds where we might have to
    select a specific Rust toolchain, i.e., make sure to always use the
    system Rust toolchain vs a rustup toolchain.
    
    Signed-off-by: Tobias Kortkamp <tobik FreeBSD org>

 Makefile.am  | 8 ++++----
 configure.ac | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 601d34d5..db9309fa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -148,11 +148,11 @@ CARGO_TARGET_DIR=@abs_top_builddir@/target
 
 check-local:
        cd $(srcdir) && \
-       CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) cargo test $(CARGO_VERBOSE) $(CARGO_TARGET_ARGS) 
$(CARGO_RELEASE_ARGS)
+       CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) $(CARGO) test $(CARGO_VERBOSE) $(CARGO_TARGET_ARGS) 
$(CARGO_RELEASE_ARGS)
 
 clean-local:
        cd $(top_srcdir) && \
-       CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) cargo clean
+       CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) $(CARGO) clean
 
 distcheck-hook:
        if test -z "${DESTDIR}";                                                \
@@ -163,7 +163,7 @@ distcheck-hook:
 
 dist-hook:
        (cd $(distdir) &&                                                       \
-       cargo vendor -q &&                                                      \
+       $(CARGO) vendor -q &&                                                   \
        mkdir .cargo &&                                                         \
        cp cargo-vendor-config .cargo/config)
 
@@ -172,7 +172,7 @@ $(RUST_LIB): $(RUST_SRC)
        PKG_CONFIG_ALLOW_CROSS=1                                                \
        PKG_CONFIG='$(PKG_CONFIG)'                                              \
        CARGO_TARGET_DIR=$(CARGO_TARGET_DIR)                                    \
-       cargo build $(CARGO_VERBOSE) $(CARGO_TARGET_ARGS) $(CARGO_RELEASE_ARGS)
+       $(CARGO) build $(CARGO_VERBOSE) $(CARGO_TARGET_ARGS) $(CARGO_RELEASE_ARGS)
 
 librsvg_@RSVG_API_MAJOR_VERSION@_la_CPPFLAGS = \
        -I$(top_srcdir)                         \
diff --git a/configure.ac b/configure.ac
index eb254bf9..5c2cc458 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,11 +101,11 @@ AC_SUBST(DLOPEN_LIBS)
 
 dnl ===========================================================================
 
-AC_CHECK_PROG(CARGO, [cargo], [yes], [no])
+AC_CHECK_PROGS(CARGO, [cargo], [no])
 AS_IF(test x$CARGO = xno,
     AC_MSG_ERROR([cargo is required.  Please install the Rust toolchain from https://www.rust-lang.org/])
 )
-AC_CHECK_PROG(RUSTC, [rustc], [yes], [no])
+AC_CHECK_PROGS(RUSTC, [rustc], [no])
 AS_IF(test x$RUSTC = xno,
     AC_MSG_ERROR([rustc is required.  Please install the Rust toolchain from https://www.rust-lang.org/])
 )
@@ -115,7 +115,7 @@ dnl If you change this, please update COMPILING.md
 MINIMUM_RUST_MAJOR=1
 MINIMUM_RUST_MINOR=27
 
-rust_version=`rustc --version`
+rust_version=`$RUSTC --version`
 version=`echo "$rust_version" | sed -e 's/^rustc //g'`
 major=`echo "$version" | cut -d. -f1`
 minor=`echo "$version" | cut -d. -f2`


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