All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] build: Use pkg-config to find Freetype
@ 2018-01-25 12:23 Colin Watson
  2018-01-29 17:35 ` Daniel Kiper
  0 siblings, 1 reply; 9+ messages in thread
From: Colin Watson @ 2018-01-25 12:23 UTC (permalink / raw)
  To: grub-devel

pkg-config is apparently preferred over freetype-config these days (see
the BUGS section of freetype-config(1)).  pkg-config support was added
to Freetype in version 2.1.5, which was released in 2003, so it should
comfortably be available everywhere by now.

Fixes Debian bug #887721.

Reported-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
---
 INSTALL           |  9 ++++---
 Makefile.am       |  6 ++---
 Makefile.util.def |  4 +--
 configure.ac      | 74 +++++++++++++++++++++++--------------------------------
 4 files changed, 41 insertions(+), 52 deletions(-)

diff --git a/INSTALL b/INSTALL
index f3c20edc8..899b9cac5 100644
--- a/INSTALL
+++ b/INSTALL
@@ -38,6 +38,7 @@ configuring the GRUB.
 * GNU binutils 2.9.1.0.23 or later
 * Flex 2.5.35 or later
 * Other standard GNU/Unix tools
+* pkg-config
 * a libc with large file support (e.g. glibc 2.1 or later)
 
 On GNU/Linux, you also need:
@@ -158,8 +159,8 @@ For this example the configure line might look like (more details below)
 (some options are optional and included here for completeness but some rarely
 used options are omitted):
 
-./configure BUILD_CC=gcc BUILD_FREETYPE=freetype-config --host=amd64-linux-gnu
-CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" FREETYPE=amd64-linux-gnu-freetype-config
+./configure BUILD_CC=gcc BUILD_PKG_CONFIG=pkg-config --host=amd64-linux-gnu
+CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" PKG_CONFIG=amd64-linux-gnu-pkg-config
 --target=arm --with-platform=uboot TARGET_CC=arm-elf-gcc
 TARGET_CFLAGS="-Os -march=armv6" TARGET_CCASFLAGS="-march=armv6"
 TARGET_OBJCOPY="arm-elf-objcopy" TARGET_STRIP="arm-elf-strip"
@@ -176,7 +177,7 @@ corresponding platform are not needed for the platform in question.
     2. BUILD_CFLAGS= for C options for build.
     3. BUILD_CPPFLAGS= for C preprocessor options for build.
     4. BUILD_LDFLAGS= for linker options for build.
-    5. BUILD_FREETYPE= for freetype-config for build (optional).
+    5. BUILD_PKG_CONFIG= for pkg-config for build (optional).
 
   - For host
     1. --host= to autoconf name of host.
@@ -184,7 +185,7 @@ corresponding platform are not needed for the platform in question.
     3. HOST_CFLAGS= for C options for host.
     4. HOST_CPPFLAGS= for C preprocessor options for host.
     5. HOST_LDFLAGS= for linker options for host.
-    6. FREETYPE= for freetype-config for host (optional).
+    6. PKG_CONFIG= for pkg-config for host (optional).
     7. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional).
     8. Libfuse if any must be in standard linker folders (-lfuse) (optional).
     9. Libzfs if any must be in standard linker folders (-lzfs) (optional).
diff --git a/Makefile.am b/Makefile.am
index 7795baeb6..da4e65bcc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -71,7 +71,7 @@ endif
 starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0
 
 build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
+	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_CFLAGS) $(build_freetype_LIBS)
 CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT)
 
 garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c
@@ -80,11 +80,11 @@ CLEANFILES += garbage-gen$(BUILD_EXEEXT)
 EXTRA_DIST += util/garbage-gen.c
 
 build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c
-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
+	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_CFLAGS) $(build_freetype_LIBS) -Wall -Werror
 CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT)
 
 build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c
-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
+	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_CFLAGS) $(build_freetype_LIBS) -Wall -Werror
 CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT)
 
 if COND_STARFIELD
diff --git a/Makefile.util.def b/Makefile.util.def
index f9caccb97..471b226c9 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -302,14 +302,14 @@ program = {
   common = grub-core/kern/emu/argp_common.c;
   common = grub-core/osdep/init.c;
 
-  cflags = '$(freetype_cflags)';
+  cflags = '$(freetype_CFLAGS)';
   cppflags = '-DGRUB_MKFONT=1';
 
   ldadd = libgrubmods.a;
   ldadd = libgrubgcry.a;
   ldadd = libgrubkern.a;
   ldadd = grub-core/gnulib/libgnu.a;
-  ldadd = '$(freetype_libs)';
+  ldadd = '$(freetype_LIBS)';
   ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
   condition = COND_GRUB_MKFONT;
 };
diff --git a/configure.ac b/configure.ac
index c7888e40f..4797c23df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,10 @@ AC_PREREQ(2.60)
 AC_CONFIG_SRCDIR([include/grub/dl.h])
 AC_CONFIG_HEADER([config-util.h])
 
+# Explicitly check for pkg-config early on, since otherwise conditional
+# calls are problematic.
+PKG_PROG_PKG_CONFIG
+
 # Program name transformations
 AC_ARG_PROGRAM
 grub_TRANSFORM([grub-bios-setup])
@@ -1508,29 +1512,22 @@ if test x"$enable_grub_mkfont" = xno ; then
   grub_mkfont_excuse="explicitly disabled"
 fi
 
-if test x"$grub_mkfont_excuse" = x ; then
-  # Check for freetype libraries.
-  AC_CHECK_TOOLS([FREETYPE], [freetype-config])
-  if test "x$FREETYPE" = x ; then
-    grub_mkfont_excuse=["need freetype2 library"]
-  fi
-fi
-
 unset ac_cv_header_ft2build_h
 
 if test x"$grub_mkfont_excuse" = x ; then
   # Check for freetype libraries.
-  freetype_cflags=`$FREETYPE --cflags`
-  freetype_libs=`$FREETYPE --libs`
-  SAVED_CPPFLAGS="$CPPFLAGS"
-  SAVED_LIBS="$LIBS"
-  CPPFLAGS="$CPPFLAGS $freetype_cflags"
-  LIBS="$LIBS $freetype_libs"
-  AC_CHECK_HEADERS([ft2build.h], [],
-  	[grub_mkfont_excuse=["need freetype2 headers"]])
-  AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_mkfont_excuse=["freetype2 library unusable"]])
-  CPPFLAGS="$SAVED_CPPFLAGS"
-  LIBS="$SAVED_LIBS"
+  PKG_CHECK_MODULES([freetype], [freetype2], [
+    SAVED_CPPFLAGS="$CPPFLAGS"
+    SAVED_LIBS="$LIBS"
+    CPPFLAGS="$CPPFLAGS $freetype_CFLAGS"
+    LIBS="$LIBS $freetype_LIBS"
+    AC_CHECK_HEADERS([ft2build.h], [],
+      [grub_mkfont_excuse=["need freetype2 headers"]])
+    AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [],
+      [grub_mkfont_excuse=["freetype2 library unusable"]])
+    CPPFLAGS="$SAVED_CPPFLAGS"
+    LIBS="$SAVED_LIBS"
+  ], [grub_mkfont_excuse=["need freetype2 library"]])
 fi
 
 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
@@ -1542,8 +1539,6 @@ else
 enable_grub_mkfont=no
 fi
 AC_SUBST([enable_grub_mkfont])
-AC_SUBST([freetype_cflags])
-AC_SUBST([freetype_libs])
 
 SAVED_CC="$CC"
 SAVED_CPP="$CPP"
@@ -1573,25 +1568,21 @@ AC_SUBST([BUILD_WORDS_BIGENDIAN])
 
 if test x"$grub_build_mkfont_excuse" = x ; then
   # Check for freetype libraries.
-  AC_CHECK_PROGS([BUILD_FREETYPE], [freetype-config])
-  if test "x$BUILD_FREETYPE" = x ; then
-    grub_build_mkfont_excuse=["need freetype2 library"]
-  fi
-fi
-
-if test x"$grub_build_mkfont_excuse" = x ; then
-  # Check for freetype libraries.
-  build_freetype_cflags=`$BUILD_FREETYPE --cflags`
-  build_freetype_libs=`$BUILD_FREETYPE --libs`
-  SAVED_CPPFLAGS_2="$CPPFLAGS"
-  SAVED_LIBS="$LIBS"
-  CPPFLAGS="$CPPFLAGS $build_freetype_cflags"
-  LIBS="$LIBS $build_freetype_libs"
-  AC_CHECK_HEADERS([ft2build.h], [],
-  	[grub_build_mkfont_excuse=["need freetype2 headers"]])
-  AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_build_mkfont_excuse=["freetype2 library unusable"]])
-  LIBS="$SAVED_LIBS"
-  CPPFLAGS="$SAVED_CPPFLAGS_2"
+  SAVED_PKG_CONFIG="$PKG_CONFIG"
+  test -z "$BUILD_PKG_CONFIG" || PKG_CONFIG="$BUILD_PKG_CONFIG"
+  PKG_CHECK_MODULES([build_freetype], [freetype2], [
+    SAVED_CPPFLAGS_2="$CPPFLAGS"
+    SAVED_LIBS="$LIBS"
+    CPPFLAGS="$CPPFLAGS $build_freetype_CFLAGS"
+    LIBS="$LIBS $build_freetype_LIBS"
+    AC_CHECK_HEADERS([ft2build.h], [],
+      [grub_build_mkfont_excuse=["need freetype2 headers"]])
+    AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [],
+      [grub_build_mkfont_excuse=["freetype2 library unusable"]])
+    LIBS="$SAVED_LIBS"
+    CPPFLAGS="$SAVED_CPPFLAGS_2"
+  ], [grub_build_mkfont_excuse=["need freetype2 library"]])
+  PKG_CONFIG="$SAVED_PKG_CONFIG"
 fi
 
 if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then
@@ -1610,9 +1601,6 @@ if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || tes
   fi
 fi
 
-AC_SUBST([build_freetype_cflags])
-AC_SUBST([build_freetype_libs])
-
 CC="$SAVED_CC"
 CPP="$SAVED_CPP"
 CFLAGS="$SAVED_CFLAGS"
-- 
2.15.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] build: Use pkg-config to find Freetype
  2018-01-25 12:23 [PATCH] build: Use pkg-config to find Freetype Colin Watson
@ 2018-01-29 17:35 ` Daniel Kiper
  2018-01-30 21:57   ` Colin Watson
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Daniel Kiper @ 2018-01-29 17:35 UTC (permalink / raw)
  To: cjwatson; +Cc: grub-devel

On Thu, Jan 25, 2018 at 12:23:58PM +0000, Colin Watson wrote:
> pkg-config is apparently preferred over freetype-config these days (see
> the BUGS section of freetype-config(1)).  pkg-config support was added
> to Freetype in version 2.1.5, which was released in 2003, so it should

OK but please add somewhere into INSTALL that starting from this patch
Freetype 2.1.5 and newer are only supported versions.

> comfortably be available everywhere by now.
>
> Fixes Debian bug #887721.
>
> Reported-by: Hugh McMaster <hugh.mcmaster@outlook.com>
> Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
> ---
>  INSTALL           |  9 ++++---
>  Makefile.am       |  6 ++---
>  Makefile.util.def |  4 +--
>  configure.ac      | 74 +++++++++++++++++++++++--------------------------------
>  4 files changed, 41 insertions(+), 52 deletions(-)
>
> diff --git a/INSTALL b/INSTALL
> index f3c20edc8..899b9cac5 100644
> --- a/INSTALL
> +++ b/INSTALL
> @@ -38,6 +38,7 @@ configuring the GRUB.
>  * GNU binutils 2.9.1.0.23 or later
>  * Flex 2.5.35 or later
>  * Other standard GNU/Unix tools
> +* pkg-config

Please put this after Flex.

>  * a libc with large file support (e.g. glibc 2.1 or later)
>
>  On GNU/Linux, you also need:
> @@ -158,8 +159,8 @@ For this example the configure line might look like (more details below)
>  (some options are optional and included here for completeness but some rarely
>  used options are omitted):
>
> -./configure BUILD_CC=gcc BUILD_FREETYPE=freetype-config --host=amd64-linux-gnu
> -CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" FREETYPE=amd64-linux-gnu-freetype-config
> +./configure BUILD_CC=gcc BUILD_PKG_CONFIG=pkg-config --host=amd64-linux-gnu
> +CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" PKG_CONFIG=amd64-linux-gnu-pkg-config
>  --target=arm --with-platform=uboot TARGET_CC=arm-elf-gcc
>  TARGET_CFLAGS="-Os -march=armv6" TARGET_CCASFLAGS="-march=armv6"
>  TARGET_OBJCOPY="arm-elf-objcopy" TARGET_STRIP="arm-elf-strip"
> @@ -176,7 +177,7 @@ corresponding platform are not needed for the platform in question.
>      2. BUILD_CFLAGS= for C options for build.
>      3. BUILD_CPPFLAGS= for C preprocessor options for build.
>      4. BUILD_LDFLAGS= for linker options for build.
> -    5. BUILD_FREETYPE= for freetype-config for build (optional).
> +    5. BUILD_PKG_CONFIG= for pkg-config for build (optional).
>
>    - For host
>      1. --host= to autoconf name of host.
> @@ -184,7 +185,7 @@ corresponding platform are not needed for the platform in question.
>      3. HOST_CFLAGS= for C options for host.
>      4. HOST_CPPFLAGS= for C preprocessor options for host.
>      5. HOST_LDFLAGS= for linker options for host.
> -    6. FREETYPE= for freetype-config for host (optional).
> +    6. PKG_CONFIG= for pkg-config for host (optional).
>      7. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional).
>      8. Libfuse if any must be in standard linker folders (-lfuse) (optional).
>      9. Libzfs if any must be in standard linker folders (-lzfs) (optional).
> diff --git a/Makefile.am b/Makefile.am
> index 7795baeb6..da4e65bcc 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -71,7 +71,7 @@ endif
>  starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0
>
>  build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
> -	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
> +	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_CFLAGS) $(build_freetype_LIBS)
>  CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT)
>
>  garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c
> @@ -80,11 +80,11 @@ CLEANFILES += garbage-gen$(BUILD_EXEEXT)
>  EXTRA_DIST += util/garbage-gen.c
>
>  build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c
> -	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
> +	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_CFLAGS) $(build_freetype_LIBS) -Wall -Werror
>  CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT)
>
>  build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c
> -	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
> +	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_CFLAGS) $(build_freetype_LIBS) -Wall -Werror
>  CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT)
>
>  if COND_STARFIELD
> diff --git a/Makefile.util.def b/Makefile.util.def
> index f9caccb97..471b226c9 100644
> --- a/Makefile.util.def
> +++ b/Makefile.util.def
> @@ -302,14 +302,14 @@ program = {
>    common = grub-core/kern/emu/argp_common.c;
>    common = grub-core/osdep/init.c;
>
> -  cflags = '$(freetype_cflags)';
> +  cflags = '$(freetype_CFLAGS)';

May I ask you to this change in separate patch?
And please use FREETYPE_CFLAGS instead of freetype_CFLAGS.

>    cppflags = '-DGRUB_MKFONT=1';
>
>    ldadd = libgrubmods.a;
>    ldadd = libgrubgcry.a;
>    ldadd = libgrubkern.a;
>    ldadd = grub-core/gnulib/libgnu.a;
> -  ldadd = '$(freetype_libs)';
> +  ldadd = '$(freetype_LIBS)';

Same as above... And of course s/freetype_LIBS/FREETYPE_LIBS/

>    ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
>    condition = COND_GRUB_MKFONT;
>  };
> diff --git a/configure.ac b/configure.ac
> index c7888e40f..4797c23df 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -50,6 +50,10 @@ AC_PREREQ(2.60)
>  AC_CONFIG_SRCDIR([include/grub/dl.h])
>  AC_CONFIG_HEADER([config-util.h])
>
> +# Explicitly check for pkg-config early on, since otherwise conditional
> +# calls are problematic.
> +PKG_PROG_PKG_CONFIG
> +
>  # Program name transformations
>  AC_ARG_PROGRAM
>  grub_TRANSFORM([grub-bios-setup])
> @@ -1508,29 +1512,22 @@ if test x"$enable_grub_mkfont" = xno ; then
>    grub_mkfont_excuse="explicitly disabled"
>  fi
>
> -if test x"$grub_mkfont_excuse" = x ; then
> -  # Check for freetype libraries.
> -  AC_CHECK_TOOLS([FREETYPE], [freetype-config])
> -  if test "x$FREETYPE" = x ; then
> -    grub_mkfont_excuse=["need freetype2 library"]
> -  fi
> -fi
> -
>  unset ac_cv_header_ft2build_h
>
>  if test x"$grub_mkfont_excuse" = x ; then
>    # Check for freetype libraries.
> -  freetype_cflags=`$FREETYPE --cflags`
> -  freetype_libs=`$FREETYPE --libs`
> -  SAVED_CPPFLAGS="$CPPFLAGS"
> -  SAVED_LIBS="$LIBS"
> -  CPPFLAGS="$CPPFLAGS $freetype_cflags"
> -  LIBS="$LIBS $freetype_libs"
> -  AC_CHECK_HEADERS([ft2build.h], [],
> -  	[grub_mkfont_excuse=["need freetype2 headers"]])
> -  AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_mkfont_excuse=["freetype2 library unusable"]])
> -  CPPFLAGS="$SAVED_CPPFLAGS"
> -  LIBS="$SAVED_LIBS"
> +  PKG_CHECK_MODULES([freetype], [freetype2], [
> +    SAVED_CPPFLAGS="$CPPFLAGS"
> +    SAVED_LIBS="$LIBS"
> +    CPPFLAGS="$CPPFLAGS $freetype_CFLAGS"
> +    LIBS="$LIBS $freetype_LIBS"
> +    AC_CHECK_HEADERS([ft2build.h], [],
> +      [grub_mkfont_excuse=["need freetype2 headers"]])
> +    AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [],
> +      [grub_mkfont_excuse=["freetype2 library unusable"]])
> +    CPPFLAGS="$SAVED_CPPFLAGS"
> +    LIBS="$SAVED_LIBS"
> +  ], [grub_mkfont_excuse=["need freetype2 library"]])
>  fi
>
>  if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
> @@ -1542,8 +1539,6 @@ else
>  enable_grub_mkfont=no
>  fi
>  AC_SUBST([enable_grub_mkfont])
> -AC_SUBST([freetype_cflags])
> -AC_SUBST([freetype_libs])

Could you explain why do you drop this...

>  SAVED_CC="$CC"
>  SAVED_CPP="$CPP"
> @@ -1573,25 +1568,21 @@ AC_SUBST([BUILD_WORDS_BIGENDIAN])
>
>  if test x"$grub_build_mkfont_excuse" = x ; then
>    # Check for freetype libraries.
> -  AC_CHECK_PROGS([BUILD_FREETYPE], [freetype-config])
> -  if test "x$BUILD_FREETYPE" = x ; then
> -    grub_build_mkfont_excuse=["need freetype2 library"]
> -  fi
> -fi
> -
> -if test x"$grub_build_mkfont_excuse" = x ; then
> -  # Check for freetype libraries.
> -  build_freetype_cflags=`$BUILD_FREETYPE --cflags`
> -  build_freetype_libs=`$BUILD_FREETYPE --libs`
> -  SAVED_CPPFLAGS_2="$CPPFLAGS"
> -  SAVED_LIBS="$LIBS"
> -  CPPFLAGS="$CPPFLAGS $build_freetype_cflags"
> -  LIBS="$LIBS $build_freetype_libs"
> -  AC_CHECK_HEADERS([ft2build.h], [],
> -  	[grub_build_mkfont_excuse=["need freetype2 headers"]])
> -  AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_build_mkfont_excuse=["freetype2 library unusable"]])
> -  LIBS="$SAVED_LIBS"
> -  CPPFLAGS="$SAVED_CPPFLAGS_2"
> +  SAVED_PKG_CONFIG="$PKG_CONFIG"
> +  test -z "$BUILD_PKG_CONFIG" || PKG_CONFIG="$BUILD_PKG_CONFIG"
> +  PKG_CHECK_MODULES([build_freetype], [freetype2], [
> +    SAVED_CPPFLAGS_2="$CPPFLAGS"
> +    SAVED_LIBS="$LIBS"
> +    CPPFLAGS="$CPPFLAGS $build_freetype_CFLAGS"
> +    LIBS="$LIBS $build_freetype_LIBS"
> +    AC_CHECK_HEADERS([ft2build.h], [],
> +      [grub_build_mkfont_excuse=["need freetype2 headers"]])
> +    AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [],
> +      [grub_build_mkfont_excuse=["freetype2 library unusable"]])
> +    LIBS="$SAVED_LIBS"
> +    CPPFLAGS="$SAVED_CPPFLAGS_2"
> +  ], [grub_build_mkfont_excuse=["need freetype2 library"]])
> +  PKG_CONFIG="$SAVED_PKG_CONFIG"
>  fi
>
>  if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then
> @@ -1610,9 +1601,6 @@ if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || tes
>    fi
>  fi
>
> -AC_SUBST([build_freetype_cflags])
> -AC_SUBST([build_freetype_libs])

...and this?

Daniel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] build: Use pkg-config to find Freetype
  2018-01-29 17:35 ` Daniel Kiper
@ 2018-01-30 21:57   ` Colin Watson
  2018-02-10 15:37     ` Colin Watson
  2018-01-30 21:58   ` [PATCH v2 1/2] build: Capitalise *freetype_* variables Colin Watson
  2018-01-30 21:59   ` [PATCH v2 2/2] build: Use pkg-config to find FreeType Colin Watson
  2 siblings, 1 reply; 9+ messages in thread
From: Colin Watson @ 2018-01-30 21:57 UTC (permalink / raw)
  To: grub-devel

On Mon, Jan 29, 2018 at 06:35:11PM +0100, Daniel Kiper wrote:
> On Thu, Jan 25, 2018 at 12:23:58PM +0000, Colin Watson wrote:
> > @@ -1542,8 +1539,6 @@ else
> >  enable_grub_mkfont=no
> >  fi
> >  AC_SUBST([enable_grub_mkfont])
> > -AC_SUBST([freetype_cflags])
> > -AC_SUBST([freetype_libs])
> 
> Could you explain why do you drop this...

PKG_CHECK_MODULES does this (and is documented to do so), so there's no
need to do it manually.  Same for BUILD_FREETYPE_{CFLAGS,LIBS}.

Thanks for your other comments; I'll follow up in a moment with
corrected patches.

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/2] build: Capitalise *freetype_* variables
  2018-01-29 17:35 ` Daniel Kiper
  2018-01-30 21:57   ` Colin Watson
@ 2018-01-30 21:58   ` Colin Watson
  2018-09-19 14:22     ` Daniel Kiper
  2018-01-30 21:59   ` [PATCH v2 2/2] build: Use pkg-config to find FreeType Colin Watson
  2 siblings, 1 reply; 9+ messages in thread
From: Colin Watson @ 2018-01-30 21:58 UTC (permalink / raw)
  To: grub-devel

Using FREETYPE_CFLAGS and FREETYPE_LIBS is more in line with the naming
scheme used by pkg-config macros.
---
 Makefile.am       |  6 +++---
 Makefile.util.def |  4 ++--
 configure.ac      | 24 ++++++++++++------------
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 7795bae..a52a998 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -71,7 +71,7 @@ endif
 starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0
 
 build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
+	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(BUILD_FREETYPE_CFLAGS) $(BUILD_FREETYPE_LIBS)
 CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT)
 
 garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c
@@ -80,11 +80,11 @@ CLEANFILES += garbage-gen$(BUILD_EXEEXT)
 EXTRA_DIST += util/garbage-gen.c
 
 build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c
-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
+	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(BUILD_FREETYPE_CFLAGS) $(BUILD_FREETYPE_LIBS) -Wall -Werror
 CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT)
 
 build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c
-	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
+	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(BUILD_FREETYPE_CFLAGS) $(BUILD_FREETYPE_LIBS) -Wall -Werror
 CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT)
 
 if COND_STARFIELD
diff --git a/Makefile.util.def b/Makefile.util.def
index f9caccb..aac14b7 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -302,14 +302,14 @@ program = {
   common = grub-core/kern/emu/argp_common.c;
   common = grub-core/osdep/init.c;
 
-  cflags = '$(freetype_cflags)';
+  cflags = '$(FREETYPE_CFLAGS)';
   cppflags = '-DGRUB_MKFONT=1';
 
   ldadd = libgrubmods.a;
   ldadd = libgrubgcry.a;
   ldadd = libgrubkern.a;
   ldadd = grub-core/gnulib/libgnu.a;
-  ldadd = '$(freetype_libs)';
+  ldadd = '$(FREETYPE_LIBS)';
   ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
   condition = COND_GRUB_MKFONT;
 };
diff --git a/configure.ac b/configure.ac
index c7888e4..095b0de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1520,12 +1520,12 @@ unset ac_cv_header_ft2build_h
 
 if test x"$grub_mkfont_excuse" = x ; then
   # Check for freetype libraries.
-  freetype_cflags=`$FREETYPE --cflags`
-  freetype_libs=`$FREETYPE --libs`
+  FREETYPE_CFLAGS=`$FREETYPE --cflags`
+  FREETYPE_LIBS=`$FREETYPE --libs`
   SAVED_CPPFLAGS="$CPPFLAGS"
   SAVED_LIBS="$LIBS"
-  CPPFLAGS="$CPPFLAGS $freetype_cflags"
-  LIBS="$LIBS $freetype_libs"
+  CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
+  LIBS="$LIBS $FREETYPE_LIBS"
   AC_CHECK_HEADERS([ft2build.h], [],
   	[grub_mkfont_excuse=["need freetype2 headers"]])
   AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_mkfont_excuse=["freetype2 library unusable"]])
@@ -1542,8 +1542,8 @@ else
 enable_grub_mkfont=no
 fi
 AC_SUBST([enable_grub_mkfont])
-AC_SUBST([freetype_cflags])
-AC_SUBST([freetype_libs])
+AC_SUBST([FREETYPE_CFLAGS])
+AC_SUBST([FREETYPE_LIBS])
 
 SAVED_CC="$CC"
 SAVED_CPP="$CPP"
@@ -1581,12 +1581,12 @@ fi
 
 if test x"$grub_build_mkfont_excuse" = x ; then
   # Check for freetype libraries.
-  build_freetype_cflags=`$BUILD_FREETYPE --cflags`
-  build_freetype_libs=`$BUILD_FREETYPE --libs`
+  BUILD_FREETYPE_CFLAGS=`$BUILD_FREETYPE --cflags`
+  BUILD_FREETYPE_LIBS=`$BUILD_FREETYPE --libs`
   SAVED_CPPFLAGS_2="$CPPFLAGS"
   SAVED_LIBS="$LIBS"
-  CPPFLAGS="$CPPFLAGS $build_freetype_cflags"
-  LIBS="$LIBS $build_freetype_libs"
+  CPPFLAGS="$CPPFLAGS $BUILD_FREETYPE_CFLAGS"
+  LIBS="$LIBS $BUILD_FREETYPE_LIBS"
   AC_CHECK_HEADERS([ft2build.h], [],
   	[grub_build_mkfont_excuse=["need freetype2 headers"]])
   AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_build_mkfont_excuse=["freetype2 library unusable"]])
@@ -1610,8 +1610,8 @@ if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || tes
   fi
 fi
 
-AC_SUBST([build_freetype_cflags])
-AC_SUBST([build_freetype_libs])
+AC_SUBST([BUILD_FREETYPE_CFLAGS])
+AC_SUBST([BUILD_FREETYPE_LIBS])
 
 CC="$SAVED_CC"
 CPP="$SAVED_CPP"
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/2] build: Use pkg-config to find FreeType
  2018-01-29 17:35 ` Daniel Kiper
  2018-01-30 21:57   ` Colin Watson
  2018-01-30 21:58   ` [PATCH v2 1/2] build: Capitalise *freetype_* variables Colin Watson
@ 2018-01-30 21:59   ` Colin Watson
  2018-09-19 14:26     ` Daniel Kiper
  2 siblings, 1 reply; 9+ messages in thread
From: Colin Watson @ 2018-01-30 21:59 UTC (permalink / raw)
  To: grub-devel

pkg-config is apparently preferred over freetype-config these days (see
the BUGS section of freetype-config(1)).  pkg-config support was added
to FreeType in version 2.1.5, which was released in 2003, so it should
comfortably be available everywhere by now.

We no longer need to explicitly substitute FREETYPE_CFLAGS and
FREETYPE_LIBS, since PKG_CHECK_MODULES does that automatically.

Fixes Debian bug #887721.

Reported-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
---
 INSTALL      | 11 +++++----
 configure.ac | 74 +++++++++++++++++++++++++-----------------------------------
 2 files changed, 37 insertions(+), 48 deletions(-)

diff --git a/INSTALL b/INSTALL
index f3c20ed..b370d77 100644
--- a/INSTALL
+++ b/INSTALL
@@ -37,6 +37,7 @@ configuring the GRUB.
 * GNU gettext 0.17 or later
 * GNU binutils 2.9.1.0.23 or later
 * Flex 2.5.35 or later
+* pkg-config
 * Other standard GNU/Unix tools
 * a libc with large file support (e.g. glibc 2.1 or later)
 
@@ -52,7 +53,7 @@ For optional grub-emu features, you need:
 
 To build GRUB's graphical terminal (gfxterm), you need:
 
-* FreeType 2 or later
+* FreeType 2.1.5 or later
 * GNU Unifont
 
 If you use a development snapshot or want to hack on GRUB you may
@@ -158,8 +159,8 @@ For this example the configure line might look like (more details below)
 (some options are optional and included here for completeness but some rarely
 used options are omitted):
 
-./configure BUILD_CC=gcc BUILD_FREETYPE=freetype-config --host=amd64-linux-gnu
-CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" FREETYPE=amd64-linux-gnu-freetype-config
+./configure BUILD_CC=gcc BUILD_PKG_CONFIG=pkg-config --host=amd64-linux-gnu
+CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" PKG_CONFIG=amd64-linux-gnu-pkg-config
 --target=arm --with-platform=uboot TARGET_CC=arm-elf-gcc
 TARGET_CFLAGS="-Os -march=armv6" TARGET_CCASFLAGS="-march=armv6"
 TARGET_OBJCOPY="arm-elf-objcopy" TARGET_STRIP="arm-elf-strip"
@@ -176,7 +177,7 @@ corresponding platform are not needed for the platform in question.
     2. BUILD_CFLAGS= for C options for build.
     3. BUILD_CPPFLAGS= for C preprocessor options for build.
     4. BUILD_LDFLAGS= for linker options for build.
-    5. BUILD_FREETYPE= for freetype-config for build (optional).
+    5. BUILD_PKG_CONFIG= for pkg-config for build (optional).
 
   - For host
     1. --host= to autoconf name of host.
@@ -184,7 +185,7 @@ corresponding platform are not needed for the platform in question.
     3. HOST_CFLAGS= for C options for host.
     4. HOST_CPPFLAGS= for C preprocessor options for host.
     5. HOST_LDFLAGS= for linker options for host.
-    6. FREETYPE= for freetype-config for host (optional).
+    6. PKG_CONFIG= for pkg-config for host (optional).
     7. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional).
     8. Libfuse if any must be in standard linker folders (-lfuse) (optional).
     9. Libzfs if any must be in standard linker folders (-lzfs) (optional).
diff --git a/configure.ac b/configure.ac
index 095b0de..6f1adf4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,10 @@ AC_PREREQ(2.60)
 AC_CONFIG_SRCDIR([include/grub/dl.h])
 AC_CONFIG_HEADER([config-util.h])
 
+# Explicitly check for pkg-config early on, since otherwise conditional
+# calls are problematic.
+PKG_PROG_PKG_CONFIG
+
 # Program name transformations
 AC_ARG_PROGRAM
 grub_TRANSFORM([grub-bios-setup])
@@ -1508,29 +1512,22 @@ if test x"$enable_grub_mkfont" = xno ; then
   grub_mkfont_excuse="explicitly disabled"
 fi
 
-if test x"$grub_mkfont_excuse" = x ; then
-  # Check for freetype libraries.
-  AC_CHECK_TOOLS([FREETYPE], [freetype-config])
-  if test "x$FREETYPE" = x ; then
-    grub_mkfont_excuse=["need freetype2 library"]
-  fi
-fi
-
 unset ac_cv_header_ft2build_h
 
 if test x"$grub_mkfont_excuse" = x ; then
   # Check for freetype libraries.
-  FREETYPE_CFLAGS=`$FREETYPE --cflags`
-  FREETYPE_LIBS=`$FREETYPE --libs`
-  SAVED_CPPFLAGS="$CPPFLAGS"
-  SAVED_LIBS="$LIBS"
-  CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
-  LIBS="$LIBS $FREETYPE_LIBS"
-  AC_CHECK_HEADERS([ft2build.h], [],
-  	[grub_mkfont_excuse=["need freetype2 headers"]])
-  AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_mkfont_excuse=["freetype2 library unusable"]])
-  CPPFLAGS="$SAVED_CPPFLAGS"
-  LIBS="$SAVED_LIBS"
+  PKG_CHECK_MODULES([FREETYPE], [freetype2], [
+    SAVED_CPPFLAGS="$CPPFLAGS"
+    SAVED_LIBS="$LIBS"
+    CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
+    LIBS="$LIBS $FREETYPE_LIBS"
+    AC_CHECK_HEADERS([ft2build.h], [],
+      [grub_mkfont_excuse=["need freetype2 headers"]])
+    AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [],
+      [grub_mkfont_excuse=["freetype2 library unusable"]])
+    CPPFLAGS="$SAVED_CPPFLAGS"
+    LIBS="$SAVED_LIBS"
+  ], [grub_mkfont_excuse=["need freetype2 library"]])
 fi
 
 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
@@ -1542,8 +1539,6 @@ else
 enable_grub_mkfont=no
 fi
 AC_SUBST([enable_grub_mkfont])
-AC_SUBST([FREETYPE_CFLAGS])
-AC_SUBST([FREETYPE_LIBS])
 
 SAVED_CC="$CC"
 SAVED_CPP="$CPP"
@@ -1573,25 +1568,21 @@ AC_SUBST([BUILD_WORDS_BIGENDIAN])
 
 if test x"$grub_build_mkfont_excuse" = x ; then
   # Check for freetype libraries.
-  AC_CHECK_PROGS([BUILD_FREETYPE], [freetype-config])
-  if test "x$BUILD_FREETYPE" = x ; then
-    grub_build_mkfont_excuse=["need freetype2 library"]
-  fi
-fi
-
-if test x"$grub_build_mkfont_excuse" = x ; then
-  # Check for freetype libraries.
-  BUILD_FREETYPE_CFLAGS=`$BUILD_FREETYPE --cflags`
-  BUILD_FREETYPE_LIBS=`$BUILD_FREETYPE --libs`
-  SAVED_CPPFLAGS_2="$CPPFLAGS"
-  SAVED_LIBS="$LIBS"
-  CPPFLAGS="$CPPFLAGS $BUILD_FREETYPE_CFLAGS"
-  LIBS="$LIBS $BUILD_FREETYPE_LIBS"
-  AC_CHECK_HEADERS([ft2build.h], [],
-  	[grub_build_mkfont_excuse=["need freetype2 headers"]])
-  AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_build_mkfont_excuse=["freetype2 library unusable"]])
-  LIBS="$SAVED_LIBS"
-  CPPFLAGS="$SAVED_CPPFLAGS_2"
+  SAVED_PKG_CONFIG="$PKG_CONFIG"
+  test -z "$BUILD_PKG_CONFIG" || PKG_CONFIG="$BUILD_PKG_CONFIG"
+  PKG_CHECK_MODULES([BUILD_FREETYPE], [freetype2], [
+    SAVED_CPPFLAGS_2="$CPPFLAGS"
+    SAVED_LIBS="$LIBS"
+    CPPFLAGS="$CPPFLAGS $BUILD_FREETYPE_CFLAGS"
+    LIBS="$LIBS $BUILD_FREETYPE_LIBS"
+    AC_CHECK_HEADERS([ft2build.h], [],
+      [grub_build_mkfont_excuse=["need freetype2 headers"]])
+    AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [],
+      [grub_build_mkfont_excuse=["freetype2 library unusable"]])
+    LIBS="$SAVED_LIBS"
+    CPPFLAGS="$SAVED_CPPFLAGS_2"
+  ], [grub_build_mkfont_excuse=["need freetype2 library"]])
+  PKG_CONFIG="$SAVED_PKG_CONFIG"
 fi
 
 if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then
@@ -1610,9 +1601,6 @@ if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || tes
   fi
 fi
 
-AC_SUBST([BUILD_FREETYPE_CFLAGS])
-AC_SUBST([BUILD_FREETYPE_LIBS])
-
 CC="$SAVED_CC"
 CPP="$SAVED_CPP"
 CFLAGS="$SAVED_CFLAGS"
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] build: Use pkg-config to find Freetype
  2018-01-30 21:57   ` Colin Watson
@ 2018-02-10 15:37     ` Colin Watson
  0 siblings, 0 replies; 9+ messages in thread
From: Colin Watson @ 2018-02-10 15:37 UTC (permalink / raw)
  To: grub-devel

On Tue, Jan 30, 2018 at 09:57:15PM +0000, Colin Watson wrote:
> Thanks for your other comments; I'll follow up in a moment with
> corrected patches.

Has anyone had a chance to review these?  I'd be happy to deal with
actually committing them if they look OK.

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] build: Capitalise *freetype_* variables
  2018-01-30 21:58   ` [PATCH v2 1/2] build: Capitalise *freetype_* variables Colin Watson
@ 2018-09-19 14:22     ` Daniel Kiper
  2018-09-19 15:06       ` Colin Watson
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Kiper @ 2018-09-19 14:22 UTC (permalink / raw)
  To: cjwatson; +Cc: grub-devel

Ugh... This and another patch somehow dropped off from my radar.
It reappeared during recent mailbox cleanup. Sorry about that.

Anyway, Colin, may I add your SOB? If yes then

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel

On Tue, Jan 30, 2018 at 09:58:53PM +0000, Colin Watson wrote:
> Using FREETYPE_CFLAGS and FREETYPE_LIBS is more in line with the naming
> scheme used by pkg-config macros.
> ---
>  Makefile.am       |  6 +++---
>  Makefile.util.def |  4 ++--
>  configure.ac      | 24 ++++++++++++------------
>  3 files changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/Makefile.am b/Makefile.am
> index 7795bae..a52a998 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -71,7 +71,7 @@ endif
>  starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0
>
>  build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
> -	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
> +	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(BUILD_FREETYPE_CFLAGS) $(BUILD_FREETYPE_LIBS)
>  CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT)
>
>  garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c
> @@ -80,11 +80,11 @@ CLEANFILES += garbage-gen$(BUILD_EXEEXT)
>  EXTRA_DIST += util/garbage-gen.c
>
>  build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c
> -	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
> +	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(BUILD_FREETYPE_CFLAGS) $(BUILD_FREETYPE_LIBS) -Wall -Werror
>  CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT)
>
>  build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c
> -	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
> +	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(BUILD_FREETYPE_CFLAGS) $(BUILD_FREETYPE_LIBS) -Wall -Werror
>  CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT)
>
>  if COND_STARFIELD
> diff --git a/Makefile.util.def b/Makefile.util.def
> index f9caccb..aac14b7 100644
> --- a/Makefile.util.def
> +++ b/Makefile.util.def
> @@ -302,14 +302,14 @@ program = {
>    common = grub-core/kern/emu/argp_common.c;
>    common = grub-core/osdep/init.c;
>
> -  cflags = '$(freetype_cflags)';
> +  cflags = '$(FREETYPE_CFLAGS)';
>    cppflags = '-DGRUB_MKFONT=1';
>
>    ldadd = libgrubmods.a;
>    ldadd = libgrubgcry.a;
>    ldadd = libgrubkern.a;
>    ldadd = grub-core/gnulib/libgnu.a;
> -  ldadd = '$(freetype_libs)';
> +  ldadd = '$(FREETYPE_LIBS)';
>    ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
>    condition = COND_GRUB_MKFONT;
>  };
> diff --git a/configure.ac b/configure.ac
> index c7888e4..095b0de 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1520,12 +1520,12 @@ unset ac_cv_header_ft2build_h
>
>  if test x"$grub_mkfont_excuse" = x ; then
>    # Check for freetype libraries.
> -  freetype_cflags=`$FREETYPE --cflags`
> -  freetype_libs=`$FREETYPE --libs`
> +  FREETYPE_CFLAGS=`$FREETYPE --cflags`
> +  FREETYPE_LIBS=`$FREETYPE --libs`
>    SAVED_CPPFLAGS="$CPPFLAGS"
>    SAVED_LIBS="$LIBS"
> -  CPPFLAGS="$CPPFLAGS $freetype_cflags"
> -  LIBS="$LIBS $freetype_libs"
> +  CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
> +  LIBS="$LIBS $FREETYPE_LIBS"
>    AC_CHECK_HEADERS([ft2build.h], [],
>    	[grub_mkfont_excuse=["need freetype2 headers"]])
>    AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_mkfont_excuse=["freetype2 library unusable"]])
> @@ -1542,8 +1542,8 @@ else
>  enable_grub_mkfont=no
>  fi
>  AC_SUBST([enable_grub_mkfont])
> -AC_SUBST([freetype_cflags])
> -AC_SUBST([freetype_libs])
> +AC_SUBST([FREETYPE_CFLAGS])
> +AC_SUBST([FREETYPE_LIBS])
>
>  SAVED_CC="$CC"
>  SAVED_CPP="$CPP"
> @@ -1581,12 +1581,12 @@ fi
>
>  if test x"$grub_build_mkfont_excuse" = x ; then
>    # Check for freetype libraries.
> -  build_freetype_cflags=`$BUILD_FREETYPE --cflags`
> -  build_freetype_libs=`$BUILD_FREETYPE --libs`
> +  BUILD_FREETYPE_CFLAGS=`$BUILD_FREETYPE --cflags`
> +  BUILD_FREETYPE_LIBS=`$BUILD_FREETYPE --libs`
>    SAVED_CPPFLAGS_2="$CPPFLAGS"
>    SAVED_LIBS="$LIBS"
> -  CPPFLAGS="$CPPFLAGS $build_freetype_cflags"
> -  LIBS="$LIBS $build_freetype_libs"
> +  CPPFLAGS="$CPPFLAGS $BUILD_FREETYPE_CFLAGS"
> +  LIBS="$LIBS $BUILD_FREETYPE_LIBS"
>    AC_CHECK_HEADERS([ft2build.h], [],
>    	[grub_build_mkfont_excuse=["need freetype2 headers"]])
>    AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_build_mkfont_excuse=["freetype2 library unusable"]])
> @@ -1610,8 +1610,8 @@ if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || tes
>    fi
>  fi
>
> -AC_SUBST([build_freetype_cflags])
> -AC_SUBST([build_freetype_libs])
> +AC_SUBST([BUILD_FREETYPE_CFLAGS])
> +AC_SUBST([BUILD_FREETYPE_LIBS])
>
>  CC="$SAVED_CC"
>  CPP="$SAVED_CPP"
> --
> 2.7.4
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/2] build: Use pkg-config to find FreeType
  2018-01-30 21:59   ` [PATCH v2 2/2] build: Use pkg-config to find FreeType Colin Watson
@ 2018-09-19 14:26     ` Daniel Kiper
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Kiper @ 2018-09-19 14:26 UTC (permalink / raw)
  To: cjwatson; +Cc: grub-devel

Ugh... Same drop off...

Anyway, Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel

On Tue, Jan 30, 2018 at 09:59:09PM +0000, Colin Watson wrote:
> pkg-config is apparently preferred over freetype-config these days (see
> the BUGS section of freetype-config(1)).  pkg-config support was added
> to FreeType in version 2.1.5, which was released in 2003, so it should
> comfortably be available everywhere by now.
>
> We no longer need to explicitly substitute FREETYPE_CFLAGS and
> FREETYPE_LIBS, since PKG_CHECK_MODULES does that automatically.
>
> Fixes Debian bug #887721.
>
> Reported-by: Hugh McMaster <hugh.mcmaster@outlook.com>
> Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
> ---
>  INSTALL      | 11 +++++----
>  configure.ac | 74 +++++++++++++++++++++++++-----------------------------------
>  2 files changed, 37 insertions(+), 48 deletions(-)
>
> diff --git a/INSTALL b/INSTALL
> index f3c20ed..b370d77 100644
> --- a/INSTALL
> +++ b/INSTALL
> @@ -37,6 +37,7 @@ configuring the GRUB.
>  * GNU gettext 0.17 or later
>  * GNU binutils 2.9.1.0.23 or later
>  * Flex 2.5.35 or later
> +* pkg-config
>  * Other standard GNU/Unix tools
>  * a libc with large file support (e.g. glibc 2.1 or later)
>
> @@ -52,7 +53,7 @@ For optional grub-emu features, you need:
>
>  To build GRUB's graphical terminal (gfxterm), you need:
>
> -* FreeType 2 or later
> +* FreeType 2.1.5 or later
>  * GNU Unifont
>
>  If you use a development snapshot or want to hack on GRUB you may
> @@ -158,8 +159,8 @@ For this example the configure line might look like (more details below)
>  (some options are optional and included here for completeness but some rarely
>  used options are omitted):
>
> -./configure BUILD_CC=gcc BUILD_FREETYPE=freetype-config --host=amd64-linux-gnu
> -CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" FREETYPE=amd64-linux-gnu-freetype-config
> +./configure BUILD_CC=gcc BUILD_PKG_CONFIG=pkg-config --host=amd64-linux-gnu
> +CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" PKG_CONFIG=amd64-linux-gnu-pkg-config
>  --target=arm --with-platform=uboot TARGET_CC=arm-elf-gcc
>  TARGET_CFLAGS="-Os -march=armv6" TARGET_CCASFLAGS="-march=armv6"
>  TARGET_OBJCOPY="arm-elf-objcopy" TARGET_STRIP="arm-elf-strip"
> @@ -176,7 +177,7 @@ corresponding platform are not needed for the platform in question.
>      2. BUILD_CFLAGS= for C options for build.
>      3. BUILD_CPPFLAGS= for C preprocessor options for build.
>      4. BUILD_LDFLAGS= for linker options for build.
> -    5. BUILD_FREETYPE= for freetype-config for build (optional).
> +    5. BUILD_PKG_CONFIG= for pkg-config for build (optional).
>
>    - For host
>      1. --host= to autoconf name of host.
> @@ -184,7 +185,7 @@ corresponding platform are not needed for the platform in question.
>      3. HOST_CFLAGS= for C options for host.
>      4. HOST_CPPFLAGS= for C preprocessor options for host.
>      5. HOST_LDFLAGS= for linker options for host.
> -    6. FREETYPE= for freetype-config for host (optional).
> +    6. PKG_CONFIG= for pkg-config for host (optional).
>      7. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional).
>      8. Libfuse if any must be in standard linker folders (-lfuse) (optional).
>      9. Libzfs if any must be in standard linker folders (-lzfs) (optional).
> diff --git a/configure.ac b/configure.ac
> index 095b0de..6f1adf4 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -50,6 +50,10 @@ AC_PREREQ(2.60)
>  AC_CONFIG_SRCDIR([include/grub/dl.h])
>  AC_CONFIG_HEADER([config-util.h])
>
> +# Explicitly check for pkg-config early on, since otherwise conditional
> +# calls are problematic.
> +PKG_PROG_PKG_CONFIG
> +
>  # Program name transformations
>  AC_ARG_PROGRAM
>  grub_TRANSFORM([grub-bios-setup])
> @@ -1508,29 +1512,22 @@ if test x"$enable_grub_mkfont" = xno ; then
>    grub_mkfont_excuse="explicitly disabled"
>  fi
>
> -if test x"$grub_mkfont_excuse" = x ; then
> -  # Check for freetype libraries.
> -  AC_CHECK_TOOLS([FREETYPE], [freetype-config])
> -  if test "x$FREETYPE" = x ; then
> -    grub_mkfont_excuse=["need freetype2 library"]
> -  fi
> -fi
> -
>  unset ac_cv_header_ft2build_h
>
>  if test x"$grub_mkfont_excuse" = x ; then
>    # Check for freetype libraries.
> -  FREETYPE_CFLAGS=`$FREETYPE --cflags`
> -  FREETYPE_LIBS=`$FREETYPE --libs`
> -  SAVED_CPPFLAGS="$CPPFLAGS"
> -  SAVED_LIBS="$LIBS"
> -  CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
> -  LIBS="$LIBS $FREETYPE_LIBS"
> -  AC_CHECK_HEADERS([ft2build.h], [],
> -  	[grub_mkfont_excuse=["need freetype2 headers"]])
> -  AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_mkfont_excuse=["freetype2 library unusable"]])
> -  CPPFLAGS="$SAVED_CPPFLAGS"
> -  LIBS="$SAVED_LIBS"
> +  PKG_CHECK_MODULES([FREETYPE], [freetype2], [
> +    SAVED_CPPFLAGS="$CPPFLAGS"
> +    SAVED_LIBS="$LIBS"
> +    CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
> +    LIBS="$LIBS $FREETYPE_LIBS"
> +    AC_CHECK_HEADERS([ft2build.h], [],
> +      [grub_mkfont_excuse=["need freetype2 headers"]])
> +    AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [],
> +      [grub_mkfont_excuse=["freetype2 library unusable"]])
> +    CPPFLAGS="$SAVED_CPPFLAGS"
> +    LIBS="$SAVED_LIBS"
> +  ], [grub_mkfont_excuse=["need freetype2 library"]])
>  fi
>
>  if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
> @@ -1542,8 +1539,6 @@ else
>  enable_grub_mkfont=no
>  fi
>  AC_SUBST([enable_grub_mkfont])
> -AC_SUBST([FREETYPE_CFLAGS])
> -AC_SUBST([FREETYPE_LIBS])
>
>  SAVED_CC="$CC"
>  SAVED_CPP="$CPP"
> @@ -1573,25 +1568,21 @@ AC_SUBST([BUILD_WORDS_BIGENDIAN])
>
>  if test x"$grub_build_mkfont_excuse" = x ; then
>    # Check for freetype libraries.
> -  AC_CHECK_PROGS([BUILD_FREETYPE], [freetype-config])
> -  if test "x$BUILD_FREETYPE" = x ; then
> -    grub_build_mkfont_excuse=["need freetype2 library"]
> -  fi
> -fi
> -
> -if test x"$grub_build_mkfont_excuse" = x ; then
> -  # Check for freetype libraries.
> -  BUILD_FREETYPE_CFLAGS=`$BUILD_FREETYPE --cflags`
> -  BUILD_FREETYPE_LIBS=`$BUILD_FREETYPE --libs`
> -  SAVED_CPPFLAGS_2="$CPPFLAGS"
> -  SAVED_LIBS="$LIBS"
> -  CPPFLAGS="$CPPFLAGS $BUILD_FREETYPE_CFLAGS"
> -  LIBS="$LIBS $BUILD_FREETYPE_LIBS"
> -  AC_CHECK_HEADERS([ft2build.h], [],
> -  	[grub_build_mkfont_excuse=["need freetype2 headers"]])
> -  AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_build_mkfont_excuse=["freetype2 library unusable"]])
> -  LIBS="$SAVED_LIBS"
> -  CPPFLAGS="$SAVED_CPPFLAGS_2"
> +  SAVED_PKG_CONFIG="$PKG_CONFIG"
> +  test -z "$BUILD_PKG_CONFIG" || PKG_CONFIG="$BUILD_PKG_CONFIG"
> +  PKG_CHECK_MODULES([BUILD_FREETYPE], [freetype2], [
> +    SAVED_CPPFLAGS_2="$CPPFLAGS"
> +    SAVED_LIBS="$LIBS"
> +    CPPFLAGS="$CPPFLAGS $BUILD_FREETYPE_CFLAGS"
> +    LIBS="$LIBS $BUILD_FREETYPE_LIBS"
> +    AC_CHECK_HEADERS([ft2build.h], [],
> +      [grub_build_mkfont_excuse=["need freetype2 headers"]])
> +    AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [],
> +      [grub_build_mkfont_excuse=["freetype2 library unusable"]])
> +    LIBS="$SAVED_LIBS"
> +    CPPFLAGS="$SAVED_CPPFLAGS_2"
> +  ], [grub_build_mkfont_excuse=["need freetype2 library"]])
> +  PKG_CONFIG="$SAVED_PKG_CONFIG"
>  fi
>
>  if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then
> @@ -1610,9 +1601,6 @@ if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || tes
>    fi
>  fi
>
> -AC_SUBST([BUILD_FREETYPE_CFLAGS])
> -AC_SUBST([BUILD_FREETYPE_LIBS])
> -
>  CC="$SAVED_CC"
>  CPP="$SAVED_CPP"
>  CFLAGS="$SAVED_CFLAGS"
> --
> 2.7.4
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] build: Capitalise *freetype_* variables
  2018-09-19 14:22     ` Daniel Kiper
@ 2018-09-19 15:06       ` Colin Watson
  0 siblings, 0 replies; 9+ messages in thread
From: Colin Watson @ 2018-09-19 15:06 UTC (permalink / raw)
  To: Daniel Kiper; +Cc: grub-devel

On Wed, Sep 19, 2018 at 04:22:12PM +0200, Daniel Kiper wrote:
> Ugh... This and another patch somehow dropped off from my radar.
> It reappeared during recent mailbox cleanup. Sorry about that.
> 
> Anyway, Colin, may I add your SOB? If yes then
> 
> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Please do - I must have forgotten.  Thanks.

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-09-19 15:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-25 12:23 [PATCH] build: Use pkg-config to find Freetype Colin Watson
2018-01-29 17:35 ` Daniel Kiper
2018-01-30 21:57   ` Colin Watson
2018-02-10 15:37     ` Colin Watson
2018-01-30 21:58   ` [PATCH v2 1/2] build: Capitalise *freetype_* variables Colin Watson
2018-09-19 14:22     ` Daniel Kiper
2018-09-19 15:06       ` Colin Watson
2018-01-30 21:59   ` [PATCH v2 2/2] build: Use pkg-config to find FreeType Colin Watson
2018-09-19 14:26     ` Daniel Kiper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.