diff --git a/R-package/cleanup.win b/R-package/cleanup.win new file mode 100755 index 00000000..a1821746 --- /dev/null +++ b/R-package/cleanup.win @@ -0,0 +1 @@ +rm -f src/Makevars.win diff --git a/R-package/configure b/R-package/configure index 289e9722..73af1393 100755 --- a/R-package/configure +++ b/R-package/configure @@ -1,8 +1,3 @@ -# Note: this script is not executed on Windows. Please add `configure.win` if -# you want to check the Rust installation also on Windows. In addition, -# don't forget `cleanup.win` if you decide to generate `src/Makevars.win` -# in the script. - # Even when `cargo` is on `PATH`, `rustc` might not in some cases. This adds # ~/.cargo/bin to PATH to address such cases. Note that is not always available # (e.g. or on Ubuntu with Rust installed via APT). diff --git a/R-package/configure.win b/R-package/configure.win new file mode 100755 index 00000000..102050ab --- /dev/null +++ b/R-package/configure.win @@ -0,0 +1,24 @@ +CARGO_VERSION="$(cargo --version)" + +if [ $ret -ne 0 ]; then + echo "-------------- ERROR: CONFIGURATION FAILED --------------------" + echo "" + echo "The cargo command is not available. To install Rust, please refer" + echo "to the official instruction:" + echo "" + echo "https://www.rust-lang.org/tools/install" + echo "" + echo "---------------------------------------------------------------" + + exit $ret +fi + +# There's a little chance that rustc is not available on PATH while cargo is. +# So, just ignore the error case. +RUSTC_VERSION="$(rustc --version || true)" + +# Report the version of Rustc to comply with the CRAN policy +echo "using Rust package manager: '${CARGO_VERSION}'" +echo "using Rust compiler: '${RUSTC_VERSION}'" + +sed -e "s/@TARGET@/x86_64-pc-windows-gnu/" src/Makevars.win.in > src/Makevars.win diff --git a/R-package/src/Makevars.win b/R-package/src/Makevars.win.in similarity index 97% rename from R-package/src/Makevars.win rename to R-package/src/Makevars.win.in index 9ea60939..8986c490 100644 --- a/R-package/src/Makevars.win +++ b/R-package/src/Makevars.win.in @@ -1,4 +1,4 @@ -TARGET = x86_64-pc-windows-gnu +TARGET = @TARGET@ # catch DEBUG envvar, which is passed from pkgbuild::compile_dll() PROFILE = $(subst x,release,$(subst truex,dev,$(DEBUG)x))