Skip to content

Commit

Permalink
Tweak R-package
Browse files Browse the repository at this point in the history
  • Loading branch information
yutannihilation committed Sep 17, 2024
1 parent e6faf7b commit 3890c41
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
1 change: 1 addition & 0 deletions R-package/cleanup.win
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rm -f src/Makevars.win
5 changes: 0 additions & 5 deletions R-package/configure
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
24 changes: 24 additions & 0 deletions R-package/configure.win
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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))
Expand Down

0 comments on commit 3890c41

Please sign in to comment.