Control: tag -1 patch

Dear maintainer,

greetings from the BSP in Karlsruhe.

Here's a patch for the configure script, teaching it to use pkg-config
for detecting the freetype library.

Cheers,
-Hilko
>From 354ca4e5dcb779ca3e2cd028d8815dbb0513a6bd Mon Sep 17 00:00:00 2001
From: Hilko Bengen <ben...@debian.org>
Date: Sat, 27 Oct 2018 00:07:58 +0200
Subject: [PATCH] Add patch to detect freetype2 via pkg-config (Closes:
 #892444)

---
 debian/patches/series                         |   1 +
 .../patches/use-pkg-config-for-freetype.patch | 106 ++++++++++++++++++
 2 files changed, 107 insertions(+)
 create mode 100644 debian/patches/use-pkg-config-for-freetype.patch

diff --git a/debian/patches/series b/debian/patches/series
index 0cd2622..ffde4ab 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 fix-silent-compilation.patch
+use-pkg-config-for-freetype.patch
diff --git a/debian/patches/use-pkg-config-for-freetype.patch b/debian/patches/use-pkg-config-for-freetype.patch
new file mode 100644
index 0000000..d646a42
--- /dev/null
+++ b/debian/patches/use-pkg-config-for-freetype.patch
@@ -0,0 +1,106 @@
+Index: ttfautohint/configure.ac
+===================================================================
+--- ttfautohint.orig/configure.ac
++++ ttfautohint/configure.ac
+@@ -123,96 +123,16 @@ AC_ARG_WITH([doc],
+             [],
+             [with_doc=yes])
+ 
+-AC_ARG_WITH([freetype-config],
+-            [AS_HELP_STRING([--with-freetype-config=PROG],
+-                            [use FreeType configuration program PROG])],
+-            [freetype_config=$withval],
+-            [freetype_config=yes])
+-
+-if test "$freetype_config" = "yes"; then
+-  AC_PATH_TOOL(ft_config,
+-               freetype-config,
+-               no)
+-  if test "$ft_config" = "no"; then
+-    AC_MSG_ERROR([FreeType library is missing; see http://www.freetype.org/])
+-  fi
+-else
+-  ft_config="$freetype_config"
+-fi
+-
+-FREETYPE_CPPFLAGS="`$ft_config --cflags`"
+-FREETYPE_LIBS="`$ft_config --libtool`"
+-
+-# many platforms no longer install .la files for system libraries
+-if test ! -f "$FREETYPE_LIBS"; then
+-  FREETYPE_LIBS="`$ft_config --libs`"
+-fi
++PKG_CHECK_MODULES(
++        [FREETYPE],
++        [freetype2 >= 2.4.5],
++        [FREETYPE_CPPFLAGS="$FREETYPE_CFLAGS"],
++        [AC_MSG_ERROR([Can't find Freetype library])])
+ 
+ AC_SUBST([FREETYPE_CPPFLAGS])
+ AC_SUBST([FREETYPE_LIBS])
+ 
+ 
+-AC_MSG_CHECKING([whether FreeType header files are version 2.4.5 or higher])
+-old_CPPFLAGS="$CPPFLAGS"
+-CPPFLAGS=$FREETYPE_CPPFLAGS
+-AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
+-
+-#include <ft2build.h>
+-#include FT_FREETYPE_H
+-#if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2004005
+-#error Freetype version too low.
+-#endif
+-
+-]])],
+-[AC_MSG_RESULT(yes)
+- CPPFLAGS="$old_CPPFLAGS"],
+-[AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])])
+-
+-
+-AC_MSG_CHECKING([whether FreeType library is version 2.4.5 or higher])
+-old_CPPFLAGS="$CPPFLAGS"
+-CPPFLAGS=$FREETYPE_CPPFLAGS
+-old_LIBS="$LIBS"
+-LIBS=$FREETYPE_LIBS
+-AC_LANG_PUSH([LTLIZED C])
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-
+-#include <stdlib.h>
+-#include <ft2build.h>
+-#include FT_FREETYPE_H
+-
+-int
+-main()
+-{
+-  FT_Error error;
+-  FT_Library library;
+-  FT_Int major, minor, patch;
+-
+-  error = FT_Init_FreeType(&library);
+-  if (error)
+-  {
+-    printf("(test program reports error code %d)... ", error);
+-    exit(EXIT_FAILURE);
+-  }
+-
+-  FT_Library_Version(library, &major, &minor, &patch);
+-
+-  printf("(found %d.%d.%d)... ", major, minor, patch);
+-
+-  if (((major*1000 + minor)*1000 + patch) >= 2004005)
+-    exit(EXIT_SUCCESS);
+-  exit(EXIT_FAILURE);
+-}
+-
+-]])],
+-[AC_MSG_RESULT(yes)
+- CPPFLAGS="$old_CPPFLAGS"
+- LIBS="$old_LIBS"],
+-[AC_MSG_ERROR([Need FreeType version 2.4.5 or higher])],
+-[AC_MSG_RESULT([skipped due to cross-compilation])])
+-AC_LANG_POP
+-
+-
+ if test $cross_compiling = no; then
+   AM_MISSING_PROG(HELP2MAN, help2man)
+ else
-- 
2.19.1

Reply via email to