From patchwork Mon Sep 11 18:54:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 53736 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D719E27BBEA; Mon, 11 Sep 2023 19:56:15 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7CFF127BBE2 for ; Mon, 11 Sep 2023 19:56:13 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfm4y-0002xt-7b; Mon, 11 Sep 2023 14:56:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qfm4m-0002sT-TJ for guix-patches@gnu.org; Mon, 11 Sep 2023 14:56:01 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfm4l-000488-JC for guix-patches@gnu.org; Mon, 11 Sep 2023 14:56:00 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qfm4p-0001qO-Nq for guix-patches@gnu.org; Mon, 11 Sep 2023 14:56:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65873] [PATCH 5/5] gnu: xfig: Update to 3.2.9. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 11 Sep 2023 18:56:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65873 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65873@debbugs.gnu.org Cc: Bruno Victal Received: via spool by 65873-submit@debbugs.gnu.org id=B65873.16944585217011 (code B ref 65873); Mon, 11 Sep 2023 18:56:03 +0000 Received: (at 65873) by debbugs.gnu.org; 11 Sep 2023 18:55:21 +0000 Received: from localhost ([127.0.0.1]:54845 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfm44-0001ov-TQ for submit@debbugs.gnu.org; Mon, 11 Sep 2023 14:55:21 -0400 Received: from smtpm1.myservices.hosting ([185.26.105.232]:40720) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfm42-0001om-OJ for 65873@debbugs.gnu.org; Mon, 11 Sep 2023 14:55:16 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm1.myservices.hosting (Postfix) with ESMTP id 7C41D2089C for <65873@debbugs.gnu.org>; Mon, 11 Sep 2023 20:55:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id D7BBD8009A; Mon, 11 Sep 2023 20:55:01 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id jYF1Xxno4144; Mon, 11 Sep 2023 20:55:01 +0200 (CEST) Received: from guix-nuc.home.arpa (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id E5DDD80099; Mon, 11 Sep 2023 20:55:00 +0200 (CEST) From: Bruno Victal Date: Mon, 11 Sep 2023 19:54:53 +0100 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/xfig.scm (xfig): Update to 3.2.9. [arguments]<#:phases>: Add 'wrap-program. [native-inputs]: Add pkg-config, autoconf, automake and libtool. Move ghostscript to … [inputs]: … here. Add fig2dev, libxaw3d and libxft. [license]: Correct it to `SPDX-License-Identifier:Xfig'. * gnu/packages/patches/xfig-Enable-error-message-for-missing-libraries.patch: New file. * gnu/packages/patches/xfig-Fix-double-free-when-requesting-MediaBox.patch: Ditto. * gnu/packages/patches/xfig-Use-pkg-config-to-set-fontconfig-CFLAGS-and-LIBS.patch: Ditto. * gnu/local.mk: Register it. --- gnu/local.mk | 3 + ...-error-message-for-missing-libraries.patch | 39 ++++++++ ...double-free-when-requesting-MediaBox.patch | 58 ++++++++++++ ...ig-to-set-fontconfig-CFLAGS-and-LIBS.patch | 89 +++++++++++++++++++ gnu/packages/xfig.scm | 53 +++++++++-- 5 files changed, 234 insertions(+), 8 deletions(-) create mode 100644 gnu/packages/patches/xfig-Enable-error-message-for-missing-libraries.patch create mode 100644 gnu/packages/patches/xfig-Fix-double-free-when-requesting-MediaBox.patch create mode 100644 gnu/packages/patches/xfig-Use-pkg-config-to-set-fontconfig-CFLAGS-and-LIBS.patch diff --git a/gnu/local.mk b/gnu/local.mk index f4707a89e6..e21d497e8b 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -2115,6 +2115,9 @@ dist_patch_DATA = \ %D%/packages/patches/xf86-video-nouveau-fixup-ABI.patch \ %D%/packages/patches/xf86-video-savage-xorg-compat.patch \ %D%/packages/patches/xf86-video-siliconmotion-fix-ftbfs.patch \ + %D%/packages/patches/xfig-Enable-error-message-for-missing-libraries.patch \ + %D%/packages/patches/xfig-Fix-double-free-when-requesting-MediaBox.patch \ + %D%/packages/patches/xfig-Use-pkg-config-to-set-fontconfig-CFLAGS-and-LIBS.patch \ %D%/packages/patches/xfce4-panel-plugins.patch \ %D%/packages/patches/xfce4-settings-defaults.patch \ %D%/packages/patches/xgboost-use-system-dmlc-core.patch \ diff --git a/gnu/packages/patches/xfig-Enable-error-message-for-missing-libraries.patch b/gnu/packages/patches/xfig-Enable-error-message-for-missing-libraries.patch new file mode 100644 index 0000000000..a6c37e3353 --- /dev/null +++ b/gnu/packages/patches/xfig-Enable-error-message-for-missing-libraries.patch @@ -0,0 +1,39 @@ +From 84685930d5cfc7005f3414601230a23e28a18f59 Mon Sep 17 00:00:00 2001 +From: Thomas Loimer +Date: Tue, 5 Sep 2023 22:02:55 +0200 +Subject: [PATCH 1/3] Enable error message for missing libraries + +Move the check for missing libraries to a place where the queried +variables are set. +--- + configure.ac | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 035b9d7..47452c5 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -95,9 +95,6 @@ dnl AC_CHECK_PROG(XDG_MENU, [xdg-desktop-menu], [xdg-desktop-menu]) + AC_SEARCH_LIBS([pow], [m])dnl + dnl AC_SEARCH_LIBS([deflate], [z]) # libz is not needed. + AC_SEARCH_LIBS([FcInit], [fontconfig]) +-AS_IF([test "x$ac_cv_search_pow" = xno \ +- || test "x$ac_cv_search_png_read_info" = xno], +- [AC_MSG_ERROR([Necessary libraries not found.])]) + + + # Checks for header files. +@@ -187,6 +184,10 @@ PostScript files. To disable calling ghostscript, set to the empty string, + AC_SUBST([gsman]) + AM_SUBST_NOTMAKE([gsman]) + ++AS_IF([test "x$ac_cv_search_pow" = xno \ ++ || test "x$ac_cv_search_png_read_info" = xno], ++ [AC_MSG_ERROR([Necessary libraries not found.])]) ++ + + # Checks for typedefs, structures, and compiler characteristics. + AC_C_BIGENDIAN +-- +2.40.1 + diff --git a/gnu/packages/patches/xfig-Fix-double-free-when-requesting-MediaBox.patch b/gnu/packages/patches/xfig-Fix-double-free-when-requesting-MediaBox.patch new file mode 100644 index 0000000000..65b0ad8d36 --- /dev/null +++ b/gnu/packages/patches/xfig-Fix-double-free-when-requesting-MediaBox.patch @@ -0,0 +1,58 @@ +From a9181df87d78828318f2e9f8d4ea012bc06883b9 Mon Sep 17 00:00:00 2001 +From: Bruno Victal +Date: Thu, 7 Sep 2023 16:51:23 +0100 +Subject: [PATCH 3/3] Fix double-free when requesting MediaBox. + +Explicitly close the Ghostscript PDF interpreter before calling quit. + +References: +[1]: +[2]: +--- + src/u_ghostscript.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/src/u_ghostscript.c b/src/u_ghostscript.c +index 5974b31..d14674f 100644 +--- a/src/u_ghostscript.c ++++ b/src/u_ghostscript.c +@@ -317,10 +317,10 @@ gsexe(FILE **out, bool *isnew, char *exenew, char *exeold) + * Call ghostscript to extract the /MediaBox from the pdf given in file. + * Command line, for gs >= 9.50, + * gs -q -dNODISPLAY --permit-file-read=in.pdf -c \ +- * "(in.pdf) (r) file runpdfbegin 1 pdfgetpage /MediaBox pget pop == quit" ++ * "(in.pdf) (r) file runpdfbegin 1 pdfgetpage /MediaBox pget pop == runpdfend quit" + * gs < 9.50: + * gs -q -dNODISPLAY -dNOSAFER -c \ +- * "(in.pdf) (r) file runpdfbegin 1 pdfgetpage /MediaBox pget pop == quit" ++ * "(in.pdf) (r) file runpdfbegin 1 pdfgetpage /MediaBox pget pop == runpdfend quit" + * The command line was found, and modified a bit, at + *https://stackoverflow.com/questions/2943281/using-ghostscript-to-get-page-size + * Beginning with gs 9.50, "-dSAFER" is the default, and permission to access +@@ -349,9 +349,11 @@ gsexe_mediabox(char *file, int *llx, int *lly, int *urx, int *ury) + return -3; + + exenew = "%s -q -dNODISPLAY \"--permit-file-read=%s\" -c \"(%s) (r) " +- "file runpdfbegin 1 pdfgetpage /MediaBox pget pop == quit\""; ++ "file runpdfbegin 1 pdfgetpage /MediaBox pget pop == " ++ "runpdfend quit\""; + exeold = "%s -q -dNODISPLAY -c \"(%s) (r) " +- "file runpdfbegin 1 pdfgetpage /MediaBox pget pop == quit\""; ++ "file runpdfbegin 1 pdfgetpage /MediaBox pget pop == " ++ "runpdfend quit\""; + + /* malloc() buffers for the command line, if necessary */ + fmt = exenew; +@@ -445,7 +447,8 @@ gslib_mediabox(char *file, int *llx, int *lly, int *urx, int *ury) + argnew[3] = "--permit-file-read=%s"; /* file */ + argnew[4] = "-c"; + argnew[5] = +- "(%s) (r) file runpdfbegin 1 pdfgetpage /MediaBox pget pop == quit"; ++ "(%s) (r) file runpdfbegin 1 pdfgetpage /MediaBox pget pop == " ++ "runpdfend quit"; + + argold[0] = argnew[0]; + argold[1] = argnew[1]; +-- +2.40.1 + diff --git a/gnu/packages/patches/xfig-Use-pkg-config-to-set-fontconfig-CFLAGS-and-LIBS.patch b/gnu/packages/patches/xfig-Use-pkg-config-to-set-fontconfig-CFLAGS-and-LIBS.patch new file mode 100644 index 0000000000..65158b901b --- /dev/null +++ b/gnu/packages/patches/xfig-Use-pkg-config-to-set-fontconfig-CFLAGS-and-LIBS.patch @@ -0,0 +1,89 @@ +From 4320b1d82da1bfe1519800ae3ac35b6b59a9da56 Mon Sep 17 00:00:00 2001 +From: Thomas Loimer +Date: Fri, 8 Sep 2023 18:43:00 +0200 +Subject: [PATCH 2/3] Use pkg-config to set fontconfig CFLAGS and LIBS + +--- + configure.ac | 16 +++++++++++++--- + src/Makefile.am | 8 +++----- + tests/Makefile.am | 4 ++-- + 3 files changed, 18 insertions(+), 10 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 47452c5..3113db8 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -81,11 +81,23 @@ AC_PROG_SED + AM_PROG_AR + + # Search for pkg-config and set PKG_CONFIG to the path found, else empty. +-# PKG_PROG_PKG_CONFIG ++PKG_PROG_PKG_CONFIG + # On debian, pkg-config does not find xaw3d. On archlinux, pkg-config + # --libs xaw3d yields -lXaw3d -lXmu -lXt -lX11 -- but -lXmu is not + # strictly necessary. Use hard-coded paths instead of pkg-config. + ++# First try pkg-config, as a side-effect this might set flags that are ++# useful later, e.g., for libpng. ++dnl Under archlinux, PKG_CHECK_MODULES(FT, fontconfig) would write during ++dnl ./configure "checking for FT...", under debian the line is ++dnl "checking for fontconfig...". Stay on the comprehensible side. ++AS_IF([test "x$PKG_CONFIG" != x], ++ [PKG_CHECK_MODULES([fontconfig], [fontconfig])], ++ [fontconfig_CFLAGS='-I$(oldincludedir)/freetype2 ' ++ AC_SEARCH_LIBS([FcInit], [fontconfig])]) ++AC_SUBST([fontconfig_CFLAGS]) ++AC_SUBST([fontconfig_LIBS]) ++ + dnl Not useful for packagers. + dnl AC_CHECK_PROG(XDG_ICON, [xdg-icon-resource], [xdg-icon-resource]) + dnl AC_CHECK_PROG(XDG_MENU, [xdg-desktop-menu], [xdg-desktop-menu]) +@@ -93,8 +105,6 @@ dnl AC_CHECK_PROG(XDG_MENU, [xdg-desktop-menu], [xdg-desktop-menu]) + + # Checks for libraries. + AC_SEARCH_LIBS([pow], [m])dnl +-dnl AC_SEARCH_LIBS([deflate], [z]) # libz is not needed. +-AC_SEARCH_LIBS([FcInit], [fontconfig]) + + + # Checks for header files. +diff --git a/src/Makefile.am b/src/Makefile.am +index 3cbd5ee..73d5132 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -23,13 +23,11 @@ + # "`u' modifier ignored since `D' is the default...". + ARFLAGS = cr + +-# Xft #includes , not , hence freetype2 +-# must be put into the search path. +- +-AM_CPPFLAGS = -I$(oldincludedir)/freetype2 $(XCPPFLAGS) -DNDEBUG -DXFIGLIBDIR="\"$(compkeydbdir)\"" \ ++AM_CPPFLAGS = $(fontconfig_CFLAGS) $(XCPPFLAGS) -DNDEBUG \ ++ -DXFIGLIBDIR="\"$(compkeydbdir)\"" \ + -DOBJLIBDIR="\"$(pkgdatadir)/Libraries\"" -DXFIGDOCDIR="\"$(docdir)\"" + +-AM_LDFLAGS = $(XLDFLAGS) ++AM_LDFLAGS = $(fontconfig_LIBS) $(XLDFLAGS) + + # LIBOBJS must be placed in LDADD or xfig_LDADD - otherwise, the + # lib-dir is not distributed +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 2f529ac..c158806 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -39,9 +39,9 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac + echo 'm4_define([AT_PACKAGE_URL], [@PACKAGE_URL@])'; \ + } >'$(srcdir)/package.m4' + +-AM_CPPFLAGS = -I$(top_srcdir)/src -I$(oldincludedir)/freetype2 $(XCPPFLAGS) ++AM_CPPFLAGS = -I$(top_srcdir)/src $(fontconfig_CFLAGS) $(XCPPFLAGS) + +-AM_LDFLAGS = $(XLDFLAGS) ++AM_LDFLAGS = $(fontconfig_LIBS) $(XLDFLAGS) + LDADD = $(top_builddir)/src/libxfig.a $(XLIBS) + + check_PROGRAMS = test1 test2 test3 test4 +-- +2.40.1 + diff --git a/gnu/packages/xfig.scm b/gnu/packages/xfig.scm index 9ea40c193e..d5f67c110e 100644 --- a/gnu/packages/xfig.scm +++ b/gnu/packages/xfig.scm @@ -28,9 +28,11 @@ (define-module (gnu packages xfig) #:use-module (guix gexp) #:use-module (guix build-system gnu) #:use-module (gnu packages) + #:use-module (gnu packages autotools) #:use-module (gnu packages freedesktop) #:use-module (gnu packages ghostscript) #:use-module (gnu packages xorg) + #:use-module (gnu packages pkg-config) #:use-module (gnu packages image) #:use-module (gnu packages ghostscript) #:use-module (gnu packages imagemagick) @@ -95,7 +97,7 @@ (define-public fig2dev (define-public xfig (package (name "xfig") - (version "3.2.8b") + (version "3.2.9") (source (origin (method url-fetch) @@ -103,22 +105,55 @@ (define-public xfig name "-" version ".tar.xz")) (sha256 (base32 - "0fndgbm1mkqb1sn2v2kj3nx9mxj70jbp31y2bjvzcmmkry0q3k5j")) + "1xy2zqbd1wn2fij95kgnj39850r7xk74kvx7kp0dxhmvs429vv8k")) + ;; TODO: Remove these patches and snippet when updating, + ;; upstreamed since commit `84375ac05e923b46bbacc8b336b0dfbe29497b6b'. + (patches + (search-patches "xfig-Enable-error-message-for-missing-libraries.patch" + "xfig-Use-pkg-config-to-set-fontconfig-CFLAGS-and-LIBS.patch" + "xfig-Fix-double-free-when-requesting-MediaBox.patch")) (modules '((guix build utils))) (snippet ;; The patch-dot-desktop-files phase requires a relative name. - #~(substitute* "xfig.desktop" - (("^(Exec=)/usr/bin/" _ key) key))))) + #~(begin + (substitute* "xfig.desktop" + (("^(Exec=)/usr/bin/" _ key) key)) + ;; This forces autoreconf to be invoked, needed for patches + ;; to be effective. + (delete-file "configure"))))) (build-system gnu-build-system) + (arguments + (list + #:modules '((guix build gnu-build-system) + (guix build utils) + (srfi srfi-26)) + #:phases + #~(modify-phases %standard-phases + (add-after 'install 'wrap-program + (lambda* (#:key inputs #:allow-other-keys) + (let ((path + (search-path-as-list + '("bin") + (map (cut assoc-ref inputs <>) + (list "ghostscript" "fig2dev"))))) + (wrap-program (string-append #$output "/bin/xfig") + `("PATH" ":" prefix ,path)))))))) (native-inputs - ;; For tests. - (list desktop-file-utils ghostscript)) + (list pkg-config + ;; TODO: Remove the import on (gnu packages autotools) + ;; and related packages in the next update. + autoconf automake libtool + ;; For tests. + desktop-file-utils)) (inputs - (list libxaw3d + (list ghostscript + fig2dev + libxaw3d libjpeg-turbo libpng libxpm libx11 + libxft libxt)) (home-page "https://mcj.sourceforge.net/") (synopsis "Interactive drawing tool") @@ -129,4 +164,6 @@ (define-public xfig such as GIF, JPEG, EPSF (PostScript), etc. Those objects can be created, deleted, moved or modified. Attributes such as colors or line styles can be selected in various ways. For text, 35 fonts are available.") - (license license:bsd-2))) + (license + (license:non-copyleft "file://Makefile.am" + "See ."))))