Skip to content

Windows: use mariadbclient from Rtools if available #383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
RWINLIB = ../windows/libmariadbclient
PKG_CONFIG_NAME = libmariadbclient
PKG_CONFIG ?= $(BINPREF)pkg-config
PKG_LIBS := $(shell $(PKG_CONFIG) --libs $(PKG_CONFIG_NAME))
EXTRA_CFLAGS = -DRCPP_DEFAULT_INCLUDE_CALL=false -DRCPP_USING_UTF8_ERROR_STRING -DBOOST_NO_AUTO_PTR

# Remove hack when dropping support for R-4.1
ifeq ($(R_COMPILED_BY),gcc 8.3.0)
TLS_LIBS = -lssl -lcrypto
RTOOLS40_LIBS = -lssl -lcrypto
endif

PKG_CPPFLAGS = -I$(RWINLIB)/include/mariadb -Ivendor -DRCPP_DEFAULT_INCLUDE_CALL=false -DRCPP_USING_UTF8_ERROR_STRING -DBOOST_NO_AUTO_PTR
PKG_LIBS = \
-L$(RWINLIB)/lib$(R_ARCH) \
-L$(RWINLIB)/lib \
-lmariadbclient $(TLS_LIBS) -lz -lbcrypt -lsecur32 -lshlwapi -lcrypt32 -lgdi32 -lws2_32 -pthread
ifneq ($(PKG_LIBS),)
$(info using $(PKG_CONFIG_NAME) from Rtools)
PKG_CPPFLAGS := $(shell $(PKG_CONFIG) --cflags $(PKG_CONFIG_NAME)) $(EXTRA_CFLAGS)
else
RWINLIB = ../windows/libmariadbclient
PKG_CPPFLAGS = -I$(RWINLIB)/include/mariadb -Ivendor $(EXTRA_CFLAGS)
PKG_LIBS = -L$(RWINLIB)/lib$(R_ARCH) -L$(RWINLIB)/lib \
-lmariadbclient $(RTOOLS40_LIBS) -lz -lbcrypt -lsecur32 -lshlwapi -lcrypt32 -lgdi32 -lws2_32 -pthread
endif

# Necessary, so that the behavior of make called without arguments
# is not changed:
$(SHLIB):
all: $(SHLIB)

# We need winlibs (=headers) already for compiling each .o file
$(OBJECTS): winlibs
$(OBJECTS): $(RWINLIB)

$(RWINLIB):
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R"

clean:
rm -f $(SHLIB) $(OBJECTS)

winlibs:
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R"
Loading