This commit is contained in:
Daniel Ziltener 2023-12-19 01:52:05 +01:00
parent 697e2fd0e3
commit 2d173c035f

View File

@ -0,0 +1,121 @@
(define-module (zilti packages fontforge)
#:use-module (ice-9 regex)
#:use-module (guix gexp)
#:use-module (guix utils)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix build-system cmake)
#:use-module (gnu packages autotools)
#:use-module (gnu packages compression)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages gettext)
#:use-module (gnu packages gtk)
#:use-module (gnu packages image)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
#:use-module (gnu packages xml)
#:use-module (gnu packages xorg))
(define-public fontforge
(package
(name "fontforge")
(version "20230101")
(source (origin
(method url-fetch)
(uri (string-append
"https://github.com/fontforge/fontforge/releases/download/"
version "/fontforge-" version ".tar.xz"))
(sha256
(base32 "1y30bk9rdya8bkw4q77y6nq5xfg7nm0qliz5miqdlk8c0r6fr0na"))))
(build-system cmake-build-system)
(native-inputs
(list pkg-config))
(inputs `(("cairo" ,cairo)
("fontconfig" ,fontconfig) ;dlopen'd
("freetype" ,freetype)
("gettext" ,gettext-minimal)
("libICE" ,libice)
("libSM" ,libsm)
("libX11" ,libx11)
("libXi" ,libxi)
("libjpeg" ,libjpeg-turbo)
("libltdl" ,libltdl)
("libpng" ,libpng)
("libspiro" ,libspiro)
("libtiff" ,libtiff)
("libungif" ,libungif)
("libxft" ,libxft)
("libxml2" ,libxml2)
("pango" ,pango)
("potrace" ,potrace)
("python" ,python)
("zlib" ,zlib)))
(arguments
(list
#:configure-flags #~'( ;; TODO: Provide GTK+ for the Wayland-friendly GDK
;; backend, instead of the legacy X11 backend.
;; Currently it introduces a circular dependency.
"-DENABLE_X11=ON")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'do-not-override-RPATH
(lambda _
;; Do not attempt to set a default RPATH, as our ld-wrapper
;; already does the right thing.
(substitute* "CMakeLists.txt"
(("^set_default_rpath\\(\\)")
""))
#t))
#$@(if (target-hurd?)
#~((add-after 'unpack 'apply-hurd-patch
(lambda _
(let ((patch-file
#$(local-file
(search-patch "fontforge-hurd.patch"))))
(invoke "patch" "--force" "-p1" "-i" patch-file)))))
#~())
#$@(if (system-hurd?)
#~((replace 'check
;; cmake-build-system ignores #:make-flags for make check
(lambda* (#:key test-target tests? parallel-tests?
#:allow-other-keys)
(let ((skip '("test0001_py" "test0001_pyhook")))
(if tests?
(let ((jobs
(if parallel-tests?
(number->string (parallel-job-count))
"1")))
(invoke "make"
(string-append "ARGS=-j " jobs
" --exclude-regex ^"
(string-join skip "\\|")
"$")
test-target))
(format #t "test suite not run~%"))))))
#~())
(add-after 'install 'set-library-path
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(potrace (dirname
(search-input-file inputs "bin/potrace"))))
(wrap-program (string-append out "/bin/fontforge")
;; Fontforge dynamically opens libraries.
`("LD_LIBRARY_PATH" ":" prefix
,(map (lambda (input)
(string-append (assoc-ref inputs input)
"/lib"))
'("libtiff" "libjpeg" "libpng" "libungif"
"libxml2" "zlib" "libspiro" "freetype"
"pango" "cairo" "fontconfig")))
;; Checks for potrace program at runtime
`("PATH" ":" prefix (,potrace)))
#t))))))
(synopsis "Outline font editor")
(description
"FontForge allows you to create and modify postscript, truetype and
opentype fonts. You can save fonts in many different outline formats, and
generate bitmaps.")
(license license:gpl3+)
(home-page "https://fontforge.github.io")))