From 0738b9f339faf84612069da350eba02fa9b350d3 Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Wed, 8 Jan 2025 14:56:03 +0100 Subject: [PATCH] Use libs from Rtools if found --- src/Makevars.win | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/Makevars.win b/src/Makevars.win index 1a20721..dd866be 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -1,17 +1,22 @@ -RWINLIB = ../windows/harfbuzz +PKG_CONFIG_NAME = harfbuzz freetype2 fribidi +PKG_CONFIG ?= $(BINPREF)pkg-config +PKG_LIBS := $(shell $(PKG_CONFIG) --libs $(PKG_CONFIG_NAME)) -PKG_CPPFLAGS = \ - -I$(RWINLIB)/include/harfbuzz \ - -I$(RWINLIB)/include/fribidi \ - -I$(RWINLIB)/include/freetype2 +ifneq ($(PKG_LIBS),) +$(info using $(PKG_CONFIG_NAME) from Rtools) +PKG_CPPFLAGS := $(shell $(PKG_CONFIG) --cflags $(PKG_CONFIG_NAME)) +else +RWINLIB = ../windows/harfbuzz +PKG_CPPFLAGS = -I$(RWINLIB)/include/harfbuzz -I$(RWINLIB)/include/fribidi -I$(RWINLIB)/include/freetype2 +PKG_LIBS = -L$(RWINLIB)/lib$(R_ARCH) -L$(RWINLIB)/lib -lfribidi -lfreetype -lharfbuzz -lfreetype -lpng -lbz2 -lz -lrpcrt4 -lgdi32 -luuid +endif -PKG_LIBS = -L$(RWINLIB)/lib$(R_ARCH) -L$(RWINLIB)/lib \ - -lfribidi -lfreetype -lharfbuzz -lfreetype -lpng -lbz2 -lz -lrpcrt4 -lgdi32 -luuid +all: $(SHLIB) -all: clean winlibs +$(OBJECTS): $(RWINLIB) -winlibs: +$(RWINLIB): "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" clean: - rm -f $(OBJECTS) $(SHLIB) + rm -f $(SHLIB) $(OBJECTS)