From f2159e9a7a514c4a99e7fd33a78cff5ae0135fe9 Mon Sep 17 00:00:00 2001 From: Malte Londschien <61679398+mlondschien@users.noreply.github.com> Date: Mon, 8 Jan 2024 13:57:54 +0100 Subject: [PATCH] Add configure, configure Makevars.in -> Makevars (#165) * Add configure, configure Makevars.in -> Makevars * Empty Makevars. * Different permissions for configure. * Implement suggestion by @yutannihilation --- changeforest-r/configure | 1 + changeforest-r/src/{Makevars => Makevars.in} | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100755 changeforest-r/configure rename changeforest-r/src/{Makevars => Makevars.in} (80%) diff --git a/changeforest-r/configure b/changeforest-r/configure new file mode 100755 index 0000000..5df740a --- /dev/null +++ b/changeforest-r/configure @@ -0,0 +1 @@ +sed -e "s|@RUST_TARGET@|$(rustc -vV | grep host | cut -d' ' -f2)|" src/Makevars.in > src/Makevars \ No newline at end of file diff --git a/changeforest-r/src/Makevars b/changeforest-r/src/Makevars.in similarity index 80% rename from changeforest-r/src/Makevars rename to changeforest-r/src/Makevars.in index b830542..0ed0ed5 100644 --- a/changeforest-r/src/Makevars +++ b/changeforest-r/src/Makevars.in @@ -1,5 +1,6 @@ +TARGET ?= @RUST_TARGET@ TARGET_DIR = ./rust/target -LIBDIR = $(TARGET_DIR)/release +LIBDIR = $(TARGET_DIR)/$(TARGET)/release STATLIB = $(LIBDIR)/libchangeforestr.a PKG_LIBS = -L$(LIBDIR) -lchangeforestr @@ -17,7 +18,7 @@ $(STATLIB): export CARGO_HOME=$(CARGOTMP); \ fi && \ export PATH="$(PATH):$(HOME)/.cargo/bin" && \ - cargo build --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) + cargo build --target=$(TARGET) --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) if [ "$(NOT_CRAN)" != "true" ]; then \ rm -Rf $(CARGOTMP) && \ rm -Rf $(LIBDIR)/build; \