forked from duckdb/duckdb-r
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.win
executable file
·35 lines (30 loc) · 1.33 KB
/
configure.win
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
set -e
cd $(dirname $0)/src
# http://www.ii.uib.no/~olev/win32/tools/dlltool.html
if [ "$(${R_HOME}/bin/Rscript --vanilla -e 'writeLines(format(getRversion() < "4.2"))')" = "TRUE" ]; then
echo "Extracting librstrtmgr.a for R < 4.2"
gunzip -k librstrtmgr.a.gz
fi
# The purpose of this is to avoid rebuilding duckdb in every CI/CD run.
# We set the DUCKDB_R_PREBUILT_ARCHIVE environment variable to a file path
# that contains a .tar of all object files.
# This .tar file is cached and restored in CI/CD, keyed by compiler, OS,
# and hash of the duckdb/src subtree.
#
# Depending on the availability of the file, we either use the object files
# (via the rules in include/from-tar.mk), or create them as usual
# (via include/to-tar.mk). In the latter case, if the DUCKDB_R_PREBUILT_ARCHIVE
# environment variable is set, the .tar file is created.
#
# For local installations, this is typically not needed
# because ccache achieves the same purpose but better.
# In CI/CD, this approach gives better results than ccache.
#
# 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 --force-local -f ${DUCKDB_R_PREBUILT_ARCHIVE}; then
cp include/from-tar.mk Makevars.duckdb
else
cp include/to-tar-win.mk Makevars.duckdb
fi