Skip to content

Commit

Permalink
Install from binary
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Sep 21, 2023
1 parent d187263 commit e451c7e
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 15 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/custom/after-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 2 additions & 3 deletions src/Makevars
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
4 changes: 1 addition & 3 deletions src/Makevars.in
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 1 addition & 8 deletions src/include/from-tar.mk
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions src/include/to-tar.mk
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit e451c7e

Please sign in to comment.