Subject: [bug#68813] [core-updates PATCH 12/20] gnu: autotrace: Fix pkg-config file.

From: Maxim Cournoyer <[email-masked]>
Date: Thu, 22 Feb 2024 11:10:11 -0500

* gnu/packages/patches/autotrace-pkg-config.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/graphics.scm (autotrace) [source]: Apply it.

Change-Id: Id2086a5e1e1faa48d16ee8faae6960aaf7602321
---

 gnu/local.mk                                  |   1 +
 gnu/packages/graphics.scm                     |   3 +-
 .../patches/autotrace-pkg-config.patch        | 123 ++++++++++++++++++
 3 files changed, 126 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/autotrace-pkg-config.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 9db2e39c45..c072d5af85 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -956,6 +956,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/audiofile-hurd.patch 			\
   %D%/packages/patches/audiofile-function-signature.patch	\
   %D%/packages/patches/automake-skip-amhello-tests.patch	\
+  %D%/packages/patches/autotrace-pkg-config.patch		\
   %D%/packages/patches/avahi-localstatedir.patch		\
   %D%/packages/patches/avidemux-install-to-lib.patch		\
   %D%/packages/patches/awesome-reproducible-png.patch		\
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index fa33dce747..01cd55f33b 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -391,7 +391,8 @@ (define-public autotrace
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0ai91c567c5z560s4zjgjclgca1pm61h8cb8c8q84wg3xvkhmc9x"))))
+                "0ai91c567c5z560s4zjgjclgca1pm61h8cb8c8q84wg3xvkhmc9x"))
+              (patches (search-patches "autotrace-pkg-config.patch"))))
     (build-system gnu-build-system)
     (arguments
      (list #:configure-flags #~'("--disable-static")
diff --git a/gnu/packages/patches/autotrace-pkg-config.patch b/gnu/packages/patches/autotrace-pkg-config.patch
new file mode 100644
index 0000000000..eef1008bf2
--- /dev/null
+++ b/gnu/packages/patches/autotrace-pkg-config.patch
@@ -0,0 +1,123 @@
+Submitted upstream: https://github.com/autotrace/autotrace/pull/128
+
+diff --git a/Makefile.am b/Makefile.am
+index ea6eadd..cd9de37 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -127,7 +127,18 @@ autotraceinclude_HEADERS=\
+ 		src/exception.h \
+ 		src/color.h
+ 
+-libautotrace_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
++libautotrace_la_LDFLAGS = \
++	-version-info 				\
++	$(LT_CURRENT):$(LT_REVISION):$(LT_AGE) 	\
++	$(GRAPHICSMAGICK_LIBS)			\
++	$(IMAGEMAGICK_LIBS)			\
++	$(LIBPNG_LIBS)				\
++	$(LIBSWF_LIBS)				\
++	$(LIBPSTOEDIT_LIBS)			\
++	$(GLIB2_LIBS)				\
++	$(POPT_LIBS)				\
++	$(INTLLIBS)				\
++	-lm
+ 
+ #
+ # noinst_HEADERS: headers shared between lib and bin.
+@@ -143,17 +154,7 @@ autotrace_SOURCES=\
+ 
+ AM_CPPFLAGS = $(GRAPHICSMAGICK_CFLAGS) $(IMAGEMAGICK_CFLAGS) $(LIBPSTOEDIT_CFLAGS) $(LIBSWF_CFLAGS) $(GLIB2_CFLAGS) -DLOCALEDIR=\""$(datadir)/locale"\"
+ 
+-autotrace_LDADD =				\
+-		libautotrace.la			\
+-		$(GRAPHICSMAGICK_LIBS)		\
+-		$(IMAGEMAGICK_LIBS)		\
+-		$(LIBPNG_LIBS)		\
+-		$(LIBSWF_LIBS)		\
+-		$(LIBPSTOEDIT_LIBS)		\
+-		$(GLIB2_LIBS)			\
+-		$(POPT_LIBS)			\
+-		$(INTLLIBS)			\
+-		-lm
++autotrace_LDADD = libautotrace.la
+ 
+ pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA= autotrace.pc
+diff --git a/autotrace.pc.in b/autotrace.pc.in
+index 4c2e581..c70808e 100644
+--- a/autotrace.pc.in
++++ b/autotrace.pc.in
+@@ -6,6 +6,6 @@ includedir=@includedir@
+ Name: Autotrace
+ Description: a utility that converts bitmap to vector graphics
+ Version: @VERSION@
+-Requires:
+-Libs: -L@libdir@ -lautotrace @LIBPNG_LIBS@ @MAGICK_LIBS@ @LIBSWF_LIBS@ @LIBPSTOEDIT_LIBS@ @GLIB2_LIBS@
+-Cflags: -I@includedir@ @MAGICK_CFLAGS@ @LIBPSTOEDIT_CFLAGS@ @GLIB2_CFLAGS@
++Requires.private: glib-2.0 >= 2.0 gmodule-2.0 >= 2.0 gthread-2.0 >= 2.0 gobject-2.0 >= 2.0 @REQUIRES_PRIVATE@
++Libs: -L@libdir@ -lautotrace
++Cflags: -I@includedir@
+diff --git a/configure.ac b/configure.ac
+index 43b6fea..e6cf262 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -85,7 +85,8 @@ else
+   if test "x${with_magick}" = xGraphicsMagick; then
+     PKG_CHECK_MODULES([GRAPHICSMAGICK],
+       [GraphicsMagick >= 1.3.40],
+-      [HAVE_MAGICK=yes
++      [REQUIRES_PRIVATE="${REQUIRES_PRIVATE}GraphicsMagick >= 1.3.40 "
++       HAVE_MAGICK=yes
+        HAVE_GRAPHICSMAGICK=yes
+        MAGICK_LIBRARY=GraphicsMagick
+        AC_DEFINE(HAVE_GRAPHICSMAGICK, 1, [GraphicsMagick library is available.])
+@@ -97,13 +98,15 @@ else
+   if test "x${with_magick}" = xImageMagick; then
+       PKG_CHECK_MODULES([IMAGEMAGICK7],
+           [ImageMagick >= 7.0.1],
+-	 [HAVE_IMAGEMAGICK7=yes
++	 [REQUIRES_PRIVATE="${REQUIRES_PRIVATE}ImageMagick >= 7.0.1 "
++          HAVE_IMAGEMAGICK7=yes
+ 	  AC_DEFINE(HAVE_IMAGEMAGICK7, 1, [ImageMagick version 7 or higher is available.])
+ 	 ],[]
+ 	)
+       PKG_CHECK_MODULES([IMAGEMAGICK],
+          [ImageMagick >= 5.2.1],
+-	 [HAVE_MAGICK=yes
++	 [REQUIRES_PRIVATE="${REQUIRES_PRIVATE}ImageMagick >= 5.2.1 "
++          HAVE_MAGICK=yes
+ 	  HAVE_IMAGEMAGICK=yes
+ 	  MAGICK_LIBRARY=ImageMagick
+ 	  AC_DEFINE(HAVE_IMAGEMAGICK, 1, [ImageMagick library is available.])
+@@ -140,6 +143,7 @@ HAVE_LIBPNG=no
+ if test "x${with_png}" = xyes; then
+ 	PKG_CHECK_MODULES([LIBPNG],[libpng],
+ 		  [
++                   REQUIRES_PRIVATE="${REQUIRES_PRIVATE}libpng "
+ 		   HAVE_LIBPNG=yes
+ 		   AC_DEFINE(HAVE_LIBPNG,1,[PNG library is available or not])
+ 		   ],
+@@ -165,6 +169,7 @@ if test "${swf_header_found}" = yes ; then
+ 	PKG_CHECK_MODULES([LIBSWF],
+ 			  [libming],
+ 			  [
++                           REQUIRES_PRIVATE="${REQUIRES_PRIVATE}libming "
+ 			   HAVE_LIBSWF=yes
+ 			   AC_DEFINE(HAVE_LIBSWF,1,[SWF library is available or not])
+ 			   ],
+@@ -187,6 +192,7 @@ if test "x${with_pstoedit}" = xyes; then
+ 	PKG_CHECK_MODULES([LIBPSTOEDIT],
+ 			  [pstoedit >= 3.32.0],
+ 			  [
++                           REQUIRES_PRIVATE="${REQUIRES_PRIVATE}pstoedit >= 3.32.0 "
+ 			   HAVE_LIBPSTOEDIT=yes
+ 			   AC_DEFINE(HAVE_LIBPSTOEDIT,1,[pstoedit library is available or not])
+ 			   ],
+@@ -210,6 +216,7 @@ fi
+ 
+ dnl po/Makefile.in FIXME FIXME FIXME
+ AC_CONFIG_FILES([po/Makefile.in Makefile autotrace.pc])
++AC_SUBST([REQUIRES_PRIVATE])
+ AC_OUTPUT
+ 
+ echo "
-- 
2.41.0