Skip to content

Commit

Permalink
chore: Move stripping logic to install.libs.R
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Sep 24, 2024
1 parent dea42c8 commit 52f77ed
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 42 deletions.
14 changes: 0 additions & 14 deletions src/Makevars
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,3 @@ include Makevars.duckdb
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/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/zstd/include -Iduckdb/third_party/mbedtls -Iduckdb/third_party/mbedtls/include -I../inst/include -Iduckdb -DDUCKDB_EXTENSION_PARQUET_LINKED -DDUCKDB_BUILD_LIBRARY
OBJECTS=rfuns.o database.o connection.o statement.o register.o relational.o scan.o transform.o utils.o reltoaltrep.o types.o cpp11.o $(SOURCES)

all: $(SHLIB) strip

strip: $(SHLIB)
set -x; \
if which strip && which uname && test "`uname`" = "Linux" && test "$$_R_SHLIB_STRIP_" = "true" && test -n "$$R_STRIP_SHARED_LIB" ; \
then \
echo stripping $(SHLIB) ; \
echo $$R_STRIP_SHARED_LIB $(SHLIB) ; \
$$R_STRIP_SHARED_LIB $(SHLIB) ; \
fi ; \
ls -l $(SHLIB)

.PHONY: all clean strip
14 changes: 0 additions & 14 deletions src/Makevars.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,3 @@ 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 transform.o utils.o reltoaltrep.o types.o cpp11.o $(SOURCES)
PKG_LIBS={{ LINK_FLAGS }}

all: $(SHLIB) strip

strip: $(SHLIB)
set -x; \
if which strip && which uname && test "`uname`" = "Linux" && test "$$_R_SHLIB_STRIP_" = "true" && test -n "$$R_STRIP_SHARED_LIB" ; \
then \
echo stripping $(SHLIB) ; \
echo $$R_STRIP_SHARED_LIB $(SHLIB) ; \
$$R_STRIP_SHARED_LIB $(SHLIB) ; \
fi ; \
ls -l $(SHLIB)

.PHONY: all clean strip
14 changes: 0 additions & 14 deletions src/Makevars.win
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,3 @@ 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/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/zstd/include -Iduckdb/third_party/mbedtls -Iduckdb/third_party/mbedtls/include -I../inst/include -Iduckdb -DDUCKDB_EXTENSION_PARQUET_LINKED -DDUCKDB_BUILD_LIBRARY -DDUCKDB_PLATFORM_RTOOLS=1
OBJECTS=rfuns.o 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=-lws2_32 -L. -lrstrtmgr

all: $(SHLIB) strip

strip: $(SHLIB)
set -x; \
if which strip && which uname && test "`uname`" = "Linux" && test "$$_R_SHLIB_STRIP_" = "true" && test -n "$$R_STRIP_SHARED_LIB" ; \
then \
echo stripping $(SHLIB) ; \
echo $$R_STRIP_SHARED_LIB $(SHLIB) ; \
$$R_STRIP_SHARED_LIB $(SHLIB) ; \
fi ; \
ls -l $(SHLIB)

.PHONY: all clean strip
9 changes: 9 additions & 0 deletions src/install.libs.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ files <- Sys.glob(paste0("*", SHLIB_EXT))
dest <- file.path(R_PACKAGE_DIR, paste0('libs', R_ARCH))
dir.create(dest, recursive = TRUE, showWarnings = FALSE)
file.copy(files, dest, overwrite = TRUE)

if (Sys.which("strip") != "" && Sys.info()["sysname"] == "Linux" && isTRUE(as.logical(Sys.getenv("_R_SHLIB_STRIP_"))) && Sys.getenv("R_STRIP_SHARED_LIB") != "") {
dest_files <- file.path(dest, files)
for (file in dest_files) {
message("Stripping: ", file)
system2(Sys.getenv("R_STRIP_SHARED_LIB"), args = file)
}
}

if (file.exists("symbols.rds")) {
file.copy("symbols.rds", dest, overwrite = TRUE)
}

0 comments on commit 52f77ed

Please sign in to comment.