code:
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2016, 2019 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
;;; Copyright © 2017, 2019 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2019 Miguel <rosen644835@gmail.com>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2020 EuAndreh <eu@euandre.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages gettext)
  #:use-module ((guix licenses) #:select (gpl2+ gpl3+ bsd-3))
  #:use-module (gnu packages)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system perl)
  #:use-module (guix build-system python)
  #:use-module (gnu packages check)
  #:use-module (gnu packages docbook)
  #:use-module (gnu packages emacs)
  #:use-module (gnu packages hurd)
  #:use-module (gnu packages libunistring)
  #:use-module (gnu packages ncurses)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages perl-check)
  #:use-module (gnu packages tex)
  #:use-module (gnu packages xml)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages sphinx)
  #:use-module (guix utils))

(define-public gettext-minimal
  (package
    (name "gettext-minimal")
    (version "0.20.1")
    (source (origin
              (method url-fetch)
              (uri (string-append "mirror://gnu/gettext/gettext-"
                                  version ".tar.gz"))
              (sha256
               (base32
                "0p3zwkk27wm2m2ccfqm57nj7vqkmfpn7ja1nf65zmhz8qqs5chb6"))))
    (build-system gnu-build-system)
    (outputs '("out"
               "doc"))                            ;9 MiB of HTML
    (inputs
     `(("libunistring" ,libunistring)
       ("libxml2" ,libxml2)

       ;; TODO: ncurses is only needed for the 'libtextstyle' library.
       ;; The next version of gettext can use a separate libtextstyle,
       ;; but for now we include it here in 'gettext-minimal'.
       ("ncurses" ,ncurses)))
    (arguments
     `(#:configure-flags '("--with-included-libunistring=no"
                           "--with-included-libxml=no")
       #:phases
       (modify-phases %standard-phases
         (add-before 'patch-source-shebangs 'patch-fixed-paths
           (lambda _
             (substitute* '("gettext-tools/config.h.in"
                            "gettext-tools/gnulib-tests/init.sh"
                            "gettext-tools/tests/init.sh"
                            "gettext-tools/system-tests/run-test")
               (("/bin/sh") "sh"))
             (substitute* '("gettext-tools/src/project-id"
                            "gettext-tools/projects/KDE/trigger"
                            "gettext-tools/projects/GNOME/trigger")
               (("/bin/pwd") "pwd"))
             #t))
        (add-before 'check 'patch-tests
         (lambda* (#:key inputs #:allow-other-keys)
           (let* ((bash (which "sh")))
             ;; Some of the files we're patching are
             ;; ISO-8859-1-encoded, so choose it as the default
             ;; encoding so the byte encoding is preserved.
             (with-fluids ((%default-port-encoding #f))
               (substitute*
                   (find-files "gettext-tools/tests"
                               "^(lang-sh|msg(exec|filter)-[0-9])")
                 (("#![[:blank:]]/bin/sh")
                  (format #f "#!~a" bash)))

               (substitute* (cons "gettext-tools/src/msginit.c"
                                  (find-files "gettext-tools/gnulib-tests"
                                              "posix_spawn"))
                 (("/bin/sh")
                  bash))

               (substitute* "gettext-tools/src/project-id"
                 (("/bin/pwd")
                  "pwd"))

               #t)))))

       ;; When tests fail, we want to know the details.
       #:make-flags '("VERBOSE=yes"
                      ,@(if (hurd-target?)
                            ;; Linking to libgettextlib.so makes test-raise fail
                            '("XFAIL_TESTS=test-raise")
                            '()))))
    (home-page "https://www.gnu.org/software/gettext/")
    (synopsis
     "Tools and documentation for translation (used to build other packages)")
    (description
     "GNU Gettext is a package providing a framework for translating the
textual output of programs into multiple languages.  It provides translators
with the means to create message catalogs, and a runtime library to load
translated messages from the catalogs.  Nearly all GNU packages use Gettext.")
    (properties `((upstream-name . "gettext")
                  (cpe-name . "gettext")))
    (license gpl3+)))                             ;some files are under GPLv2+

;; Use that name to avoid clashes with Guile's 'gettext' procedure.
;;
;; We used to resort to #:renamer on the user side, but that prevented
;; circular dependencies involving (gnu packages gettext).  This is because
;; 'resolve-interface' (as of Guile 2.0.9) iterates eagerly over the used
;; module when there's a #:renamer, and that module may be empty at that point
;; in case or circular dependencies.
(define-public gnu-gettext
  (package/inherit gettext-minimal
    (name "gettext")
    (arguments
     (substitute-keyword-arguments (package-arguments gettext-minimal)
       ((#:phases phases)
        `(modify-phases ,phases
           (add-after 'install 'add-emacs-autoloads
             (lambda* (#:key outputs #:allow-other-keys)
               ;; Make 'po-mode' and other things available by default.
               (with-directory-excursion
                   (string-append (assoc-ref outputs "out")
                                  "/share/emacs/site-lisp")
                 (symlink "start-po.el" "gettext-autoloads.el")
                 #t)))))))
    (native-inputs `(("emacs" ,emacs-minimal))) ; for Emacs tools
    (synopsis "Tools and documentation for translation")))

(define-public libtextstyle
  (package
    (name "libtextstyle")
    (version "0.21")
    (source (origin
              (inherit (package-source gnu-gettext))
              (uri (string-append "mirror://gnu/gettext/gettext-"
                                  version ".tar.gz"))
              (sha256
               (base32
                "04kbg1sx0ncfrsbr85ggjslqkzzb243fcw9nyh3rrv1a22ihszf7"))))
    (build-system gnu-build-system)
    (arguments
     '(#:configure-flags '("--disable-static")
       #:phases (modify-phases %standard-phases
                  (add-after 'unpack 'chdir
                    (lambda _
                      (chdir "libtextstyle")
                      #t)))))
    ;; libtextstyle bundles libxml2, glib (a small subset thereof), and
    ;; libcroco, but it purposefully prevents users from using an external
    ;; copy, to reduce the startup time of programs using libtextstyle.
    (home-page "https://www.gnu.org/software/gettext/")
    (synopsis "Text styling library")
    (description
     "GNU libtextstyle is a C library that provides an easy way to add styling
to programs that produce output to a console or terminal emulator window.  It
allows applications to emit text annotated with styling information, such as
color, font attributes (weight, posture), or underlining.")
    (license gpl3+)))

(define-public mdpo
  (package
    (name "mdpo")
    (version "0.3.6")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "mdpo" version))
       (sha256
        (base32 "0kgbm0af7jwpfspa2xxiy9nc2l1r2s1rhbhz4r229zcqv49ak6sq"))))
    (build-system python-build-system)
    (native-inputs
     `(("python-bump2version" ,python-bump2version)
       ("python-flake8" ,python-flake8)
       ("python-flake8-implicit-str-concat" ,python-flake8-implicit-str-concat)
       ("python-flake8-print" ,python-flake8-print)
       ("python-isort" ,python-isort)
       ("python-pre-commit" ,python-pre-commit)
       ("python-pytest" ,python-pytest)
       ("python-pytest-cov" ,python-pytest-cov)
       ("python-sphinx" ,python-sphinx)
       ("python-sphinx-argparse" ,python-sphinx-argparse)
       ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
       ("python-twine" ,python-twine)
       ("python-yamllint" ,python-yamllint)))
    (propagated-inputs
     `(("python-polib" ,python-polib)
       ("python-pymd4c" ,python-pymd4c)))
    (home-page "https://github.com/mondeja/mdpo")
    (synopsis "Markdown file translation utilities using pofiles")
    (description
     "The mdpo utility creates pofiles, the format stabilished by GNU Gettext,
from Markdown files.")
    (license bsd-3)))

(define-public po4a
  (package
    (name "po4a")
    (version "0.63")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://github.com/mquinson/po4a/releases/download/v"
                                  version "/po4a-" version ".tar.gz"))
              (sha256
               (base32
                "1kmlfpdl1i1wrcdn0k1frh44fq10sfwswi3azvibli2lakpf66z2"))))
    (build-system perl-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'install 'wrap-programs
          (lambda* (#:key outputs #:allow-other-keys)
            ;; Make sure all executables in "bin" find the Perl modules
            ;; provided by this package at runtime.
            (let* ((out  (assoc-ref outputs "out"))
                   (bin  (string-append out "/bin/"))
                   (path (string-append out "/lib/perl5/site_perl")))
              (for-each (lambda (file)
                          (wrap-program file
                            `("PERL5LIB" ":" prefix (,path))))
                        (find-files bin "\\.*$"))
              #t)))
         (add-before 'reset-gzip-timestamps 'make-compressed-files-writable
           (lambda* (#:key outputs #:allow-other-keys)
             (for-each make-file-writable
                       (find-files (string-append (assoc-ref outputs "out")
                                                  "/share/man")
                                   ".*\\.gz$"))
             #t))
         (add-after 'unpack 'patch-docbook-xml
           (lambda* (#:key inputs #:allow-other-keys)
             (substitute* (find-files "." ".*\\.xml(-good)?")
               (("http://www.oasis-open.org/docbook/xml/4.1.2/")
                (string-append (assoc-ref inputs "docbook-xml")
                               "/xml/dtd/docbook/")))
             #t))
         (add-before 'check 'disable-failing-tests
           (lambda _
             ;; FIXME: these tests require SGMLS.pm.
             (delete-file "t/01-classes.t")

             (delete-file "t/add.t")
             (delete-file "t/core-porefs.t")
             (delete-file "t/fmt-asciidoc.t")
             (delete-file "t/fmt-sgml.t")

             #t)))))
    (native-inputs
     `(("gettext" ,gettext-minimal)
       ("perl-module-build" ,perl-module-build)
       ("docbook-xsl" ,docbook-xsl)
       ("libxml2" ,libxml2)
       ("xsltproc" ,libxslt)

       ;; For tests.
       ("docbook-xml" ,docbook-xml-4.1.2)
       ("perl-test-pod" ,perl-test-pod)
       ("perl-yaml-tiny" ,perl-yaml-tiny)
       ("texlive" ,texlive-tiny)))
    (home-page "https://po4a.org/")
    (synopsis "Scripts to ease maintenance of translations")
    (description
     "The po4a (PO for anything) project goal is to ease translations (and
more interestingly, the maintenance of translations) using gettext tools on
areas where they were not expected like documentation.")
    (license gpl2+)))

repo_name: maximed/guix

license: mit


code:
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2014, 2015, 2016, 2017 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2013, 2015, 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018, 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages ghostscript)
  #:use-module (gnu packages)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages cups)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages image)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages python)
  #:use-module (gnu packages tcl)
  #:use-module (gnu packages xorg)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix utils)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system trivial)
  #:use-module (srfi srfi-1))

(define-public lcms
  (package
   (name "lcms")
   (version "2.9")
   (source (origin
            (method url-fetch)
            (uri (string-append "mirror://sourceforge/lcms/lcms/" version
                                "/lcms2-" version ".tar.gz"))

            (patches (search-patches "lcms-CVE-2018-16435.patch"))
            (sha256 (base32
                     "083xisy6z01zhm7p7rgk4bx9d6zlr8l20qkfv1g29ylnhgwzvij8"))))
   (build-system gnu-build-system)
   (arguments
    `(#:configure-flags '("--disable-static")))
   (inputs `(("libjpeg" ,libjpeg-turbo)
             ("libtiff" ,libtiff)
             ("zlib" ,zlib)))
   (synopsis "Little CMS, a small-footprint colour management engine")
   (description
    "Little CMS is a small-footprint colour management engine, with special
focus on accuracy and performance.  It uses the International Color
Consortium standard (ICC), approved as ISO 15076-1.")
   (license license:x11)
   (home-page "http://www.littlecms.com/")
   (properties '((cpe-name . "little_cms_color_engine")))))

(define-public libpaper
  (package
   (name "libpaper")
   (version "1.1.24")
   (source (origin
            (method url-fetch)
            (uri (string-append
                   ;; Debian moved their libpaper-1.1.24 to archive.debian.net
                   ;; but in the move the hash of their tarball changed.
                   "http://pkgs.fedoraproject.org/repo/pkgs/libpaper/libpaper_"
                   version ".tar.gz/5bc87d494ba470aba54f6d2d51471834/libpaper_"
                   version ".tar.gz"))
            (sha256 (base32
                     "0zhcx67afb6b5r936w5jmaydj3ks8zh83n9rm5sv3m3k8q8jib1q"))))
   (build-system gnu-build-system)
   (native-inputs
    `(("automake" ,automake))) ; For up to date 'config.guess' and 'config.sub'.
   (arguments
    `(#:configure-flags '("--disable-static")
      #:phases
      (modify-phases %standard-phases
        (add-after 'unpack 'fix-configure
          (lambda* (#:key inputs native-inputs #:allow-other-keys)
            ;; Replace outdated config.sub and config.guess:
            (for-each (lambda (file)
                        (install-file
                         (string-append (assoc-ref
                                         (or native-inputs inputs) "automake")
                                        "/share/automake-"
                                        ,(version-major+minor
                                          (package-version automake))
                                        "/" file) "."))
                      '("config.sub" "config.guess"))
            #t)))))
   (synopsis "Library for handling paper sizes")
   (description
    "The paper library and accompanying files are intended to provide a simple
way for applications to take actions based on a system- or user-specified
paper size.")
   (license license:gpl2)
   (home-page "https://packages.qa.debian.org/libp/libpaper.html")))

(define-public psutils
  (package
   (name "psutils")
   (version "17")
   (source (origin
            (method url-fetch)
            (uri "ftp://ftp.knackered.org/pub/psutils/psutils.tar.gz")
            (sha256 (base32
                     "1r4ab1fvgganm02kmm70b2r1azwzbav2am41gbigpa2bb1wynlrq"))))
   (build-system gnu-build-system)
   (inputs `(("perl" ,perl)))
   (arguments
    `(#:tests? #f ; none provided
      #:phases
      (modify-phases %standard-phases
        (replace 'configure
          (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
           (let ((perl (assoc-ref inputs "perl"))
                 (out (assoc-ref outputs "out")))
            (copy-file "Makefile.unix" "Makefile")
            (substitute* "Makefile"
              (("/usr/local/bin/perl") (string-append perl "/bin/perl")))
            (substitute* "Makefile"
              (("/usr/local") out))
            ;; for the install phase
            (substitute* "Makefile"
              (("-mkdir") "mkdir -p"))
            ;; drop installation of non-free files
            (substitute* "Makefile"
              ((" install.include") "")))
           #t)))))
   (synopsis "Collection of utilities for manipulating PostScript documents")
   (description
    "PSUtils is a collection of utilities for manipulating PostScript
documents.  Programs included are psnup, for placing out several logical pages
on a single sheet of paper, psselect, for selecting pages from a document,
pstops, for general imposition, psbook, for signature generation for booklet
printing, and psresize, for adjusting page sizes.")
   (license (license:non-copyleft "file://LICENSE"
                                "See LICENSE in the distribution."))
   (home-page "http://knackered.org/angus/psutils/")))

(define-public ghostscript
  (package
    (name "ghostscript")
    (version "9.52")
    (source
      (origin
        (method url-fetch)
        (uri (string-append "https://github.com/ArtifexSoftware/"
                            "ghostpdl-downloads/releases/download/gs"
                            (string-delete #\. version)
                            "/ghostscript-" version ".tar.xz"))
        (sha256
         (base32
          "0z1w42y2jmcpl2m1l3z0sfii6zmvzcwcgzn6bydklia6ig7jli2p"))
        (patches (search-patches "ghostscript-freetype-compat.patch"
                                 "ghostscript-CVE-2020-15900.patch"
                                 "ghostscript-no-header-creationdate.patch"
                                 "ghostscript-no-header-id.patch"
                                 "ghostscript-no-header-uuid.patch"))
        (modules '((guix build utils)))
        (snippet
          ;; Remove bundled libraries. The bundled OpenJPEG is a patched fork so
          ;; we leave it, at least for now.
          ;; TODO Try unbundling ijs, which is developed alongside Ghostscript.
          ;; Likewise for the thread-safe lcms2 fork called "lcms2art".
         '(begin
            (for-each delete-file-recursively '("freetype" "jbig2dec" "jpeg"
                                                "libpng" "tiff" "zlib"))
            #t))))
    (build-system gnu-build-system)
    (outputs '("out" "doc"))                  ;19 MiB of HTML/PS doc + examples
    (arguments
     `(#:disallowed-references ("doc")
       ;; XXX: Starting with version 9.27, building the tests in parallel
       ;; occasionally fails like this:
       ;;  In file included from ./base/memory_.h:23:0,
       ;;                   from ./obj/gsmd5.h:1,
       ;;                   from ./obj/gsmd5.c:56:
       ;;  ./base/std.h:25:10: fatal error: arch.h: No such file or directory
       #:parallel-tests? #f
       #:configure-flags
       (list (string-append "LDFLAGS=-Wl,-rpath="
                            (assoc-ref %outputs "out") "/lib")
             "--with-system-libtiff"
             "LIBS=-lz"
             (string-append "ZLIBDIR="
                            (assoc-ref %build-inputs "zlib") "/include")
             "--enable-dynamic"
             "--disable-compile-inits"
             (string-append "--with-fontpath="
                            (assoc-ref %build-inputs "gs-fonts")
                            "/share/fonts/type1/ghostscript")

             ,@(if (%current-target-system)
                   '(;; Specify the native compiler, which is used to build 'echogs'
                     ;; and other intermediary tools when cross-compiling; see
                     ;; <https://ghostscript.com/FAQ.html>.
                     "CCAUX=gcc"

                     ;; Save 'config.log' etc. of the native build under
                     ;; auxtmp/, useful for debugging.
                     "--enable-save_confaux")
                   '()))
       #:phases
       (modify-phases %standard-phases
        (add-before 'configure 'create-output-directory
          (lambda* (#:key outputs #:allow-other-keys)
            ;; The configure script refuses to function if the directory
            ;; specified as -rpath does not already exist.
            (mkdir-p (string-append (assoc-ref outputs "out") "/lib"))
            #t))
        (add-after 'configure 'remove-doc-reference
          (lambda _
            ;; Don't retain a reference to the 'doc' output in 'gs'.
            ;; The only use of this definition is in the output of
            ;; 'gs --help', so this change is fine.
            (substitute* "base/gscdef.c"
              (("GS_DOCDIR")
               "\"~/.guix-profile/share/doc/ghostscript\""))
            #t))
         (add-after 'configure 'patch-config-files
           (lambda _
             (substitute* "base/unixhead.mak"
               (("/bin/sh") (which "sh")))
             #t))
         ,@(if (%current-target-system)
               `((add-after 'configure 'add-native-lz
                   (lambda _
                     ;; Add missing '-lz' for native tools such as 'mkromfs'.
                     (substitute* "Makefile"
                       (("^AUXEXTRALIBS=(.*)$" _ value)
                        (string-append "AUXEXTRALIBS = -lz " value "\n")))
                     #t)))
               '())
         (replace 'build
           (lambda _
             ;; Build 'libgs.so', but don't build the statically-linked 'gs'
             ;; binary (saves 22 MiB).
             (invoke "make" "so" "-j"
                     (number->string (parallel-job-count)))))
         (replace 'install
           (lambda _
             (invoke "make" "soinstall")))
         (add-after 'install 'create-gs-symlink
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               ;; Some programs depend on having a 'gs' binary available.
               (symlink "gsc" (string-append out "/bin/gs"))
               #t))))))
    (native-inputs
     `(("perl" ,perl)
       ("pkg-config" ,pkg-config)       ;needed for freetype
       ("python" ,python-wrapper)
       ("tcl" ,tcl)

       ;; When cross-compiling, some of the natively-built tools require all
       ;; these libraries.
       ,@(if (%current-target-system)
             `(("zlib/native" ,zlib)
               ("libjpeg/native" ,libjpeg-turbo))
             '())))
    (inputs
     `(("fontconfig" ,fontconfig)
       ("freetype" ,freetype)
       ("gs-fonts" ,gs-fonts)
       ("jbig2dec" ,jbig2dec)
       ("libjpeg" ,libjpeg-turbo)
       ("libpaper" ,libpaper)
       ("libpng" ,libpng)
       ("libtiff" ,libtiff)
       ("zlib" ,zlib)))
    (synopsis "PostScript and PDF interpreter")
    (description
     "Ghostscript is an interpreter for the PostScript language and the PDF
file format.  It also includes a C library that implements the graphics
capabilities of the PostScript language.  It supports a wide variety of
output file formats and printers.")
    (home-page "https://www.ghostscript.com/")
    (license license:agpl3+)))

(define-public ghostscript/x
  (package/inherit ghostscript
    (name (string-append (package-name ghostscript) "-with-x"))
    (inputs `(("libxext" ,libxext)
              ("libxt" ,libxt)
              ,@(package-inputs ghostscript)))))

(define-public ghostscript/cups
  (package/inherit ghostscript
    (name "ghostscript-with-cups")
    (inputs `(("cups" ,cups-minimal)
              ,@(package-inputs ghostscript)))))

(define-public ijs
  (package
   (name "ijs")
   (version (package-version ghostscript))
   (source (package-source ghostscript))
   (build-system gnu-build-system)
   (native-inputs
    `(("libtool"    ,libtool)
      ("automake"   ,automake)
      ("autoconf"   ,autoconf)))
   (arguments
    `(#:phases
      (modify-phases %standard-phases
        (add-after 'unpack 'autogen
          (lambda _
            ;; need to regenerate macros
            (system* "autoreconf" "-if")
            ;; do not run configure
            (substitute* "autogen.sh"
              (("^.*\\$srcdir/configure.*") ""))
            (system* "bash" "autogen.sh")
            ;; create configure script in ./ijs/
            (chdir "ijs")
            ;; do not run configure
            (substitute* "autogen.sh"
              (("^.*\\$srcdir/configure.*") "")
              (("^ + && echo Now type.*$")  ""))
            (invoke "bash" "autogen.sh"))))))
   (synopsis "IJS driver framework for inkjet and other raster devices")
   (description
    "IJS is a protocol for transmission of raster page images.  This package
provides the reference implementation of the raster printer driver
architecture.")
   (license license:expat)
   (home-page (package-home-page ghostscript))))

(define-public gs-fonts
  (package
   (name "gs-fonts")
   (version "8.11")
   (source (origin
            (method url-fetch)
            (uri (string-append "mirror://sourceforge/gs-fonts/gs-fonts/"
                                version
                                "%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-"
                                version
                                ".tar.gz"))
            (sha256 (base32
                     "00f4l10xd826kak51wsmaz69szzm2wp8a41jasr4jblz25bg7dhf"))))
   (build-system gnu-build-system)
   (arguments
    `(#:tests? #f ; nothing to check, just files to copy

      #:modules ((guix build gnu-build-system)
                 (guix build utils)
                 (srfi srfi-1))
      #:phases
      (modify-phases %standard-phases
        (delete 'configure)
        (delete 'build)
        (replace 'install
          (lambda* (#:key outputs #:allow-other-keys)
            (let* ((out (assoc-ref outputs "out"))
                   (dir (string-append out "/share/fonts/type1/ghostscript")))
              (mkdir-p dir)
              (for-each
                (lambda (file)
                  (copy-file file (string-append dir "/" file)))
                (find-files "." "pfb|afm"))
              #t))))))
   (synopsis "Free replacements for the PostScript fonts")
   (description
    "Ghostscript fonts provides fonts and font metrics customarily distributed with
Ghostscript.  It currently includes the 35 standard PostScript fonts.")
   (license license:gpl2)
   (home-page "https://sourceforge.net/projects/gs-fonts/")
   (properties
    ;; TODO: explicitely tell 'fonts-dir-file' that this is a font package,
    ;; as this package violates the convention that font package names are
    ;; prefixed with 'font-'.
    ;;
    ;; TODO(core-updates): Rename package to 'fonts-ghostscript' or something
    ;; like that.
    `((has-fonts? . #t)))))

(define-public libspectre
  (package
   (name "libspectre")
   (version "0.2.8")
   (source (origin
            (method url-fetch)
            (uri (string-append "https://libspectre.freedesktop.org/releases/libspectre-"
                                version ".tar.gz"))
            (sha256 (base32
                     "1a67iglsc3r05mzngyg9kb1gy8whq4fgsnyjwi7bqfw2i7rnl9b5"))))
   (build-system gnu-build-system)
   (inputs `(("ghostscript" ,ghostscript)))
   (native-inputs `(("pkg-config" ,pkg-config)))
   (synopsis "Postscript rendering library")
   (description
    "libspectre is a small library for rendering Postscript documents.
It provides a convenient easy to use API for handling and rendering
Postscript documents.")
   (license license:gpl2+)
   (home-page "https://www.freedesktop.org/wiki/Software/libspectre")))


code:
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016, 2018 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2016, 2017, 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018, 2020 Leo Famulari <leo@famulari.name>
;;; Copyright © 2018 Thorsten Wilms <t_w_@freenet.de>
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages gimp)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix utils)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system glib-or-gtk)
  #:use-module (guix build-system meson)
  #:use-module (gnu packages)
  #:use-module (gnu packages algebra)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages base)
  #:use-module (gnu packages build-tools)
  #:use-module (gnu packages documentation)
  #:use-module (gnu packages graphviz)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages gnome)
  #:use-module (gnu packages graphics)
  #:use-module (gnu packages image)
  #:use-module (gnu packages ghostscript)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages xml)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages ncurses)
  #:use-module (gnu packages patchutils)
  #:use-module (gnu packages pdf)
  #:use-module (gnu packages photo)
  #:use-module (gnu packages python)
  #:use-module (gnu packages web)
  #:use-module (gnu packages xorg))

(define-public poly2tri-c
  (package
    (name "poly2tri-c")
    (version "0.1.0")
    (source
     (origin
       (method url-fetch)
       (uri
        (string-append "https://storage.googleapis.com/"
                       "google-code-archive-source/v2/code.google.com/"
                       "poly2tri-c/source-archive.zip"))
       (file-name
        (string-append name "-" version ".zip"))
       (sha256
        (base32 "17cw0zhbnf2gb59jm26z0wcarqgdwir9jr1fpi3v9lcvyb2s3mqj"))))
    (build-system glib-or-gtk-build-system)
    (outputs '("out" "doc"))
    (arguments
     `(#:configure-flags
       (list
        "--disable-static")
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'disable-strict-rules
           (lambda _
             (substitute* "configure.ac"
               (("\\$CFLAGS -Wall -ansi -pedantic")
                "$CFLAGS")
               (("\\$CFLAGS -Werror")
                "$CFLAGS"))
             #t))
         (add-after 'disable-strict-rules 'fix-build-errors
           (lambda _
             (substitute* "poly2tri-c/refine/Makefile.am"
               (("cdt.c")
                "rcdt.c")
               (("cdt.h")
                "rcdt.h")
               (("utils.c")
                "rutils.c")
               (("utils.h")
                "rutils.h"))
             #t))
         (add-before 'bootstrap 'configure-later
           (lambda _
             (setenv "NOCONFIGURE" "set")
             #t))
         (add-after 'build 'generate-doc
           (lambda _
             (invoke "doxygen")
             #t))
         (add-after 'install 'install-doc
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (doc (assoc-ref outputs "doc")))
               (copy-recursively
                "doc"
                (string-append doc "/share/doc/poly2tri-c"))
               #t))))))
    (native-inputs
     `(("autoconf" ,autoconf)
       ("automake" ,automake)
       ("doxygen" ,doxygen)
       ("libtool" ,libtool)
       ("pkg-config" ,pkg-config)
       ("unzip" ,unzip)
       ("which" ,which)))
    (propagated-inputs
     `(("glib" ,glib)))
    (synopsis "2D constrained Delaunay triangulation library")
    (description "Poly2Tri-C is a library for generating, refining and rendering
2-Dimensional Constrained Delaunay Triangulations.")
    (home-page "https://code.google.com/archive/p/poly2tri-c/")
    (license license:bsd-3)))

(define-public mrg
  (package
    (name "mrg")
    (version "0.1.4")
    (source
     (origin
       (method git-fetch)
       (uri
        (git-reference
         (url "https://github.com/hodefoting/mrg")
         (commit version)))
       (file-name
        (git-file-name name version))
       (sha256
        (base32 "106qhh0c11576cc5kh90ds0ram72d3r6n9sadw0y4krnhap6dvwk"))))
    (build-system meson-build-system)
    (arguments
     `(#:glib-or-gtk? #t))   ; To wrap binaries and/or compile schemas
    (native-inputs
     `(("pkg-config" ,pkg-config)))
    (propagated-inputs
     `(("alsa" ,alsa-lib)
       ("cairo" ,cairo)
       ("gtk+" ,gtk+)
       ("mmm" ,mmm)
       ("x11" ,libx11)))
    (synopsis "Microraptor GUI")
    (description "MrG is is a C API for creating user interfaces.  It can be
used as an application writing environment or as an interactive canvas for part
of a larger interface.")
    (home-page "https://github.com/hodefoting/mrg")
    (license license:lgpl2.0+)))

(define-public babl
  (package
    (name "babl")
    (version "0.1.86")
    (source (origin
              (method url-fetch)
              (uri (list (string-append "https://download.gimp.org/pub/babl/"
                                        (version-major+minor version)
                                        "/babl-" version ".tar.xz")
                         (string-append "https://ftp.gtk.org/pub/babl/"
                                        (version-major+minor version)
                                        "/babl-" version ".tar.xz")
                         (string-append "ftp://ftp.gtk.org/pub/babl/"
                                        (version-major+minor version)
                                        "/babl-" version ".tar.xz")))
              (sha256
               (base32
                "1w68h81kqkqnziixrx21qs0gfv2z79651h19sxn226xdb58mjgqb"))))
    (build-system meson-build-system)
    (arguments
     `(#:meson ,meson-0.55
       #:configure-flags
       (list "-Denable-gir=false")))
    (native-inputs
     `(("pkg-config" ,pkg-config)))
    (propagated-inputs
     ;; Propagated to satisfy ‘babl.pc’.
     `(("lcms" ,lcms)))
    (home-page "https://gegl.org/babl/")
    (synopsis "Image pixel format conversion library")
    (description
     "Babl is a dynamic, any-to-any pixel format translation library.
It allows converting between different methods of storing pixels, known as
@dfn{pixel formats}, that have different bit depths and other data
representations, color models, and component permutations.

A vocabulary to formulate new pixel formats from existing primitives is
provided, as well as a framework to add new color models and data types.")
    (license license:lgpl3+)))

(define-public gegl
  (package
    (name "gegl")
    (version "0.4.30")
    (source (origin
              (method url-fetch)
              (uri (list (string-append "https://download.gimp.org/pub/gegl/"
                                        (string-take version 3)
                                        "/gegl-" version ".tar.xz")
                         (string-append "https://ftp.gtk.org/pub/gegl/"
                                        (version-major+minor version)
                                        "/gegl-" version ".tar.xz")
                         (string-append "ftp://ftp.gtk.org/pub/gegl/"
                                        (version-major+minor version)
                                        "/gegl-" version ".tar.xz")))
              (sha256
               (base32
                "1pd8xkx70k0fsi1hrzrmaify7112wjmxzk0p6bi6js89yhn7h4n1"))))
    (build-system meson-build-system)
    (arguments
     `(#:meson ,meson-0.55
       #:configure-flags
       (list "-Dintrospection=false")
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'extend-test-time-outs
           (lambda _
             ;; Multiply some poorly-chosen time-outs for busy build machines.
             (substitute* "tests/simple/test-node-exponential.c"
               (("G_TIME_SPAN_SECOND" match)
                (string-append "10 * " match)))
             (substitute* "tests/simple/test-buffer-sharing.c"
               (("g_timeout_add_seconds\\([0-9]+" match)
                (string-append match "0")))
             (substitute* (find-files "tests" "^meson\\.build$")
               (("timeout ?: [0-9]+" match)
                (string-append match "0")))
             #t)))))
    ;; These are propagated to satisfy 'gegl-0.4.pc'.
    (propagated-inputs
     `(("babl" ,babl)
       ("glib" ,glib)
       ("json-glib" ,json-glib)))
    (inputs
     `(("cairo" ,cairo)
       ("pango" ,pango)
       ("libpng" ,libpng)
       ("libjpeg" ,libjpeg-turbo)))
    (native-inputs
     `(("pkg-config" ,pkg-config)
       ("glib" ,glib "bin")             ; for gtester
       ("intltool" ,intltool)))
    (home-page "https://gegl.org")
    (synopsis "Graph based image processing framework")
    (description "GEGL (Generic Graphics Library) provides infrastructure to
do demand based cached non destructive image editing on larger than RAM
buffers.")
    ;; The library itself is licensed under LGPL while the sample commandline
    ;; application and GUI binary gegl is licensed under GPL.
    (license (list license:lgpl3+ license:gpl3+))))

(define-public gimp
  (package
    (name "gimp")
    (version "2.10.24")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "https://download.gimp.org/pub/gimp/v"
                           (version-major+minor version)
                           "/gimp-" version ".tar.bz2"))
       (sha256
        (base32 "17lq6ns5qhspd171zqh76yf98xnn5n0hcl7hbhbx63cc6ribf6xx"))))
    (build-system gnu-build-system)
    (outputs '("out"
               "doc"))                            ; 9 MiB of gtk-doc HTML
    (arguments
     '(#:configure-flags
       (list (string-append "--with-html-dir="
                            (assoc-ref %outputs "doc")
                            "/share/gtk-doc/html")

             ;; Prevent the build system from running 'gtk-update-icon-cache'
             ;; which is not needed during the build because Guix runs it at
             ;; profile creation time.
             "ac_cv_path_GTK_UPDATE_ICON_CACHE=true"

             ;; Disable automatic network request on startup to check for
             ;; version updates.
             "--disable-check-update"

             ;; ./configure requests not to annoy upstream with packaging bugs.
             "--with-bug-report-url=https://bugs.gnu.org/guix")
       #:phases
       (modify-phases %standard-phases
         (add-after 'install 'install-sitecustomize.py
           ;; Install 'sitecustomize.py' into gimp's python directory to
           ;; add pygobject and pygtk to pygimp's search path.
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((pythonpath (getenv "PYTHONPATH"))
                    (out        (assoc-ref outputs "out"))
                    (sitecustomize.py
                     (string-append
                      out "/lib/gimp/2.0/python/sitecustomize.py")))
               (call-with-output-file sitecustomize.py
                 (lambda (port)
                   (format port "import site~%")
                   (format port "for dir in '~a'.split(':'):~%" pythonpath)
                   (format port "    site.addsitedir(dir)~%")))))))))
    (inputs
     `(("babl" ,babl)
       ("glib" ,glib)
       ("glib-networking" ,glib-networking)
       ("libtiff" ,libtiff)
       ("libwebp" ,libwebp)
       ("libjpeg" ,libjpeg-turbo)
       ("atk" ,atk)
       ("gexiv2" ,gexiv2)
       ("gtk+" ,gtk+-2)
       ("libmypaint" ,libmypaint)
       ("mypaint-brushes" ,mypaint-brushes-1.3)
       ("exif" ,libexif)                ; optional, EXIF + XMP support
       ("lcms" ,lcms)                   ; optional, color management
       ("librsvg" ,librsvg)             ; optional, SVG support
       ("libxcursor" ,libxcursor)       ; optional, Mouse Cursor support
       ("poppler" ,poppler)             ; optional, PDF support
       ("poppler-data" ,poppler-data)
       ("python" ,python-2)             ; optional, Python support
       ("python2-pygtk" ,python2-pygtk) ; optional, Python support
       ("gegl" ,gegl)))
    (native-inputs
     `(("glib:bin" ,glib "bin") ; for glib-compile-resources and gdbus-codegen
       ("pkg-config" ,pkg-config)
       ("intltool" ,intltool)))
    (home-page "https://www.gimp.org")
    (synopsis "GNU Image Manipulation Program")
    (description
     "GIMP is an application for image manipulation tasks such as photo
retouching, composition and authoring.  It supports all common image formats
as well as specialized ones.  It features a highly customizable interface
that is extensible via a plugin system.")
    (license license:gpl3+))) ; some files are lgplv3

(define-public gimp-fourier
  (package
    (name "gimp-fourier")
    (version "0.4.3-2")
    (source (origin
              (method url-fetch)
              (uri (string-append "http://registry.gimp.org/files/fourier-"
                                  version ".tar.gz"))
              (sha256
               (base32
                "1rpacyad678lqgxa3hh2n0zpg4azs8dpa8q079bqsl12812k9184"))))
    (build-system gnu-build-system)
    (arguments
     `(#:tests? #f ;no tests
       #:phases
       (modify-phases %standard-phases
         ;; FIXME: The gegl package only installs "gegl-0.4.pc", but
         ;; "gimp-2.0.pc" requires "gegl-0.3.pc", so we just copy it.
         (replace 'configure
           (lambda* (#:key inputs #:allow-other-keys)
             (mkdir-p "tmppkgconfig")
             (copy-file (string-append (assoc-ref inputs "gegl")
                                       "/lib/pkgconfig/gegl-0.4.pc")
                        "tmppkgconfig/gegl-0.3.pc")
             (setenv "PKG_CONFIG_PATH"
                     (string-append "tmppkgconfig:"
                                    (or (getenv "PKG_CONFIG_PATH") "")))
             #t))
         (add-after 'unpack 'set-prefix
           (lambda* (#:key outputs #:allow-other-keys)
             ;; gimptool-2.0 does not allow us to install to any target
             ;; directory.
             (let ((target (string-append (assoc-ref outputs "out")
                                          "/lib/gimp/"
                                          (car (string-split ,(package-version gimp) #\.))
                                          ".0/plug-ins")))
               (substitute* "Makefile"
                 (("\\$\\(PLUGIN_INSTALL\\) fourier")
                  (string-append "cp fourier " target)))
               (mkdir-p target))
             #t)))))
    (inputs
     `(("fftw" ,fftw)
       ("gimp" ,gimp)
       ;; needed by gimp-2.0.pc
       ("gdk-pixbuf" ,gdk-pixbuf)
       ("gegl" ,gegl)
       ("cairo" ,cairo)
       ("glib" ,glib)
       ;; needed by gimpui-2.0.pc
       ("gtk+" ,gtk+-2)))
    (native-inputs
     `(("pkg-config" ,pkg-config)))
    (home-page "https://www.lprp.fr/gimp_plugin_en/#fourier")
    (synopsis "GIMP plug-in to edit image in fourier space")
    (description
     "This package provides a simple plug-in to apply the fourier transform on
an image, allowing you to work with the transformed image inside GIMP.  You
can draw or apply filters in fourier space and get the modified image with an
inverse fourier transform.")
    (license license:gpl3+)))

(define-public libmypaint
  (package
    (name "libmypaint")
    (version "1.6.1")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://github.com/mypaint/libmypaint/"
                                  "releases/download/v" version "/libmypaint-"
                                  version ".tar.xz"))
              (sha256
               (base32
                "0priwpmc7dizccqvn21ig6d649bprl3xl1hmjj7nddznjgr585vl"))))
    (build-system gnu-build-system)
    (native-inputs
     `(("intltool" ,intltool)
       ("pkg-config" ,pkg-config)))
    ;; As needed by 'libmypaint.pc'.
    (propagated-inputs
     `(("json-c" ,json-c)
       ("gobject-introspection" ,gobject-introspection)))
    (inputs
     `(("glib" ,glib)))
    (synopsis "Artistic brushes library")
    (description "Libmypaint, also called \"brushlib\", is a library for making
brushstrokes which is used by MyPaint and GIMP.")
    (home-page "http://mypaint.org")
    (license license:isc)))

(define-public mypaint-brushes
  (package
    (name "mypaint-brushes")
    (version "2.0.2")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/mypaint/mypaint-brushes")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0kcqz13vzpy24dhmrx9hbs6s7hqb8y305vciznm15h277sabpmw9"))))
    (build-system gnu-build-system)
    (native-inputs
     `(("autoconf" ,autoconf)
       ("automake" ,automake)))
    (synopsis "Default brushes for MyPaint")
    (description "This package provides the default set of brushes for
MyPaint.")
    (home-page "https://github.com/mypaint/mypaint-brushes/")
    ;; Scripts are distributed under GPL2+ terms, brushes are provided as
    ;; public domain or under CC0 terms.
    (license (list license:gpl2+ license:cc0 license:public-domain))))

(define-public mypaint-brushes-1.3
  (package
    (inherit mypaint-brushes)
    (name "mypaint-brushes")
    (version "1.3.1")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/mypaint/mypaint-brushes")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1c95l1vfz7sbrdlzrbz7h1p6s1k113kyjfd9wfnxlm0p6562cz3j"))))))

(define-public gimp-resynthesizer
  ;; GIMP does not respect any plugin search path environment variable, so after
  ;; installation users have to edit their GIMP settings to include
  ;; "$HOME/.guix-profile/lib/gimp/2.0/plug-ins/" in
  ;; “Edit->Preferences->Folders->Plug Ins”.
  (package
    (name "gimp-resynthesizer")
    (version "2.0.3")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
              (url "https://github.com/bootchk/resynthesizer")
              (commit (string-append "v" version))))
       (sha256
        (base32
         "1jwc8bhhm21xhrgw56nzbma6fwg59gc8anlmyns7jdiw83y0zx3j"))
       (file-name (git-file-name name version))))
    (build-system gnu-build-system)
    (arguments
     `( ;; Turn off tests to avoid:
       ;; make[1]: *** No rule to make target '../src/resynth-gui.c', needed by 'resynthesizer.pot'.  Stop.
       #:tests? #f
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'set-env
           (lambda _
             (setenv "CONFIG_SHELL" (which "sh"))
             #t))
         (add-after 'configure 'set-prefix
           ;; Install plugin under $prefix, not under GIMP's libdir.
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((target (string-append (assoc-ref outputs "out")
                                          "/lib/gimp/"
                                          ,(version-major
                                            (package-version gimp))
                                          ".0")))
               (substitute* (list "src/resynthesizer/Makefile"
                                  "src/resynthesizer-gui/Makefile")
                 (("GIMP_LIBDIR = .*")
                  (string-append "GIMP_LIBDIR = " target "\n")))
               (mkdir-p target)
               #t))))))
    (native-inputs
     ;; avoid ./autogen.sh: ./configure: /bin/sh: bad interpreter:
     ;; No such file or directory
     `(("autoconf" ,autoconf-wrapper)
       ("automake" ,automake)
       ("glib" ,glib "bin")                       ; glib-gettextize
       ("intltool" ,intltool)
       ("pkg-config" ,pkg-config)))
    (inputs
     `(("gimp" ,gimp)
       ("gdk-pixbuf" ,gdk-pixbuf)                 ; needed by gimp-2.0.pc
       ("cairo" ,cairo)
       ("gegl" ,gegl)
       ("gtk+" ,gtk+-2)                           ; needed by gimpui-2.0.pc
       ("glib" ,glib)))
    (home-page "https://github.com/bootchk/resynthesizer")
    (synopsis "GIMP plugins for texture synthesis")
    (description
     "This package provides resynthesizer plugins for GIMP, which encompasses
tools for healing selections (content-aware fill), enlarging the canvas and
healing the border, increasing the resolution while adding detail, and
transferring the style of an image.")
    (license license:gpl3+)))

(define gegl-for-glimpse
  ;; Remove this when GIMP commit 2cae9b9acf9da98c4c9990819ffbd5aabe23017e
  ;; makes it into Glimpse.
  (package
    (inherit gegl)
    (arguments
     (substitute-keyword-arguments (package-arguments gegl)
       ((#:phases phases)
        `(modify-phases ,phases
           (add-after 'unpack 'refer-to-dot
             ;; XXX Without ‘dot’ in $PATH, Glimpse would fail to start with an
             ;; extremely obtuse ‘GEGL operation missing!’ error.
             (lambda _
               (substitute* "gegl/gegl-dot.c"
                 (("\"dot ")
                  (format #f "\"~a " (which "dot"))))
               (substitute* "operations/common/introspect.c"
                 (("g_find_program_in_path \\(\"dot\"\\)")
                  (format #f "g_strdup (\"~a\")" (which "dot"))))))))))
    (inputs
     `(,@(package-inputs gegl)
       ("graphviz" ,graphviz)))))

(define-public glimpse
  (package
    (name "glimpse")
    (version "0.2.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                     (url "https://github.com/glimpse-editor/Glimpse")
                     (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0drngj2xqzxfaag6pc4xjffiw003n4y43x5rb5bf4ziv1ac51dm9"))))
    (build-system gnu-build-system)
    (outputs '("out"
               "doc"))                            ; 9 MiB of gtk-doc HTML
    (arguments
     '(#:configure-flags
       (list (string-append "--with-html-dir="
                            (assoc-ref %outputs "doc")
                            "/share/gtk-doc/html")
             "--enable-gtk-doc"

             ;; Prevent the build system from running 'gtk-update-icon-cache'
             ;; which is not needed during the build because Guix runs it at
             ;; profile creation time.
             "ac_cv_path_GTK_UPDATE_ICON_CACHE=true"

             ;; Disable automatic network request on startup to check for
             ;; version updates.
             "--disable-check-update"

             ;; ./configure requests not to annoy upstream with packaging bugs.
             "--with-bug-report-url=https://bugs.gnu.org/guix")
       #:phases
       (modify-phases %standard-phases
         (add-after 'install 'install-sitecustomize.py
           ;; Install 'sitecustomize.py' into glimpse's python directory to
           ;; add pygobject and pygtk to pygimp's search path.
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((pythonpath (getenv "PYTHONPATH"))
                    (out        (assoc-ref outputs "out"))
                    (sitecustomize.py
                     (string-append
                      out "/lib/glimpse/2.0/python/sitecustomize.py")))
               (call-with-output-file sitecustomize.py
                 (lambda (port)
                   (format port "import site~%")
                   (format port "for dir in '~a'.split(':'):~%" pythonpath)
                   (format port "    site.addsitedir(dir)~%")))))))))
    (native-inputs
     `(("autoconf" ,autoconf)
       ("automake" ,automake)
       ("gtk-doc" ,gtk-doc)
       ("intltool" ,intltool)
       ("libtool" ,libtool)
       ("libxslt" ,libxslt) ; for xsltproc
       ("pkg-config" ,pkg-config)
       ("glib:bin" ,glib "bin"))) ; for gdbus-codegen
    (inputs
     `(("babl" ,babl)
       ("glib" ,glib)
       ("glib-networking" ,glib-networking)
       ("libtiff" ,libtiff)
       ("libwebp" ,libwebp)
       ("libjpeg" ,libjpeg-turbo)
       ("atk" ,atk)
       ("gexiv2" ,gexiv2)
       ("gtk+" ,gtk+-2)
       ("libmypaint" ,libmypaint)
       ("mypaint-brushes" ,mypaint-brushes-1.3)
       ("exif" ,libexif)                ; optional, EXIF + XMP support
       ("lcms" ,lcms)                   ; optional, color management
       ("librsvg" ,librsvg)             ; optional, SVG support
       ("libxcursor" ,libxcursor)       ; optional, Mouse Cursor support
       ("poppler" ,poppler)             ; optional, PDF support
       ("poppler-data" ,poppler-data)
       ("python" ,python-2)             ; optional, Python support
       ("python2-pygtk" ,python2-pygtk) ; optional, Python support
       ("gegl" ,gegl-for-glimpse)))     ; XXX see comment in gegl-for-glimpse
    (home-page "https://glimpse-editor.github.io/")
    (synopsis "Glimpse Image Editor")
    (description "The Glimpse Image Editor is an application for image
manipulation tasks such as photo retouching, composition and authoring.
It supports all common image formats as well as specialized ones.  It
features a highly customizable interface that is extensible via a plugin
system.  It was forked from the GNU Image Manipulation Program.")
    (license license:gpl3+)))


code:
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages gkrellm)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages gettext)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages xorg))

(define-public gkrellm
  (package
    (name "gkrellm")
    (version "2.3.11")
    (source
     (origin
      (method url-fetch)
      (uri (string-append "http://gkrellm.srcbox.net/releases/gkrellm-"
                          version ".tar.bz2"))
      (sha256
       (base32 "01lccz4fga40isv09j8rjgr0qy10rff9vj042n6gi6gdv4z69q0y"))))
    (build-system gnu-build-system)
    (inputs
     `(("gettext" ,gettext-minimal)
       ("gtk+" ,gtk+-2)
       ("libice" ,libice)
       ("libsm" ,libsm)))
    (native-inputs
     `(("pkg-config" ,pkg-config)))
    (arguments
     `(#:tests? #f                      ; there is no check target
       #:phases
       (modify-phases %standard-phases
         (delete 'configure))           ; no configure script
       #:make-flags
       (let ((out (assoc-ref %outputs "out")))
         (list (string-append "INSTALLROOT=" out)
               "CC=gcc"))))
    (home-page "http://gkrellm.srcbox.net/")
    (synopsis "System monitors")
    (description
     "GKrellM is a single process stack of system monitors which supports
applying themes to match its appearance to your window manager, Gtk, or any
other theme.")
    (license license:gpl3+)))