Skip to content

Commit

Permalink
Use libmariadbclient from Rtools if found
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Feb 8, 2025
1 parent 0846edd commit c86121c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
- {os: macos-14, r: 'release'}
- {os: windows-latest, r: '4.1'}
- {os: windows-latest, r: '4.2'}
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: '4.3'}
- {os: windows-latest, r: '4.4'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
Expand Down
1 change: 1 addition & 0 deletions RMySQL.Rproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Version: 1.0
ProjectId: df551388-4dd3-412f-ac41-f4c0a0c8a880

RestoreWorkspace: Default
SaveWorkspace: Default
Expand Down
28 changes: 16 additions & 12 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
RWINLIB = ../windows/libmariadbclient
PKG_CONFIG_NAME = libmariadbclient
PKG_CONFIG ?= $(BINPREF)pkg-config
PKG_LIBS := $(shell $(PKG_CONFIG) --libs $(PKG_CONFIG_NAME))

ifeq ($(R_COMPILED_BY),gcc 8.3.0)
TLS_LIBS = -lssl -lcrypto
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
PKG_LIBS = -L$(RWINLIB)/lib$(R_ARCH) -L$(RWINLIB)/lib \
-lmariadbclient -lssl -lcrypto -lz -lbcrypt -lsecur32 -lshlwapi -lcrypt32 -lgdi32 -lws2_32 -pthread
endif

PKG_CPPFLAGS = -I$(RWINLIB)/include/mariadb
PKG_LIBS = \
-L$(RWINLIB)/lib$(R_ARCH) \
-L$(RWINLIB)/lib \
-lmariadbclient $(TLS_LIBS) -lz -lbcrypt -lsecur32 -lshlwapi -lcrypt32 -lgdi32 -lws2_32 -pthread
all: $(SHLIB)

$(OBJECTS): $(RWINLIB)

all: clean winlibs
$(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" $(VERSION)

0 comments on commit c86121c

Please sign in to comment.