Skip to content

Commit

Permalink
improve versioning for rwinlib dl
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyhanson committed Sep 4, 2021
1 parent e5f1109 commit 7cdbb40
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/Makevars.win
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ CXX_STD = CXX11

PKG_CPPFLAGS = -I$(RWINLIB)/include

PKG_LIBS = -L$(RWINLIB)/lib$(BUILD)$(R_ARCH)$(CRT) \
-L$(RWINLIB)/lib$(R_ARCH) \
PKG_LIBS = \
-L$(RWINLIB)/lib$(BUILD) \
-L$(RWINLIB)/lib$(R_ARCH)$(CRT) \
$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) \
-lmpfr -lgmp -lgmpxx

Expand All @@ -19,6 +20,6 @@ clean:
rm -f $(SHLIB) $(OBJECTS)

winlibs:
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R"
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" $(VERSION)

.PHONY: all winlibs clean
13 changes: 9 additions & 4 deletions tools/winlibs.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# Determine GMP version from command line arguments
VERSION <- commandArgs(TRUE)

# Verify R version validity
if (getRversion() < "3.3.0") {
stop("R version too old. On Windows this package requires at least R-3.3")
}

# Download gmp-6.1.2 from rwinlib
if (!file.exists("../windows/gmp-6.1.2/include/gmpxx.hpp")) {
# Download GMP from rwinlib (https://github.com/rwinlib/gmp)
test_file <- sprintf("../windows/gmp-%s/include/gmpxx.h", VERSION)
if (!file.exists(test_file)) {
download.file(
"https://github.com/rwinlib/gmp/archive/v6.1.2.zip", "lib.zip",
quiet = TRUE)
sprintf("https://github.com/rwinlib/gmp/archive/v%s.zip", VERSION),
"lib.zip", quiet = TRUE)
dir.create("../windows", showWarnings = FALSE)
unzip("lib.zip", exdir = "../windows")
unlink("lib.zip")
Expand Down

0 comments on commit 7cdbb40

Please sign in to comment.