From baa03276724b33fbe3a797dc950599aab9ec316417044b107832e3d89331ecc2 Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Wed, 9 May 2018 06:14:01 +0000 Subject: [PATCH] Accepting request 603940 from home:namtrac:branches:Base:System - Add grub2-freetype-pkgconfig.patch to fix build with new freetype use pkgconfig to find Freetype libraries. OBS-URL: https://build.opensuse.org/request/show/603940 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=300 --- grub2-freetype-pkgconfig.patch | 165 +++++++++++++++++++++++++++++++++ grub2.changes | 6 ++ grub2.spec | 5 +- 3 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 grub2-freetype-pkgconfig.patch diff --git a/grub2-freetype-pkgconfig.patch b/grub2-freetype-pkgconfig.patch new file mode 100644 index 0000000..068792a --- /dev/null +++ b/grub2-freetype-pkgconfig.patch @@ -0,0 +1,165 @@ +Index: grub-2.02/configure.ac +=================================================================== +--- grub-2.02.orig/configure.ac ++++ grub-2.02/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]) +@@ -1493,29 +1497,21 @@ if test x"$enable_grub_mkfont" = xno ; t + 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 +@@ -1527,8 +1523,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" +@@ -1558,25 +1552,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 +@@ -1595,9 +1585,6 @@ if test x"$enable_build_grub_mkfont" = x + fi + fi + +-AC_SUBST([build_freetype_cflags]) +-AC_SUBST([build_freetype_libs]) +- + CC="$SAVED_CC" + CPP="$SAVED_CPP" + CFLAGS="$SAVED_CFLAGS" +Index: grub-2.02/Makefile.am +=================================================================== +--- grub-2.02.orig/Makefile.am ++++ grub-2.02/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 +Index: grub-2.02/Makefile.util.def +=================================================================== +--- grub-2.02.orig/Makefile.util.def ++++ grub-2.02/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/grub2.changes b/grub2.changes index 6c97146..ff70e78 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri May 4 08:07:09 UTC 2018 - idonmez@suse.com + +- Add grub2-freetype-pkgconfig.patch to fix build with new freetype + use pkgconfig to find Freetype libraries. + ------------------------------------------------------------------- Tue Apr 17 07:54:15 UTC 2018 - mchang@suse.com diff --git a/grub2.spec b/grub2.spec index d6e6d17..c9ef60b 100644 --- a/grub2.spec +++ b/grub2.spec @@ -139,7 +139,7 @@ BuildRequires: update-bootloader-rpm-macros Version: 2.02 Release: 0 Summary: Bootloader with support for Linux, Multiboot and more -License: GPL-3.0+ +License: GPL-3.0-or-later Group: System/Boot Url: http://www.gnu.org/software/grub/ %define rev 20120622 @@ -285,6 +285,8 @@ Patch421: 0002-AUDIT-0-http-boot-tracker-bug.patch # check if default entry need to be corrected for updated distributor version # and/or use fallback entry if default kernel entry removed (bsc#1065349) Patch430: grub2-mkconfig-default-entry-correction.patch +# Use pkg-config to find Freetype2 +Patch500: grub2-freetype-pkgconfig.patch Requires: gettext-runtime %if 0%{?suse_version} >= 1140 @@ -557,6 +559,7 @@ swap partition while in resuming %patch420 -p1 %patch421 -p1 %patch430 -p1 +%patch500 -p1 %build # patches above may update the timestamp of grub.texi