-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
89 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
^\.travis\.yml$ | ||
^appveyor\.yml$ | ||
^codecov\.yml$ | ||
^src/Makevars$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ systemfonts.Rproj | |
src/*.o | ||
src/*.so | ||
src/*/*.o | ||
src/Makevars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/bash | ||
# Anticonf (tm) script by Jeroen Ooms (2019) | ||
# This script will query 'pkg-config' for the required cflags and ldflags. | ||
# If pkg-config is unavailable or does not find the library, try setting | ||
# INCLUDE_DIR and LIB_DIR manually via e.g: | ||
# R CMD INSTALL --configure-vars='INCLUDE_DIR=/.../include LIB_DIR=/.../lib' | ||
|
||
# Library settings | ||
PKG_CONFIG_NAME="freetype2" | ||
PKG_DEB_NAME="libfreetype6-dev" | ||
PKG_RPM_NAME="freetype-devel" | ||
PKG_BREW_NAME="freetype" | ||
PKG_TEST_HEADER="<ft2build.h>" | ||
PKG_LIBS="-lfreetype" | ||
|
||
# We use special config on MacOS | ||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
SYS="DARWIN" | ||
PKG_LIBS="$PKG_LIBS -framework CoreText -framework Foundation" | ||
else | ||
SYS="UNIX" | ||
PKG_CONFIG_NAME="$PKG_CONFIG_NAME fontconfig" | ||
fi | ||
|
||
# Use pkg-config if available | ||
if [ $(command -v pkg-config) ]; then | ||
PKGCONFIG_CFLAGS=$(pkg-config --cflags --silence-errors ${PKG_CONFIG_NAME}) | ||
PKGCONFIG_LIBS=$(pkg-config --libs ${PKG_CONFIG_NAME}) | ||
fi | ||
|
||
# Note that cflags may be empty in case of success | ||
if [ "$INCLUDE_DIR" ] || [ "$LIB_DIR" ]; then | ||
echo "Found INCLUDE_DIR and/or LIB_DIR!" | ||
PKG_CFLAGS="-I$INCLUDE_DIR $PKG_CFLAGS" | ||
PKG_LIBS="-L$LIB_DIR $PKG_LIBS" | ||
elif [ "$PKGCONFIG_CFLAGS" ] || [ "$PKGCONFIG_LIBS" ]; then | ||
echo "Found pkg-config cflags and libs!" | ||
PKG_CFLAGS=${PKGCONFIG_CFLAGS} | ||
PKG_LIBS=${PKGCONFIG_LIBS} | ||
fi | ||
|
||
# For debugging | ||
echo "Using PKG_CFLAGS=$PKG_CFLAGS" | ||
echo "Using PKG_LIBS=$PKG_LIBS" | ||
|
||
# Find compiler | ||
CC=$(${R_HOME}/bin/R CMD config CC) | ||
CFLAGS=$(${R_HOME}/bin/R CMD config CFLAGS) | ||
CPPFLAGS=$(${R_HOME}/bin/R CMD config CPPFLAGS) | ||
|
||
# Test configuration | ||
echo "#include $PKG_TEST_HEADER" | ${CC} ${CPPFLAGS} ${PKG_CFLAGS} ${CFLAGS} -E -xc - >/dev/null | ||
|
||
# Customize the error | ||
if [ $? -ne 0 ]; then | ||
echo "------------------------- ANTICONF ERROR ---------------------------" | ||
echo "Configuration failed because $PKG_CONFIG_NAME was not found. Try installing:" | ||
echo " * deb: $PKG_DEB_NAME (Debian, Ubuntu, etc)" | ||
echo " * rpm: $PKG_RPM_NAME (Fedora, EPEL)" | ||
echo " * csw: $PKG_CSW_NAME (Solaris)" | ||
echo " * brew: $PKG_BREW_NAME (OSX)" | ||
echo "If $PKG_CONFIG_NAME is already installed, check that 'pkg-config' is in your" | ||
echo "PATH and PKG_CONFIG_PATH contains a $PKG_CONFIG_NAME.pc file. If pkg-config" | ||
echo "is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:" | ||
echo "R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'" | ||
echo "--------------------------------------------------------------------" | ||
exit 1; | ||
fi | ||
|
||
# Write to Makevars | ||
sed -e "s|@cflags@|$PKG_CFLAGS|" -e "s|@libs@|$PKG_LIBS|" -e "s|@SYS@|$SYS|" src/Makevars.in > src/Makevars | ||
|
||
# Success | ||
exit 0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
PKG_CPPFLAGS=@cflags@ -DSTRICT_R_HEADERS | ||
PKG_LIBS=@libs@ | ||
|
||
DARWIN_OBJECTS = mac/FontManagerMac.o | ||
UNIX_OBJECTS = unix/FontManagerLinux.o | ||
OBJECTS = systemfonts.o init.o $(@SYS@_OBJECTS) | ||
|
||
all: clean | ||
|
||
clean: | ||
rm -f $(SHLIB) $(OBJECTS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters