0002-Use-pkg-config-to-detect-freetype.patch 2.18 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
From: Hideki Yamane <h-yamane@sios.com>
Date: Tue, 11 Dec 2018 15:42:16 +0900
Subject: Use pkg-config to detect freetype

---
 OMakefile | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/OMakefile b/OMakefile
index 7c5f3fe..dcafe62 100644
--- a/OMakefile
+++ b/OMakefile
@@ -88,7 +88,7 @@ print_configured() =
   println(exif:     $(get_support EXIF) \($(get_flags exif)\))
   println(tiff:     $(get_support TIFF) \($(get_flags tiff)\))
   println(xpm:      $(get_support XPM) \($(get_flags xpm)\))
-  println(freetype: $(get_support FREETYPE) \($(PATH_FREETYPE_CONFIG)\) \($(get_flags freetype)\))
+  println(freetype: $(get_support FREETYPE) \($(get_flags freetype)\))
   println(ps:       $(get_support PS) \($(PATH_GS)\))
   println(rgb.txt:  $(get_support RGB_TXT) \($(string $(PATH_RGB_TXT))\))
   println(lablgtk2: $(get_support LABLGTK2))
@@ -328,26 +328,19 @@ print_configured() =
   LDFLAGS_freetype=
   SUPPORT_FREETYPE=false 
   if $(true_if_not_defined ARG_WANT_FREETYPE)
-    PATH_FREETYPE_CONFIG=
-    if $(defined ARG_PATH_FREETYPE_CONFIG):
-        PATH_FREETYPE_CONFIG = $(ARG_PATH_FREETYPE_CONFIG)
-        SUPPORT_FREETYPE = true
-        export
-    else
-        PATH_FREETYPE_CONFIG = $(Check_prog_in_path freetype-config)
-        SUPPORT_FREETYPE=$(if $(PATH_FREETYPE_CONFIG), true, false)
+    res=$(pkg_config freetype, freetype2)
+    if $(not $(res))
+      HAVE_FREETYPE = $(Check_header_library freetype, freetype/freetype.h, FT_Library_Version)
+      SUPPORT_FREETYPE = $(HAVE_FREETYPE)
+      if $(SUPPORT_FREETYPE)
+        LDFLAGS_freetype=-lfreetype
         export
-    if $(SUPPORT_FREETYPE)
-      # println(SUPPORT_FREETYPE=$(SUPPORT_FREETYPE)!)
-      CFLAGS_freetype= $(shell $(PATH_FREETYPE_CONFIG) --cflags)
-      LDFLAGS_freetype= $(shell $(PATH_FREETYPE_CONFIG) --libs)
+      else
+        failwith_if_defined(ARG_WANT_FREETYPE, freetype requested but not found)
       export
     if $(SUPPORT_FREETYPE)
       SUPPORTED_NON_FORMATS+=freetype
       export
-    else
-      failwith_if_defined(ARG_WANT_FREETYPE, freetype requested but not found)
-    export
 
   SUPPORTED_SUBPACKAGES= $(SUPPORTED_FORMATS) $(SUPPORTED_NON_FORMATS)