From ad30dd2ad4a3654906021ef24f2bb3671f9eec9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Mon, 20 Jan 2025 12:34:01 +0100 Subject: [PATCH] chore: Support `pkgload::load_all()` and compilation database --- cleanup | 9 +++++++++ configure | 7 ++++++- src/Makevars | 4 ++++ src/Makevars.in | 4 ++++ src/Makevars.win | 4 ++++ 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/cleanup b/cleanup index ec6a93ed9..91db5fe46 100755 --- a/cleanup +++ b/cleanup @@ -2,6 +2,15 @@ set -ex +# Get command line of grandparent process +parent_call=$(ps -o args= -p $(ps -o ppid= -p $$)) + +# Check if --preclean is in the command line +if [ $(echo $parent_call | grep -c -- --preclean) -ne 0 ]; then + echo "Skipping cleanup" + exit 0 +fi + # Check if the archive already exists if [ -f "src/duckdb.tar.xz" ]; then echo "duckdb.tar.xz already exists. Skipping compression." diff --git a/configure b/configure index 3b9189ac9..c9638b64d 100755 --- a/configure +++ b/configure @@ -32,5 +32,10 @@ fi # This happens in the cleanup script. if [ -f duckdb.tar.xz ]; then - tar xJf duckdb.tar.xz + if [ -d duckdb ]; then + echo "Ignoring duckdb.tar.gz because duckdb directory still exists" + rm duckdb.tar.xz + else + tar xJf duckdb.tar.xz + fi fi diff --git a/src/Makevars b/src/Makevars index 0eff645a7..021117e00 100644 --- a/src/Makevars +++ b/src/Makevars @@ -14,6 +14,10 @@ include include/sources.mk # depending on the value of the DUCKDB_R_PREBUILT_ARCHIVE environment variable. include Makevars.duckdb +# An empty file works well enough as a default, e.g., for pkgload::load_all() +Makevars.duckdb: + @touch $@ + CXX_STD = CXX17 PKG_CPPFLAGS = -Iinclude -I../inst/include -DDUCKDB_DISABLE_PRINT -DDUCKDB_R_BUILD -DBROTLI_ENCODER_CLEANUP_ON_OOM -Iduckdb/src/include -Iduckdb/third_party/concurrentqueue -Iduckdb/third_party/fast_float -Iduckdb/third_party/fastpforlib -Iduckdb/third_party/fmt/include -Iduckdb/third_party/fsst -Iduckdb/third_party/httplib -Iduckdb/third_party/hyperloglog -Iduckdb/third_party/jaro_winkler -Iduckdb/third_party/jaro_winkler/details -Iduckdb/third_party/libpg_query -Iduckdb/third_party/libpg_query/include -Iduckdb/third_party/lz4 -Iduckdb/third_party/brotli/include -Iduckdb/third_party/brotli/common -Iduckdb/third_party/brotli/dec -Iduckdb/third_party/brotli/enc -Iduckdb/third_party/mbedtls -Iduckdb/third_party/mbedtls/include -Iduckdb/third_party/mbedtls/library -Iduckdb/third_party/miniz -Iduckdb/third_party/pcg -Iduckdb/third_party/re2 -Iduckdb/third_party/skiplist -Iduckdb/third_party/tdigest -Iduckdb/third_party/utf8proc -Iduckdb/third_party/utf8proc/include -Iduckdb/third_party/yyjson/include -Iduckdb/third_party/zstd/include -Iduckdb/extension/parquet/include -Iduckdb/third_party/parquet -Iduckdb/third_party/thrift -Iduckdb/third_party/lz4 -Iduckdb/third_party/brotli/include -Iduckdb/third_party/brotli/common -Iduckdb/third_party/brotli/dec -Iduckdb/third_party/brotli/enc -Iduckdb/third_party/snappy -Iduckdb/third_party/mbedtls -Iduckdb/third_party/mbedtls/include -Iduckdb/third_party/zstd/include -Iduckdb/extension/core_functions/include -I../inst/include -Iduckdb -DDUCKDB_EXTENSION_PARQUET_LINKED -DDUCKDB_BUILD_LIBRARY -DDUCKDB_EXTENSION_CORE_FUNCTIONS_LINKED -DDUCKDB_BUILD_LIBRARY OBJECTS=rfuns.o database.o connection.o statement.o register.o relational.o scan.o signal.o transform.o utils.o reltoaltrep.o types.o cpp11.o $(SOURCES) diff --git a/src/Makevars.in b/src/Makevars.in index 51cfe4de3..6b09bc92d 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -14,6 +14,10 @@ include include/sources.mk # depending on the value of the DUCKDB_R_PREBUILT_ARCHIVE environment variable. include Makevars.duckdb +# An empty file works well enough as a default, e.g., for pkgload::load_all() +Makevars.duckdb: + @touch $@ + CXX_STD = CXX17 PKG_CPPFLAGS = -Iinclude -I../inst/include -DDUCKDB_DISABLE_PRINT -DDUCKDB_R_BUILD -DBROTLI_ENCODER_CLEANUP_ON_OOM {{ INCLUDES }} OBJECTS=rfuns.o database.o connection.o statement.o register.o relational.o scan.o signal.o transform.o utils.o reltoaltrep.o types.o cpp11.o $(SOURCES) diff --git a/src/Makevars.win b/src/Makevars.win index 2f563d513..ea8e0c8b2 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -14,6 +14,10 @@ include include/sources.mk # depending on the value of the DUCKDB_R_PREBUILT_ARCHIVE environment variable. include Makevars.duckdb +# An empty file works well enough as a default, e.g., for pkgload::load_all() +Makevars.duckdb: + @touch $@ + CXX_STD = CXX17 PKG_CPPFLAGS = -Iinclude -I../inst/include -DDUCKDB_DISABLE_PRINT -DDUCKDB_R_BUILD -DBROTLI_ENCODER_CLEANUP_ON_OOM -Iduckdb/src/include -Iduckdb/third_party/concurrentqueue -Iduckdb/third_party/fast_float -Iduckdb/third_party/fastpforlib -Iduckdb/third_party/fmt/include -Iduckdb/third_party/fsst -Iduckdb/third_party/httplib -Iduckdb/third_party/hyperloglog -Iduckdb/third_party/jaro_winkler -Iduckdb/third_party/jaro_winkler/details -Iduckdb/third_party/libpg_query -Iduckdb/third_party/libpg_query/include -Iduckdb/third_party/lz4 -Iduckdb/third_party/brotli/include -Iduckdb/third_party/brotli/common -Iduckdb/third_party/brotli/dec -Iduckdb/third_party/brotli/enc -Iduckdb/third_party/mbedtls -Iduckdb/third_party/mbedtls/include -Iduckdb/third_party/mbedtls/library -Iduckdb/third_party/miniz -Iduckdb/third_party/pcg -Iduckdb/third_party/re2 -Iduckdb/third_party/skiplist -Iduckdb/third_party/tdigest -Iduckdb/third_party/utf8proc -Iduckdb/third_party/utf8proc/include -Iduckdb/third_party/yyjson/include -Iduckdb/third_party/zstd/include -Iduckdb/extension/parquet/include -Iduckdb/third_party/parquet -Iduckdb/third_party/thrift -Iduckdb/third_party/lz4 -Iduckdb/third_party/brotli/include -Iduckdb/third_party/brotli/common -Iduckdb/third_party/brotli/dec -Iduckdb/third_party/brotli/enc -Iduckdb/third_party/snappy -Iduckdb/third_party/mbedtls -Iduckdb/third_party/mbedtls/include -Iduckdb/third_party/zstd/include -Iduckdb/extension/core_functions/include -I../inst/include -Iduckdb -DDUCKDB_EXTENSION_PARQUET_LINKED -DDUCKDB_BUILD_LIBRARY -DDUCKDB_EXTENSION_CORE_FUNCTIONS_LINKED -DDUCKDB_BUILD_LIBRARY -DDUCKDB_PLATFORM_RTOOLS=1 OBJECTS=rfuns.o database.o connection.o statement.o register.o relational.o scan.o signal.o transform.o utils.o reltoaltrep.o types.o cpp11.o $(SOURCES)