summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/docbook.scm2
-rw-r--r--gnu/packages/patches/transfig-gcc10-fno-common.patch33
-rw-r--r--gnu/packages/tex.scm2
-rw-r--r--gnu/packages/xfig.scm146
5 files changed, 65 insertions, 119 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 9d7b269272..a25609209c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2029,7 +2029,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/tootle-glib-object-naming.patch		\
   %D%/packages/patches/tootle-reason-phrase.patch		\
   %D%/packages/patches/transcode-ffmpeg.patch	\
-  %D%/packages/patches/transfig-gcc10-fno-common.patch		\
   %D%/packages/patches/trytond-add-egg-modules-to-path.patch	\
   %D%/packages/patches/trytond-add-guix_trytond_path.patch	\
   %D%/packages/patches/ttf2eot-cstddef.patch			\
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index ff6d32b168..c47d3db2c0 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -532,7 +532,7 @@ the in DocBook SGML DTDs.")
                (base32
                 "0yd09nypswy3q4scri1dg7dr99d7gd6r2dwx0xm81l9f4y32gs0n"))))
     (build-system python-build-system)
-    ;; TODO: Add xfig/transfig for fig2dev utility
+    ;; TODO: Add fig2dev for fig2dev utility.
     (inputs
      `(("texlive" ,(texlive-updmap.cfg (list texlive-anysize
                                              texlive-appendix
diff --git a/gnu/packages/patches/transfig-gcc10-fno-common.patch b/gnu/packages/patches/transfig-gcc10-fno-common.patch
deleted file mode 100644
index ebe9236533..0000000000
--- a/gnu/packages/patches/transfig-gcc10-fno-common.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-Fixes "multiple definition" errors when building with GCC 10+.
-
-Based on <https://bugs.gentoo.org/show_bug.cgi?id=706706>.
---- a/fig2dev/dev/gensvg.c	2010-07-01 22:41:16.000000000 +0200
-+++ b/fig2dev/dev/gensvg.c	2022-02-27 20:02:33.379945500 +0100
-@@ -230,10 +230,12 @@
- };
- 
- /* arrowhead arrays */
--Point   points[50], fillpoints[50], clippoints[50];
--int     npoints, nfillpoints, nclippoints;
--int     arrowx1, arrowy1;	/* first point of object */
--int     arrowx2, arrowy2;	/* second point of object */
-+Point   fillpoints[50];
-+int     nfillpoints;
-+extern Point   points[50], clippoints[50];
-+extern int     npoints, nclippoints;
-+extern int     arrowx1, arrowy1;	/* first point of object */
-+extern int     arrowx2, arrowy2;	/* second point of object */
- 
- static int tileno=0; /* number of current tile */ 
- 
---- a/fig2dev/fig2dev.h	2010-03-16 19:53:20.000000000 +0100
-+++ b/fig2dev/fig2dev.h	2022-02-27 19:56:06.072253991 +0100
-@@ -126,7 +126,7 @@
- extern char	*prog, *from, *to;
- extern char	*name;
- extern double	font_size;
--Boolean	correct_font_size;	/* use correct font size */
-+extern Boolean	correct_font_size;	/* use correct font size */
- extern double	mag, fontmag;
- extern FILE	*tfp;
- 
diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index bd02190a51..b5da339353 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -40434,7 +40434,7 @@ glossaries, ...)  should be correctly managed.
 
 @item @file{figlatex.sty}: a LaTeX package to easily insert Xfig figures.  It
 can interact with LaTeX.mk so that the latter automatically invokes
-@command{transfig} if needed.
+@command{fig2dev} if needed.
 
 @end itemize")
     (license license:gpl3+)))
diff --git a/gnu/packages/xfig.scm b/gnu/packages/xfig.scm
index f68ddb01f9..a9a86fc2ed 100644
--- a/gnu/packages/xfig.scm
+++ b/gnu/packages/xfig.scm
@@ -23,7 +23,7 @@
 
 (define-module (gnu packages xfig)
   #:use-module (guix packages)
-  #:use-module ((guix licenses) #:select (bsd-2))
+  #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix download)
   #:use-module (guix gexp)
   #:use-module (guix build-system gnu)
@@ -32,8 +32,69 @@
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages image)
+  #:use-module (gnu packages ghostscript)
+  #:use-module (gnu packages imagemagick)
+  #:use-module (gnu packages netpbm)
   #:use-module (gnu packages compression))
 
+(define-public fig2dev
+  (package
+    (name "fig2dev")
+    (version "3.2.9")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://sourceforge/mcj/"
+                           name "-" version ".tar.xz"))
+       (sha256
+        (base32
+         "1cch429zbmrg2zy1mkx9xwnpvkjhmlw40c88bvi2virws744dqhm"))))
+    (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 ((programs
+                     (find-files (string-append #$output "/bin")))
+                    (path
+                     (search-path-as-list
+                      '("bin")
+                      (map (cut assoc-ref inputs <>)
+                           (list "ghostscript" "imagemagick")))))
+                (for-each (lambda (program)
+                            (wrap-program program
+                              `("PATH" ":" prefix ,path)))
+                          programs)))))))
+    (inputs
+     (list libpng zlib
+           ;; Quoth INSTALL:
+           ;; “To run fig2dev, the packages
+           ;;    ghostscript, and one out of
+           ;;    netpbm | ImageMagick | GraphicsMagick
+           ;; are needed to produce various bitmap output formats, or process
+           ;; fig files with embedded images.”
+           ghostscript
+           imagemagick))
+    (native-inputs
+     ;; XXX: Tests fail if netpbm is absent.
+     (list netpbm))
+    (home-page "https://sourceforge.net/projects/mcj")
+    (synopsis "Translate Fig to other graphic description formats")
+    (description "Fig2dev is a set of tools for creating TeX documents with
+graphics which are portable, in the sense that they can be printed in a wide
+variety of environments.")
+    (license
+     (license:non-copyleft "file://Makefile.am"
+                           "See <https://spdx.org/licenses/Xfig.html>."))))
+
+(define-public transfig
+  (deprecated-package "transfig" fig2dev))
+
 (define-public xfig
   (package
     (name "xfig")
@@ -71,85 +132,4 @@ spline curves, text, etc.  It is also possible to import images in formats
 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 bsd-2)))
-
-(define-public transfig
-  (package
-    (name "transfig")
-    (version "3.2.5e")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "mirror://sourceforge/mcj/mcj-source/transfig."
-                           version ".tar.gz"))
-       (sha256
-        (base32
-         "0i3p7qmg2w8qrad3pn42b0miwarql7yy0gpd49b1bpal6bqsiicf"))
-       (patches
-        (search-patches
-         "transfig-gcc10-fno-common.patch")))) ; fix GCC10 build
-    (build-system gnu-build-system)
-    (native-inputs
-     (list imake makedepend))
-    (inputs
-     `(("xfig"    ,xfig)
-       ("libjpeg" ,libjpeg-turbo)
-       ("libpng"  ,libpng)
-       ("libxpm"  ,libxpm)
-       ("libx11"  ,libx11)
-       ("zlib"    ,zlib)))
-    (arguments
-     `(#:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (replace 'configure
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((imake (assoc-ref inputs "imake"))
-                   (out   (assoc-ref outputs "out")))
-               (substitute* '("fig2dev/Imakefile"
-                              "transfig/Imakefile")
-                 (("XCOMM (BINDIR = )[[:graph:]]*" _ front)
-                  (string-append front out "/bin"))
-                 (("XCOMM USEINLINE") "USEINLINE")
-                 ;; The variable name is deceptive.  The directory is used as an
-                 ;; installation path for bitmaps.
-                 (("(XFIGLIBDIR =[[:blank:]]*)[[:graph:]]*" _ front)
-                  (string-append front out "/lib"))
-                 (("(XPMLIBDIR = )[[:graph:]]*" _ front)
-                  (string-append front (assoc-ref inputs "libxpm") "/lib"))
-                 (("(XPMINC = -I)[[:graph:]]*" _ front)
-                  (string-append front (assoc-ref inputs "libxpm") "/include/X11"))
-                 (("/usr/local/lib/fig2dev") (string-append out "/lib")))
-               ;; The -a argument is required in order to pick up the correct paths
-               ;; to several X header files.
-               (invoke "xmkmf" "-a")
-               (substitute* '("Makefile"
-                              "fig2dev/Makefile"
-                              "fig2dev/dev/Makefile"
-                              "transfig/Makefile")
-                 ;; These imake variables somehow remain undefined
-                 (("DefaultGcc2[[:graph:]]*Opt") "-O2")
-                 ;; Reset a few variable defaults that are set in imake templates
-                 ((imake) out)
-                 (("(MANPATH = )[[:graph:]]*" _ front)
-                  (string-append front out "/share/man"))
-                 (("(CONFDIR = )([[:graph:]]*)" _ front default)
-                  (string-append front out default))
-                 ;; The "l" option was silently ignored until binutils 2.36,
-                 ;; where it got a different purpose.  So remove it to avoid
-                 ;; "ar: libdeps specified more than once".
-                 (("((AR|MODAR) = ar )clq" _ front)
-                  (string-append front "cq")))
-               #t)))
-         (add-after 'install 'install/doc
-           (lambda _
-             (invoke "make" "install.man"))))))
-    (home-page "https://mcj.sourceforge.net/")
-    (synopsis "Create portable LaTeX figures")
-    (description
-     "Transfig creates a makefile to translate figures described in Fig code
-or PIC into a specified LaTeX graphics language.  PIC files are identified by
-the suffix \".pic\"; Fig files can be specified either with or without the
-suffix \".fig\".  Transfig also creates a TeX macro file appropriate to the
-target language.")
-    (license bsd-2)))
+    (license license:bsd-2)))