From dcabf1cc3c72c3e78c02c03890ea2da61c497fd9 Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Tue, 19 Sep 2023 15:33:20 +0200 Subject: [PATCH] Windows: update to protobuf 21.12 --- .github/workflows/R-CMD-check.yaml | 4 ++-- DESCRIPTION | 2 +- NEWS | 3 +++ src/Makevars.win | 15 ++++----------- tools/winlibs.R | 22 +++++++++++++++------- 5 files changed, 25 insertions(+), 21 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 79845b2..fd122fe 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -19,8 +19,8 @@ jobs: matrix: config: - {os: macOS-latest, r: 'release'} - - {os: windows-latest, r: '3.6'} - {os: windows-latest, r: '4.1'} + - {os: windows-latest, r: '4.2'} - {os: windows-latest, r: 'release'} - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - {os: ubuntu-latest, r: 'release'} @@ -31,7 +31,7 @@ jobs: R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: r-lib/actions/setup-pandoc@v2 diff --git a/DESCRIPTION b/DESCRIPTION index d34493a..e969e7f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: cld3 Type: Package Title: Google's Compact Language Detector 3 -Version: 1.5.0 +Version: 1.6.0 Authors@R: c( person("Jeroen", "Ooms", ,"jeroen@berkeley.edu", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-4035-0289")), diff --git a/NEWS b/NEWS index 8608647..9b36578 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +1.6.0 + - Windows: update to protobuf 21.12 + 1.5.0 - Windows: upgrade to libprotobuf 3.19.4 - No longer force CXX11 (use local C++ default std) diff --git a/src/Makevars.win b/src/Makevars.win index 95848a8..ae42609 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -1,17 +1,10 @@ -# ProtoBuf Version -VERSION = 3.19.4 - -# Need older build for R < 4.0 -ifeq ($(R_COMPILED_BY),gcc 4.9.3) -VERSION = 3.12.4 -endif - -RWINLIB = ../windows/protobuf-${VERSION} +RWINLIB = ../windows/protobuf PKG_CPPFLAGS = -I. -I$(RWINLIB)/include -DUSENEWAPI PKG_LIBS = -Llibcld3 -lstatcld3 \ -L$(RWINLIB)/lib${subst gcc,,${COMPILED_BY}}${R_ARCH} \ - -L$(RWINLIB)/lib${R_ARCH} \ + -L$(RWINLIB)/lib \ -lprotobuf-lite +BINDIR=$(RWINLIB)/bin$(subst 64,,$(WIN)) STATLIB = libcld3/libstatcld3.a LIBCLD3 = \ @@ -52,7 +45,7 @@ $(STATLIB): $(LIBCLD3) winlibs: "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" $(VERSION) - "$(RWINLIB)/bin$(WIN)/protoc" cld_3/protos/*.proto --cpp_out=. + "$(BINDIR)/protoc" cld_3/protos/*.proto --cpp_out=. clean: rm -f $(OBJECTS) $(SHLIB) $(LIBCLD3) $(STATLIB) cld_3/protos/*.pb.cc cld_3/protos/*.pb.h diff --git a/tools/winlibs.R b/tools/winlibs.R index 3c12aee..eed5845 100644 --- a/tools/winlibs.R +++ b/tools/winlibs.R @@ -1,9 +1,17 @@ -# Build against protobuf libs compiled with Rtools -VERSION <- commandArgs(TRUE) -if (!file.exists(sprintf("../windows/protobuf-%s/include/google/protobuf/descriptor.h", VERSION))) { - if (getRversion() < "3.3.0") setInternet2() - download.file(sprintf("https://github.com/rwinlib/protobuf/archive/%s.zip", VERSION), "lib.zip", quiet = TRUE) +if(!file.exists("../windows/protobuf/include/google/protobuf/descriptor.h")){ + unlink("../windows", recursive = TRUE) + url <- if(grepl("aarch", R.version$platform)){ + "https://github.com/r-windows/bundles/releases/download/protobuf-21.12/protobuf-21.12-clang-aarch64.tar.xz" + } else if(getRversion() >= "4.3") { + # NB: does not work with rtools42 + "https://github.com/r-windows/bundles/releases/download/protobuf-21.12/protobuf-21.12-ucrt-x86_64.tar.xz" + } else { + "https://github.com/rwinlib/protobuf/archive/v3.19.4-2.tar.gz" + } + download.file(url, basename(url), quiet = TRUE) dir.create("../windows", showWarnings = FALSE) - unzip("lib.zip", exdir = "../windows") - unlink("lib.zip") + untar(basename(url), exdir = "../windows", tar = 'internal') + unlink(basename(url)) + setwd("../windows") + file.rename(list.files(), 'protobuf') }