Skip to content

Commit

Permalink
Windows: use libv8 9.1 on all versions of R (drops support for win vi…
Browse files Browse the repository at this point in the history
…sta)
  • Loading branch information
jeroen committed Apr 7, 2023
1 parent 4d303fe commit 001ed6a
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 46 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: V8
Type: Package
Title: Embedded JavaScript and WebAssembly Engine for R
Version: 4.2.2.9000
Version: 4.3.0
Authors@R: c(
person("Jeroen", "Ooms", role = c("aut", "cre"), email = "[email protected]",
comment = c(ORCID = "0000-0002-4035-0289")),
Expand Down Expand Up @@ -32,3 +32,4 @@ RoxygenNote: 7.2.3
Roxygen: list(load = "installed", markdown = TRUE)
Language: en-US
Encoding: UTF-8
Biarch: true
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
4.3.0
- MacOS: update libv8 to 11.2
- Windows: use libv8 version 9.1 on all R >= 4.0, drop support for Win2008/Vista
- Add feature test for V8_ENABLE_SANDBOX, required by some V8 10.8+ (#144)
- Unbundle 3rd party JS libs that are only needed for examples.

Expand Down
6 changes: 6 additions & 0 deletions configure.win
100644 → 100755
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

# Temp fixups R-3.6 or CRAN legacy Vista server
if [ "${R_VERSION:0:1}" = "3" ] || [ "$LOCAL_SOFT" = "d:/Compiler/gcc-4.9.3/local330" ]; then
cp -f tools/legacy.win src/Makevars.win
fi
17 changes: 0 additions & 17 deletions src/Makevars.ucrt

This file was deleted.

17 changes: 7 additions & 10 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
VERSION = 6.2.414.50-vista
CXX_STD = CXX11
RWINLIB =../windows/libv8-$(VERSION)
PKG_CPPFLAGS = -I$(RWINLIB)/include -DV8_ENABLE_CHECKS
CXX_STD = CXX17
RWINLIB =../windows/mingw$(WIN)
PKG_CPPFLAGS = -I$(RWINLIB)/include $(subst $(WIN),,-DV8_COMPRESS_POINTERS64)
PKG_LIBS = \
-L$(RWINLIB)/lib${subst gcc ,-,${R_COMPILED_BY}}${R_ARCH} \
-L$(RWINLIB)/lib${R_ARCH} \
-lv8_base -lv8_libplatform -lv8_nosnapshot \
-lv8_libbase -lv8_libsampler -lv8_builtins_setup -lv8_builtins_generators \
-lws2_32 -lwinmm -ldbghelp -lshlwapi
-L$(RWINLIB)/lib \
-lv8_monolith \
-lws2_32 -lwinmm -ldbghelp -lshlwapi -lssp -lz

all: clean winlibs

clean:
rm -f $(SHLIB) $(OBJECTS)

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

.PHONY: all winlibs clean
20 changes: 20 additions & 0 deletions tools/legacy.win
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
VERSION = 6.2.414.50-vista
CXX_STD = CXX11
RWINLIB =../windows/libv8-$(VERSION)
PKG_CPPFLAGS = -I$(RWINLIB)/include -DV8_ENABLE_CHECKS
PKG_LIBS = \
-L$(RWINLIB)/lib${subst gcc ,-,${R_COMPILED_BY}}${R_ARCH} \
-L$(RWINLIB)/lib${R_ARCH} \
-lv8_base -lv8_libplatform -lv8_nosnapshot \
-lv8_libbase -lv8_libsampler -lv8_builtins_setup -lv8_builtins_generators \
-lws2_32 -lwinmm -ldbghelp -lshlwapi

all: clean winlibs

clean:
rm -f $(SHLIB) $(OBJECTS)

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

.PHONY: all winlibs clean
13 changes: 13 additions & 0 deletions tools/oldlibs.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Build against mingw-w64 build of libv8
VERSION <- commandArgs(TRUE)
LIBDIR <- paste0("../windows/libv8-", VERSION)
if(!file.exists(paste0(LIBDIR, "/include/v8.h"))){
if(getRversion() < "3.3.0") stop("This library requires R 3.3 or newer")
download.file(sprintf("https://github.com/rwinlib/libv8/archive/v%s.zip", VERSION), "v8.zip", quiet = TRUE)
dir.create("../windows", showWarnings = FALSE)
unzip("v8.zip", exdir = "../windows")
setwd(LIBDIR)
unzip("lib-4.9.3.zip")
if(getRversion() >= "3.6.0") unzip("lib.zip")
unlink("v8.zip")
}
7 changes: 0 additions & 7 deletions tools/ucrtlibs.R

This file was deleted.

25 changes: 14 additions & 11 deletions tools/winlibs.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Build against mingw-w64 build of libv8
VERSION <- commandArgs(TRUE)
LIBDIR <- paste0("../windows/libv8-", VERSION)
if(!file.exists(paste0(LIBDIR, "/include/v8.h"))){
if(getRversion() < "3.3.0") stop("This library requires R 3.3 or newer")
download.file(sprintf("https://github.com/rwinlib/libv8/archive/v%s.zip", VERSION), "v8.zip", quiet = TRUE)
# Download a suitable libv8 build
if(grepl('Windows Server 2008', osVersion)){
stop("Windows Vista/2008 is no longer supported")
}
if(!file.exists('../windows/ucrt64/include/v8.h')){
cdn <- ifelse(isTRUE(grepl('ucrt', R.version$crt)),
'https://github.com/jeroen/V8/releases/download/v3.6.0/v8-9.1.269.38-win-ucrt.pkg.tar.xz',
'https://github.com/jeroen/V8/releases/download/v3.6.0/v8-9.1.269.38-win-msvcrt.tar.xz')
download.file(cdn, "libv8.tar.xz", quiet = TRUE)
dir.create("../windows", showWarnings = FALSE)
unzip("v8.zip", exdir = "../windows")
setwd(LIBDIR)
unzip("lib-4.9.3.zip")
if(getRversion() >= "3.6.0") unzip("lib.zip")
unlink("v8.zip")
untar('libv8.tar.xz', exdir = "../windows", tar = 'internal')
unlink('libv8.tar.xz')
if(isTRUE(grepl('ucrt', R.version$crt))){
file.rename("../windows/ucrt64", "../windows/mingw64")
}
}

0 comments on commit 001ed6a

Please sign in to comment.