From 413929dad5a0bffc41d0c66df9cc80689a23c00f Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 18 Dec 2018 11:42:43 +0000 Subject: Use pkg-config for freetype2 if available else fallback to old script --- frontends/framebuffer/Makefile | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'frontends') diff --git a/frontends/framebuffer/Makefile b/frontends/framebuffer/Makefile index d36728ec0..a99031ef9 100644 --- a/frontends/framebuffer/Makefile +++ b/frontends/framebuffer/Makefile @@ -23,17 +23,33 @@ CFLAGS += '-DNETSURF_FB_FONT_FANTASY="$(NETSURF_FB_FONT_FANTASY)"' LDFLAGS += -lm +# freetype is optional but older versions do not use pkg-config +ifeq ($(NETSURF_FB_FONTLIB),freetype) + NETSURF_USE_FREETYPE2 := AUTO + NETSURF_FEATURE_FREETYPE2_CFLAGS := -DFB_USE_FREETYPE + + $(eval $(call pkg_config_find_and_add_enabled,FREETYPE2,freetype2,freetype2)) + + # try and use non pkg-config method + ifeq ($(NETSURF_USE_FREETYPE2),NO) + FREETYPE_CONFIG_EXISTS := $(shell freetype-config --cflags >/dev/null && echo yes) + ifeq ($(FREETYPE_CONFIG_EXISTS),yes) + NETSURF_USE_FREETYPE2 := YES + CFLAGS += $(shell freetype-config --cflags) $(NETSURF_FEATURE_FREETYPE2_CFLAGS) + LDFLAGS += $(shell freetype-config --libs) + $(info FT2.CNFG: freetype2 (freetype2) enabled) + else + $(info FT2.CNFG: freetype2 (freetype2) failed) + $(error Unable to find library for: freetype2) + endif + endif +endif + # non optional pkg-configed libs LDFLAGS += -Wl,--whole-archive $(eval $(call pkg_config_find_and_add,libnsfb,libnsfb)) LDFLAGS += -Wl,--no-whole-archive -# freetype is optional but does not use pkg-config -ifeq ($(NETSURF_FB_FONTLIB),freetype) - CFLAGS += -DFB_USE_FREETYPE $(shell freetype-config --cflags) - LDFLAGS += $(shell freetype-config --libs) -endif - # --------------------------------------------------------------------------- # HOST specific feature flags # --------------------------------------------------------------------------- -- cgit v1.2.3