[gimp/wip/Jehan/debug-flatpak] build: patch to configure libwmf with no freetype-config.



commit cd019c40739d4f7988432fc17ba816bf2279e1c4
Author: Jehan <jehan girinstud io>
Date:   Sun Aug 22 16:12:37 2021 +0200

    build: patch to configure libwmf with no freetype-config.
    
    libwmf was still relying on a script called freetype-config instead of
    using standard pkg-config. It seems it got wiped out in recent freetype2
    (or at the very least, this script is not present anymore in freetype2
    version 24.0.18 from master runtime of GNOME SDK).
    This patch uses pkg-config in libwmf configuration instead.
    
    As I also had some autoheader "missing template" warnings (which were
    failing the recreation of config scripts), I also add placeholder
    descriptions to AC_DEFINE() macros, as this is apparently now mandatory.

 build/flatpak/org.gimp.GIMP-nightly.json           |   7 +-
 .../patches/libwmf-no-freetype-config.patch        | 208 +++++++++++++++++++++
 2 files changed, 214 insertions(+), 1 deletion(-)
---
diff --git a/build/flatpak/org.gimp.GIMP-nightly.json b/build/flatpak/org.gimp.GIMP-nightly.json
index 8b798d3e6a..2f1a89d3dc 100644
--- a/build/flatpak/org.gimp.GIMP-nightly.json
+++ b/build/flatpak/org.gimp.GIMP-nightly.json
@@ -186,9 +186,14 @@
                     "url": 
"https://src.fedoraproject.org/repo/pkgs/rpms/libwmf/v0.2.12.tar.gz/sha512/9280851e560becc91546906b911e0c59a1abd690e10680f6d94a335d66aeaec5eb12ccf2214ee7af2a15729a7b5f8b906022822399b4e2bc12c75a2d75748cab/v0.2.12.tar.gz";,
                     "sha512": 
"9280851e560becc91546906b911e0c59a1abd690e10680f6d94a335d66aeaec5eb12ccf2214ee7af2a15729a7b5f8b906022822399b4e2bc12c75a2d75748cab"
                 },
+                {
+                    "type": "patch",
+                    "path": "patches/libwmf-no-freetype-config.patch"
+                },
                 {
                     "type": "shell",
-                    "commands": [ "cp -p /usr/share/automake-*/config.{sub,guess} ." ]
+                    "commands": [ "cp -p /usr/share/automake-*/config.{sub,guess} .",
+                                  "aclocal", "automake --add-missing", "autoconf" ]
                 }
             ]
         },
diff --git a/build/flatpak/patches/libwmf-no-freetype-config.patch 
b/build/flatpak/patches/libwmf-no-freetype-config.patch
new file mode 100644
index 0000000000..f7bc1bb98c
--- /dev/null
+++ b/build/flatpak/patches/libwmf-no-freetype-config.patch
@@ -0,0 +1,208 @@
+diff -Naur libwmf-0.2.12/configure.ac libwmf-0.2.12-patched/configure.ac
+--- libwmf-0.2.12/configure.ac 2019-02-01 18:51:32.000000000 +0100
++++ libwmf-0.2.12-patched/configure.ac 2021-08-22 16:10:19.979469444 +0200
+@@ -146,7 +146,7 @@
+ AC_HEADER_STDC
+ AC_CHECK_HEADERS(time.h)
+ AC_CHECK_HEADER(unistd.h,[
+-      AC_DEFINE(HAVE_UNISTD_H)
++      AC_DEFINE(HAVE_UNISTD_H, [], [placeholder])
+       GD_DEFS="$GD_DEFS -DHAVE_UNISTD_H"
+ ])
+ 
+@@ -174,13 +174,13 @@
+ 
+ if [ test "x$check_for_vsnprintf" = "xyes" ]; then
+       AC_CHECK_FUNC(_vsnprintf,[
+-              AC_DEFINE(HAVE_VSNPRINTF)
+-              AC_DEFINE(vsnprintf,_vsnprintf)
++              AC_DEFINE(HAVE_VSNPRINTF, [], [placeholder])
++              AC_DEFINE(vsnprintf,_vsnprintf, [placeholder])
+       ],[     dnl Hmm. On the off-chance, check for vsnprintf in libdb.
+               dnl This should, hopefully, solve the problem with Tru64 4.x
+               dnl which is incompatible with trio (the latter's fault).
+               AC_CHECK_LIB(db,vsnprintf,[
+-                      AC_DEFINE(HAVE_VSNPRINTF)
++                      AC_DEFINE(HAVE_VSNPRINTF, [], [placeholder])
+                       WMF_LIBFLAGS="$WMF_LIBFLAGS -ldb"
+               ],[     require_trio=yes
+               ])
+@@ -192,8 +192,8 @@
+ 
+ if [ test "x$check_for_snprintf" = "xyes" ]; then
+       AC_CHECK_FUNC(_snprintf,[
+-              AC_DEFINE(HAVE_SNPRINTF)
+-              AC_DEFINE(snprintf,_snprintf)
++              AC_DEFINE(HAVE_SNPRINTF, [], [placeholder])
++              AC_DEFINE(snprintf,_snprintf, [placeholder])
+       ])
+ fi
+ 
+@@ -204,7 +204,7 @@
+       AC_MSG_CHECKING(for vfscanf in stdio.h)
+       AC_EGREP_HEADER(vfscanf,stdio.h,[
+               AC_MSG_RESULT(yes)
+-              AC_DEFINE(HAVE_VFSCANF)
++              AC_DEFINE(HAVE_VFSCANF, [], [placeholder])
+       ],[     AC_MSG_RESULT(no)
+       ])
+ fi
+@@ -235,7 +235,7 @@
+ fi # $LIBWMF_BUILDSTYLE = lite
+ 
+ if [ test $libwmf_layers = no ]; then
+-      AC_DEFINE(WITHOUT_LAYERS,1)
++      AC_DEFINE(WITHOUT_LAYERS,1, [placeholder])
+ fi
+ 
+ AM_CONDITIONAL(LIBWMF_OPT_MODULES,[ test $libwmf_layers = modules ])
+@@ -361,9 +361,9 @@
+ fi
+ 
+ if test $libwmf_xml = expat; then
+-      AC_DEFINE(HAVE_EXPAT)
++      AC_DEFINE(HAVE_EXPAT, [], [placeholder])
+ elif test $libwmf_xml = libxml2; then
+-      AC_DEFINE(HAVE_LIBXML2)
++      AC_DEFINE(HAVE_LIBXML2, [], [placeholder])
+ else
+       libwmf_xml=none
+       WMF_XML_CFLAGS=""
+@@ -372,67 +372,13 @@
+ 
+ dnl (3) freetype {-lfreetype} [-DHAVE_LIBFREETYPE]
+ 
+-WMF_FT_CONFIG_CFLAGS=""
+-WMF_FT_CFLAGS=""
+-WMF_FT_LDFLAGS=""
++PKG_CHECK_MODULES(FREETYPE, freetype2,,)
+ 
+-_cppflags=$CPPFLAGS
+-_ldflags=$LDFLAGS
+-
+-have_freetype=no
+-
+-AC_ARG_WITH(freetype,[  --with-freetype=DIR     use freetype2 in DIR],[
+-      if [ test "x$withval" != "xno" ]; then
+-              if [ test "x$withval" != "xyes" ]; then
+-                      FREETYPE_DIR=$withval
+-              fi
+-      else
+-              AC_MSG_ERROR(* * * libwmf requires freetype2 * * *)
+-      fi
+-])
+-
+-if [ test -n "$FREETYPE_DIR" ]; then
+-      AC_PATH_PROG(FREETYPE_CONFIG,freetype-config, ,[$FREETYPE_DIR/bin:$PATH])
+-else
+-      AC_PATH_PROG(FREETYPE_CONFIG,freetype-config)
+-fi
+-
+-if [ test -n "$FREETYPE_CONFIG" ]; then
+-      if [ test -n "$FREETYPE_DIR" ]; then
+-              freetype_cflags="`$FREETYPE_CONFIG --cflags` -I$FREETYPE_DIR/include"
+-              freetype_libs=`$FREETYPE_CONFIG --libs`
+-      else
+-              freetype_cflags=`$FREETYPE_CONFIG --cflags`
+-              freetype_libs=`$FREETYPE_CONFIG --libs`
+-      fi
+-else
+-      if [ test -n "$FREETYPE_DIR" ]; then
+-              freetype_cflags="-I$FREETYPE_DIR/include/freetype2 -I$FREETYPE_DIR/include"
+-              freetype_libs="-L$FREETYPE_DIR/lib -lfreetype"
+-      else
+-              freetype_cflags=""
+-              freetype_libs="-lfreetype"
+-      fi
+-fi
+-
+-CPPFLAGS="$freetype_cflags $CPPFLAGS"
+-LDFLAGS="$LDFLAGS $freetype_libs"
+-
+-AC_CHECK_LIB(freetype,FT_Init_FreeType,[
+-      WMF_FT_LDFLAGS="$freetype_libs"
+-],[   AC_MSG_ERROR([* * * freetype(2) is required * * *])
+-])
+-AC_CHECK_HEADER(ft2build.h,[
+-      WMF_FT_CFLAGS="$freetype_cflags"
+-      WMF_FT_CONFIG_CFLAGS="$freetype_cflags"
+-],[   AC_MSG_ERROR([* * * freetype(2) is required * * *])
+-])
++AC_SUBST(FREETYPE_CFLAGS)
++AC_SUBST(FREETYPE_LIBS)
+ 
+ GD_DEFS="$GD_DEFS -DHAVE_LIBFREETYPE"
+ 
+-CPPFLAGS=$_cppflags
+-LDFLAGS=$_ldflags
+-
+ dnl (4) zlib     {-lz}
+ 
+ WMF_Z_CONFIG_CFLAGS=""
+@@ -524,7 +470,7 @@
+ ],[   AC_MSG_ERROR(* * * unable to find "png.h" which is required by libwmf * * *)
+ ])
+ 
+-AC_DEFINE(HAVE_LIBPNG)
++AC_DEFINE(HAVE_LIBPNG, [], [placeholder])
+ GD_DEFS="$GD_DEFS -DHAVE_LIBPNG"
+ 
+ fi # $LIBWMF_BUILDSTYLE = heavy
+@@ -567,7 +513,7 @@
+                       else
+                               WMF_JPEG_LDFLAGS="-ljpeg"
+                       fi
+-                      AC_DEFINE(HAVE_LIBJPEG)
++                      AC_DEFINE(HAVE_LIBJPEG, [], [placeholder])
+                       GD_DEFS="$GD_DEFS -DHAVE_LIBJPEG"
+                       libwmf_gd_jpeg=yes
+               ])
+@@ -635,8 +581,8 @@
+               other_libs="$other_libs -ljpeg"
+       fi
+ 
+-      CPPFLAGS="$CPPFLAGS $WMF_FT_CFLAGS $WMF_PNG_CFLAGS $WMF_Z_CFLAGS"
+-      LDFLAGS="$LDFLAGS $WMF_FT_LDFLAGS $WMF_PNG_LDFLAGS $WMF_Z_LDFLAGS"
++      CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS $WMF_PNG_CFLAGS $WMF_Z_CFLAGS"
++      LDFLAGS="$LDFLAGS $FREETYPE_LIBS $WMF_PNG_LDFLAGS $WMF_Z_LDFLAGS"
+       other_libs="$other_libs -lfreetype -lpng -lz -lm"
+ 
+       AC_CHECK_HEADER(gd.h,[
+@@ -649,7 +595,7 @@
+ fi
+ 
+ if [ test "x$libwmf_gd" != "xnone" ]; then
+-      AC_DEFINE(HAVE_GD,1)
++      AC_DEFINE(HAVE_GD,1, [placeholder])
+       build_gd_layer=yes
+ else
+       build_gd_layer=no
+@@ -711,7 +657,7 @@
+                               else
+                                       WMF_PLOT_LDFLAGS="$LIBPLOT_LIBS"
+                               fi
+-                              AC_DEFINE(HAVE_LIBPLOT)
++                              AC_DEFINE(HAVE_LIBPLOT, [], [placeholder])
+                               libwmf_plot=maybe
+                       else
+                               AC_MSG_ERROR(* * * sorry - unable to link against libplot * * *)
+@@ -839,16 +785,16 @@
+ 
+ dnl Output...
+ 
+-WMF_CFLAGS="$WMF_FT_CFLAGS $WMF_X_CFLAGS $WMF_PLOT_CFLAGS $WMF_XML_CFLAGS"
++WMF_CFLAGS="$FREETYPE_CFLAGS $WMF_X_CFLAGS $WMF_PLOT_CFLAGS $WMF_XML_CFLAGS"
+ WMF_CFLAGS="$WMF_CFLAGS $WMF_GD_CFLAGS $WMF_JPEG_CFLAGS $WMF_PNG_CFLAGS $WMF_Z_CFLAGS"
+ 
+ AC_SUBST(WMF_CFLAGS)
+ 
+-WMF_CONFIG_CFLAGS="$WMF_FT_CONFIG_CFLAGS $WMF_Z_CONFIG_CFLAGS $WMF_X_CONFIG_CFLAGS"
++WMF_CONFIG_CFLAGS="$FREETYPE_CFLAGS $WMF_Z_CONFIG_CFLAGS $WMF_X_CONFIG_CFLAGS"
+ 
+ AC_SUBST(WMF_CONFIG_CFLAGS)
+ 
+-WMF_LIBFLAGS="$WMF_PLOT_LDFLAGS $WMF_GD_LDFLAGS $WMF_FT_LDFLAGS $WMF_X_LDFLAGS $WMF_XML_LDFLAGS"
++WMF_LIBFLAGS="$WMF_PLOT_LDFLAGS $WMF_GD_LDFLAGS $FREETYPE_LIBS $WMF_X_LDFLAGS $WMF_XML_LDFLAGS"
+ WMF_LIBFLAGS="$WMF_LIBFLAGS $WMF_JPEG_LDFLAGS $WMF_PNG_LDFLAGS $WMF_Z_LDFLAGS $SYS_LIBM"
+ 
+ AC_SUBST(WMF_LIBFLAGS)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]