-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rework the makevars configure approach
- Loading branch information
1 parent
9080d17
commit 16b7d5a
Showing
12 changed files
with
121 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
TARGET_DIR = ./rust/target | ||
LIBDIR = $(TARGET_DIR)/release | ||
STATLIB = $(LIBDIR)/lib{{{lib_name}}}.a | ||
PKG_LIBS = -L$(LIBDIR) -l{{{lib_name}}} | ||
|
||
all: C_clean | ||
|
||
$(SHLIB): $(STATLIB) | ||
|
||
CARGOTMP = $(CURDIR)/.cargo | ||
VENDOR_DIR = $(CURDIR)/vendor | ||
|
||
|
||
# RUSTFLAGS appends --print=native-static-libs to ensure that | ||
# the correct linkers are used. Use this for debugging if need. | ||
# | ||
# CRAN note: Cargo and Rustc versions are reported during | ||
# configure via tools/msrv.R. | ||
# | ||
# When on CRAN, the vendor.tar.xz file is unzipped and used | ||
# for offline compilation. It is ignored when NOT_CRAN != false | ||
$(STATLIB): | ||
|
||
# Check if NOT_CRAN is false and unzip vendor.tar.xz if so | ||
if [ "$(NOT_CRAN)" = "false" ]; then \ | ||
if [ -f ./rust/vendor.tar.xz ]; then \ | ||
tar xf rust/vendor.tar.xz && \ | ||
mkdir -p $(CARGOTMP) && \ | ||
cp rust/vendor-config.toml $(CARGOTMP)/config.toml; \ | ||
fi; \ | ||
fi | ||
|
||
export CARGO_HOME=$(CARGOTMP) && \ | ||
export PATH="$(PATH):$(HOME)/.cargo/bin" && \ | ||
RUSTFLAGS="$(RUSTFLAGS) --print=native-static-libs" cargo build @CRAN_FLAGS@ --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) | ||
|
||
# Always clean up CARGOTMP | ||
rm -Rf $(CARGOTMP) | ||
|
||
if [ "$(NOT_CRAN)" != "false" ]; then \ | ||
rm -Rf $(VENDOR_DIR); \ | ||
rm -Rf $(TARGET_DIR); \ | ||
rm -Rf $(LIBDIR)/build; \ | ||
fi | ||
|
||
C_clean: | ||
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) | ||
|
||
clean: | ||
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) $(TARGET_DIR) $(VENDOR_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# removes the Makevars file generated by configure | ||
# this allows the Makevars file to be generated each | ||
# time the build is called | ||
rm -rf src/Makevars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env sh | ||
: "${R_HOME=`R RHOME`}" | ||
"${R_HOME}/bin/Rscript" tools/msrv.R | ||
|
||
# Set CRAN_FLAGS based on the NOT_CRAN value | ||
if [ "${NOT_CRAN}" = "false" ]; then | ||
export CRAN_FLAGS="-j 2 --offline" | ||
else | ||
export CRAN_FLAGS="" | ||
fi | ||
|
||
# Substitute @CRAN_FLAGS@ in Makevars.in with the actual value of $CRAN_FLAGS | ||
sed -e "s|@CRAN_FLAGS@|$CRAN_FLAGS|" src/Makevars.in > src/Makevars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env sh | ||
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" tools/msrv.R | ||
|
||
# Set CRAN_FLAGS based on the NOT_CRAN value | ||
if [ "${NOT_CRAN}" = "false" ]; then | ||
export CRAN_FLAGS="-j 2 --offline" | ||
else | ||
export CRAN_FLAGS="" | ||
fi | ||
|
||
# Substitute @CRAN_FLAGS@ in Makevars.in with the actual value of $CRAN_FLAGS | ||
sed -e "s|@CRAN_FLAGS@|$CRAN_FLAGS|" src/Makevars.in > src/Makevars |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.