add deprecated sys-boot/grub:0
[portage-squeep] / sys-boot / grub / files / 2.02-freetype-pkg-config.patch
1 From 3eec911197081a63d9dae28f1784ad01a06fb60a Mon Sep 17 00:00:00 2001
2 From: Colin Watson <cjwatson@ubuntu.com>
3 Date: Tue, 30 Jan 2018 21:54:17 +0000
4 Subject: build: Use pkg-config to find FreeType
5
6 pkg-config is apparently preferred over freetype-config these days (see
7 the BUGS section of freetype-config(1)). pkg-config support was added
8 to FreeType in version 2.1.5, which was released in 2003, so it should
9 comfortably be available everywhere by now.
10
11 We no longer need to explicitly substitute FREETYPE_CFLAGS and
12 FREETYPE_LIBS, since PKG_CHECK_MODULES does that automatically.
13
14 Fixes Debian bug #887721.
15
16 Reported-by: Hugh McMaster <hugh.mcmaster@outlook.com>
17 Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
18
19 Bug-Debian: https://bugs.debian.org/887721
20 Last-Update: 2018-02-11
21
22 Patch-Name: freetype-pkg-config.patch
23 ---
24 INSTALL | 11 +++++----
25 configure.ac | 74 +++++++++++++++++++++++++-----------------------------------
26 2 files changed, 37 insertions(+), 48 deletions(-)
27
28 diff --git a/INSTALL b/INSTALL
29 index f3c20edc8..b370d7753 100644
30 --- a/INSTALL
31 +++ b/INSTALL
32 @@ -37,6 +37,7 @@ configuring the GRUB.
33 * GNU gettext 0.17 or later
34 * GNU binutils 2.9.1.0.23 or later
35 * Flex 2.5.35 or later
36 +* pkg-config
37 * Other standard GNU/Unix tools
38 * a libc with large file support (e.g. glibc 2.1 or later)
39
40 @@ -52,7 +53,7 @@ For optional grub-emu features, you need:
41
42 To build GRUB's graphical terminal (gfxterm), you need:
43
44 -* FreeType 2 or later
45 +* FreeType 2.1.5 or later
46 * GNU Unifont
47
48 If you use a development snapshot or want to hack on GRUB you may
49 @@ -158,8 +159,8 @@ For this example the configure line might look like (more details below)
50 (some options are optional and included here for completeness but some rarely
51 used options are omitted):
52
53 -./configure BUILD_CC=gcc BUILD_FREETYPE=freetype-config --host=amd64-linux-gnu
54 -CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" FREETYPE=amd64-linux-gnu-freetype-config
55 +./configure BUILD_CC=gcc BUILD_PKG_CONFIG=pkg-config --host=amd64-linux-gnu
56 +CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" PKG_CONFIG=amd64-linux-gnu-pkg-config
57 --target=arm --with-platform=uboot TARGET_CC=arm-elf-gcc
58 TARGET_CFLAGS="-Os -march=armv6" TARGET_CCASFLAGS="-march=armv6"
59 TARGET_OBJCOPY="arm-elf-objcopy" TARGET_STRIP="arm-elf-strip"
60 @@ -176,7 +177,7 @@ corresponding platform are not needed for the platform in question.
61 2. BUILD_CFLAGS= for C options for build.
62 3. BUILD_CPPFLAGS= for C preprocessor options for build.
63 4. BUILD_LDFLAGS= for linker options for build.
64 - 5. BUILD_FREETYPE= for freetype-config for build (optional).
65 + 5. BUILD_PKG_CONFIG= for pkg-config for build (optional).
66
67 - For host
68 1. --host= to autoconf name of host.
69 @@ -184,7 +185,7 @@ corresponding platform are not needed for the platform in question.
70 3. HOST_CFLAGS= for C options for host.
71 4. HOST_CPPFLAGS= for C preprocessor options for host.
72 5. HOST_LDFLAGS= for linker options for host.
73 - 6. FREETYPE= for freetype-config for host (optional).
74 + 6. PKG_CONFIG= for pkg-config for host (optional).
75 7. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional).
76 8. Libfuse if any must be in standard linker folders (-lfuse) (optional).
77 9. Libzfs if any must be in standard linker folders (-lzfs) (optional).
78 diff --git a/configure.ac b/configure.ac
79 index 85c23bd62..f102b7024 100644
80 --- a/configure.ac
81 +++ b/configure.ac
82 @@ -50,6 +50,10 @@ AC_PREREQ(2.60)
83 AC_CONFIG_SRCDIR([include/grub/dl.h])
84 AC_CONFIG_HEADER([config-util.h])
85
86 +# Explicitly check for pkg-config early on, since otherwise conditional
87 +# calls are problematic.
88 +PKG_PROG_PKG_CONFIG
89 +
90 # Program name transformations
91 AC_ARG_PROGRAM
92 grub_TRANSFORM([grub-bios-setup])
93 @@ -1493,29 +1497,22 @@ if test x"$enable_grub_mkfont" = xno ; then
94 grub_mkfont_excuse="explicitly disabled"
95 fi
96
97 -if test x"$grub_mkfont_excuse" = x ; then
98 - # Check for freetype libraries.
99 - AC_CHECK_TOOLS([FREETYPE], [freetype-config])
100 - if test "x$FREETYPE" = x ; then
101 - grub_mkfont_excuse=["need freetype2 library"]
102 - fi
103 -fi
104 -
105 unset ac_cv_header_ft2build_h
106
107 if test x"$grub_mkfont_excuse" = x ; then
108 # Check for freetype libraries.
109 - FREETYPE_CFLAGS=`$FREETYPE --cflags`
110 - FREETYPE_LIBS=`$FREETYPE --libs`
111 - SAVED_CPPFLAGS="$CPPFLAGS"
112 - SAVED_LIBS="$LIBS"
113 - CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
114 - LIBS="$LIBS $FREETYPE_LIBS"
115 - AC_CHECK_HEADERS([ft2build.h], [],
116 - [grub_mkfont_excuse=["need freetype2 headers"]])
117 - AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_mkfont_excuse=["freetype2 library unusable"]])
118 - CPPFLAGS="$SAVED_CPPFLAGS"
119 - LIBS="$SAVED_LIBS"
120 + PKG_CHECK_MODULES([FREETYPE], [freetype2], [
121 + SAVED_CPPFLAGS="$CPPFLAGS"
122 + SAVED_LIBS="$LIBS"
123 + CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
124 + LIBS="$LIBS $FREETYPE_LIBS"
125 + AC_CHECK_HEADERS([ft2build.h], [],
126 + [grub_mkfont_excuse=["need freetype2 headers"]])
127 + AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [],
128 + [grub_mkfont_excuse=["freetype2 library unusable"]])
129 + CPPFLAGS="$SAVED_CPPFLAGS"
130 + LIBS="$SAVED_LIBS"
131 + ], [grub_mkfont_excuse=["need freetype2 library"]])
132 fi
133
134 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
135 @@ -1527,8 +1524,6 @@ else
136 enable_grub_mkfont=no
137 fi
138 AC_SUBST([enable_grub_mkfont])
139 -AC_SUBST([FREETYPE_CFLAGS])
140 -AC_SUBST([FREETYPE_LIBS])
141
142 SAVED_CC="$CC"
143 SAVED_CPP="$CPP"
144 @@ -1558,25 +1553,21 @@ AC_SUBST([BUILD_WORDS_BIGENDIAN])
145
146 if test x"$grub_build_mkfont_excuse" = x ; then
147 # Check for freetype libraries.
148 - AC_CHECK_PROGS([BUILD_FREETYPE], [freetype-config])
149 - if test "x$BUILD_FREETYPE" = x ; then
150 - grub_build_mkfont_excuse=["need freetype2 library"]
151 - fi
152 -fi
153 -
154 -if test x"$grub_build_mkfont_excuse" = x ; then
155 - # Check for freetype libraries.
156 - BUILD_FREETYPE_CFLAGS=`$BUILD_FREETYPE --cflags`
157 - BUILD_FREETYPE_LIBS=`$BUILD_FREETYPE --libs`
158 - SAVED_CPPFLAGS_2="$CPPFLAGS"
159 - SAVED_LIBS="$LIBS"
160 - CPPFLAGS="$CPPFLAGS $BUILD_FREETYPE_CFLAGS"
161 - LIBS="$LIBS $BUILD_FREETYPE_LIBS"
162 - AC_CHECK_HEADERS([ft2build.h], [],
163 - [grub_build_mkfont_excuse=["need freetype2 headers"]])
164 - AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_build_mkfont_excuse=["freetype2 library unusable"]])
165 - LIBS="$SAVED_LIBS"
166 - CPPFLAGS="$SAVED_CPPFLAGS_2"
167 + SAVED_PKG_CONFIG="$PKG_CONFIG"
168 + test -z "$BUILD_PKG_CONFIG" || PKG_CONFIG="$BUILD_PKG_CONFIG"
169 + PKG_CHECK_MODULES([BUILD_FREETYPE], [freetype2], [
170 + SAVED_CPPFLAGS_2="$CPPFLAGS"
171 + SAVED_LIBS="$LIBS"
172 + CPPFLAGS="$CPPFLAGS $BUILD_FREETYPE_CFLAGS"
173 + LIBS="$LIBS $BUILD_FREETYPE_LIBS"
174 + AC_CHECK_HEADERS([ft2build.h], [],
175 + [grub_build_mkfont_excuse=["need freetype2 headers"]])
176 + AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [],
177 + [grub_build_mkfont_excuse=["freetype2 library unusable"]])
178 + LIBS="$SAVED_LIBS"
179 + CPPFLAGS="$SAVED_CPPFLAGS_2"
180 + ], [grub_build_mkfont_excuse=["need freetype2 library"]])
181 + PKG_CONFIG="$SAVED_PKG_CONFIG"
182 fi
183
184 if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then
185 @@ -1595,9 +1586,6 @@ if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || tes
186 fi
187 fi
188
189 -AC_SUBST([BUILD_FREETYPE_CFLAGS])
190 -AC_SUBST([BUILD_FREETYPE_LIBS])
191 -
192 CC="$SAVED_CC"
193 CPP="$SAVED_CPP"
194 CFLAGS="$SAVED_CFLAGS"