From e451c7ec6e0bff3f8a405fb3ad8c97ed0233bbbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Wed, 20 Sep 2023 22:46:45 -0500 Subject: [PATCH] Install from binary --- .../workflows/custom/after-install/action.yml | 30 +++++++++++++++++++ configure | 3 +- src/Makevars | 5 ++-- src/Makevars.in | 4 +-- src/include/from-tar.mk | 9 +----- src/include/to-tar.mk | 2 ++ 6 files changed, 38 insertions(+), 15 deletions(-) diff --git a/.github/workflows/custom/after-install/action.yml b/.github/workflows/custom/after-install/action.yml index f7590c909..17be7eb2d 100644 --- a/.github/workflows/custom/after-install/action.yml +++ b/.github/workflows/custom/after-install/action.yml @@ -15,6 +15,36 @@ runs: max-size: 200M verbose: 1 + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + with: + detached: true + + - name: Download DuckDB binary + if: ${{ runner.os == 'Linux' }} + run: | + # FIXME: only for stable version, other code for dynamic version + # FIXME: dynamic detection of version number + + tempdir <- "${{ runner.temp }}" + zipfile <- file.path(tempdir, "libduckdb-linux-amd64.zip") + bindir <- file.path(tempdir, "libduckdb-linux-amd64") + + curl::curl_download("https://github.com/duckdb/duckdb/releases/download/v0.8.1/libduckdb-linux-amd64.zip", zipfile) + + unzip(zipfile, exdir = bindir) + + writeLines( + paste0("DUCKDB_BINARY_PATH=", bindir), + Sys.getenv("GITHUB_ENV") + ) + shell: Rscript {0} + + - name: Show DUCKDB_BINARY_PATH + run: | + echo $DUCKDB_BINARY_PATH + shell: bash + - name: Install to avoid R CMD INSTALL --pre-clean run otherwise run: | mkdir ../lib diff --git a/configure b/configure index 2d00e6308..86f5be4c0 100755 --- a/configure +++ b/configure @@ -22,8 +22,9 @@ cd $(dirname $0)/src # This logic is identical for Windows or non-Windows builds, # only that we need to-tar-win.mk instead of to-tar.mk on Windows. -if [ -f "${DUCKDB_R_PREBUILT_ARCHIVE}" ] && tar -xm -f ${DUCKDB_R_PREBUILT_ARCHIVE}; then +if [ -d "${DUCKDB_BINARY_PATH}" ] && [ -z "$(diff ${DUCKDB_BINARY_PATH}/duckdb.h duckdb/src/include/duckdb.h)" ]; then cp include/from-tar.mk Makevars.duckdb else + false cp include/to-tar.mk Makevars.duckdb fi diff --git a/src/Makevars b/src/Makevars index bcfd6224e..449d942fe 100644 --- a/src/Makevars +++ b/src/Makevars @@ -4,9 +4,7 @@ # # The symbols.rds file helps troubleshoot issues with forbidden symbols # such as abort. -all: duckdb.tar symbols.rds $(SHLIB) - -include include/sources.mk +all: symbols.rds $(SHLIB) # This file is created by the configure or configure.win scripts # depending on the value of the DUCKDB_R_PREBUILT_ARCHIVE environment variable. @@ -15,3 +13,4 @@ include Makevars.duckdb CXX_STD = CXX17 PKG_CPPFLAGS = -Iinclude -I../inst/include -DDUCKDB_DISABLE_PRINT -DDUCKDB_R_BUILD -Iduckdb/src/include -Iduckdb/third_party/fmt/include -Iduckdb/third_party/fsst -Iduckdb/third_party/re2 -Iduckdb/third_party/miniz -Iduckdb/third_party/utf8proc/include -Iduckdb/third_party/utf8proc -Iduckdb/third_party/hyperloglog -Iduckdb/third_party/fastpforlib -Iduckdb/third_party/tdigest -Iduckdb/third_party/libpg_query/include -Iduckdb/third_party/libpg_query -Iduckdb/third_party/concurrentqueue -Iduckdb/third_party/pcg -Iduckdb/third_party/httplib -Iduckdb/third_party/fast_float -Iduckdb/third_party/mbedtls -Iduckdb/third_party/mbedtls/include -Iduckdb/third_party/mbedtls/library -Iduckdb/third_party/jaro_winkler -Iduckdb/third_party/jaro_winkler/details -Iduckdb/extension/parquet/include -Iduckdb/third_party/parquet -Iduckdb/third_party/snappy -Iduckdb/third_party/thrift -Iduckdb/third_party/zstd/include -I../inst/include -Iduckdb -DBUILD_PARQUET_EXTENSION -DDUCKDB_BUILD_LIBRARY OBJECTS=database.o connection.o statement.o register.o relational.o scan.o transform.o utils.o reltoaltrep.o types.o cpp11.o $(SOURCES) +PKG_LIBS=$(PKG_LIBS_BINARY) diff --git a/src/Makevars.in b/src/Makevars.in index 8c0b5e534..d201dcc44 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -4,9 +4,7 @@ # # The symbols.rds file helps troubleshoot issues with forbidden symbols # such as abort. -all: duckdb.tar symbols.rds $(SHLIB) - -include include/sources.mk +all: symbols.rds $(SHLIB) # This file is created by the configure or configure.win scripts # depending on the value of the DUCKDB_R_PREBUILT_ARCHIVE environment variable. diff --git a/src/include/from-tar.mk b/src/include/from-tar.mk index 6f5ee12e3..2a1ed57a5 100644 --- a/src/include/from-tar.mk +++ b/src/include/from-tar.mk @@ -1,8 +1 @@ -# This file is used from Makevars if $DUCKDB_R_PREBUILT_ARCHIVE points -# to an existing file. -# We print details on the object files already extracted in the configure script -# for diagnostic purposes. -duckdb.tar: $(DUCKDB_R_PREBUILT_ARCHIVE) - ls -lR - # Ensure the file is recreated in the next run - rm -f Makevars.duckdb +PKG_LIBS_BINARY=-L"$(DUCKDB_BINARY_PATH)" -Wl,-rpath,"$(DUCKDB_BINARY_PATH)" -lduckdb diff --git a/src/include/to-tar.mk b/src/include/to-tar.mk index 67a941833..79322e11e 100644 --- a/src/include/to-tar.mk +++ b/src/include/to-tar.mk @@ -1,3 +1,5 @@ +include include/sources.mk + # This file is used from Makevars if $DUCKDB_R_PREBUILT_ARCHIVE is empty # or does not point to an existing file. # In the latter case, we create the file after the object files have been built.