Archived
1
0
Fork 0

gnu: fontconfig-with-documentation: New variable.

In what will become fontconfig 2.14, the complete documentation of fontconfig
requires multiple dependencies that would be problematic to add to this core
package; instead, keep the 'fontconfig' variable package lean and create a new
'fontconfig-with-documentation' package that will be known as "fontconfig" to
the users.

* gnu/packages/fontutils.scm (fontconfig): Hide package.
[outputs]: Remove doc output.
[configure-flags]: Add "--disable-docs" argument.
[phases]{remove-pdf-files}: Remove phase.
{move-man-sections}: Move to...
(fontconfig-with-documentation): ... this new variable with a doc output.
This commit is contained in:
Maxim Cournoyer 2020-12-29 20:48:39 -05:00
parent 82f5f6b14c
commit 7f9da31c31
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -316,78 +316,57 @@ Font Format (WOFF).")
(license license:expat))) (license license:expat)))
(define-public fontconfig (define-public fontconfig
(package (hidden-package
(name "fontconfig") (package
(version "2.13.1") (name "fontconfig-minimal")
(source (origin (version "2.13.1")
(method url-fetch) (source (origin
(uri (string-append (method url-fetch)
"https://www.freedesktop.org/software/fontconfig/release/fontconfig-" (uri (string-append
version ".tar.bz2")) "https://www.freedesktop.org/software/fontconfig/release/fontconfig-"
(patches (search-patches "fontconfig-hurd-path-max.patch")) version ".tar.bz2"))
(sha256 (base32 (patches (search-patches "fontconfig-hurd-path-max.patch"))
"0hb700a68kk0ip51wdlnjjc682kvlrmb6q920mzajykdk0mdsmgn")))) (sha256 (base32
(outputs '("out" "doc")) "0hb700a68kk0ip51wdlnjjc682kvlrmb6q920mzajykdk0mdsmgn"))))
(build-system gnu-build-system) (build-system gnu-build-system)
;; In Requires or Requires.private of fontconfig.pc. ;; In Requires or Requires.private of fontconfig.pc.
(propagated-inputs `(("expat" ,expat) (propagated-inputs `(("expat" ,expat)
("freetype" ,freetype) ("freetype" ,freetype)
("libuuid" ,util-linux "lib"))) ("libuuid" ,util-linux "lib")))
(inputs (inputs
;; We use to use 'gs-fonts' but they are not recognized by newer versions ;; We use to use 'gs-fonts' but they are not recognized by newer versions
;; of Pango, causing many applications to fail to find fonts otherwise. ;; of Pango, causing many applications to fail to find fonts otherwise.
`(("font-dejavu" ,font-dejavu))) `(("font-dejavu" ,font-dejavu)))
(native-inputs (native-inputs
`(("gperf" ,gperf) `(("gperf" ,gperf)
("pkg-config" ,pkg-config))) ("pkg-config" ,pkg-config)))
(arguments (arguments
`(#:configure-flags `(#:configure-flags
(list "--with-cache-dir=/var/cache/fontconfig" (list "--disable-docs"
;; register the default fonts "--with-cache-dir=/var/cache/fontconfig"
(string-append "--with-default-fonts=" ;; register the default fonts
(assoc-ref %build-inputs "font-dejavu") (string-append "--with-default-fonts="
"/share/fonts") (assoc-ref %build-inputs "font-dejavu")
"/share/fonts")
;; Register fonts from user and system profiles. ;; Register fonts from user and system profiles.
(string-append "--with-add-fonts=" (string-append "--with-add-fonts="
"~/.guix-profile/share/fonts," "~/.guix-profile/share/fonts,"
"/run/current-system/profile/share/fonts") "/run/current-system/profile/share/fonts")
;; python is not actually needed ;; python is not actually needed
"PYTHON=false") "PYTHON=false")
#:phases #:phases
(modify-phases %standard-phases (modify-phases %standard-phases
(replace 'install (replace 'install
(lambda _ (lambda _
;; Don't try to create /var/cache/fontconfig. ;; Don't try to create /var/cache/fontconfig.
(invoke "make" "install" (invoke "make" "install"
"fc_cachedir=$(TMPDIR)" "fc_cachedir=$(TMPDIR)"
"RUN_FC_CACHE_TEST=false"))) "RUN_FC_CACHE_TEST=false"))))))
(add-after 'install 'move-man-sections (synopsis "Library for configuring and customizing font access")
(lambda* (#:key outputs #:allow-other-keys) (description
;; Move share/man/man{3,5} to the "doc" output. Leave "man1" in "Fontconfig can discover new fonts when installed automatically;
;; "out" for convenience.
(let ((out (assoc-ref outputs "out"))
(doc (assoc-ref outputs "doc")))
(for-each (lambda (section)
(let ((source (string-append out "/share/man/"
section))
(target (string-append doc "/share/man/"
section)))
(copy-recursively source target)
(delete-file-recursively source)))
'("man3" "man5"))
#t)))
(add-after 'install 'remove-pdf-files
(lambda* (#:key outputs #:allow-other-keys)
;; By default PDF versions of the user and development manuals are
;; installs but they bring nothing useful. Remove them.
(let ((doc (assoc-ref outputs "doc")))
(for-each delete-file (find-files doc "\\.pdf$"))
#t))))))
(synopsis "Library for configuring and customizing font access")
(description
"Fontconfig can discover new fonts when installed automatically;
perform font name substitution, so that appropriate alternative fonts can perform font name substitution, so that appropriate alternative fonts can
be selected if fonts are missing; be selected if fonts are missing;
identify the set of fonts required to completely cover a set of languages; identify the set of fonts required to completely cover a set of languages;
@ -395,10 +374,44 @@ have GUI configuration tools built as it uses an XML-based configuration file;
efficiently and quickly find needed fonts among the set of installed fonts; efficiently and quickly find needed fonts among the set of installed fonts;
be used in concert with the X Render Extension and FreeType to implement be used in concert with the X Render Extension and FreeType to implement
high quality, anti-aliased and subpixel rendered text on a display.") high quality, anti-aliased and subpixel rendered text on a display.")
; The exact license is more X11-style than BSD-style. ; The exact license is more X11-style than BSD-style.
(license (license:non-copyleft "file://COPYING" (license (license:non-copyleft "file://COPYING"
"See COPYING in the distribution.")) "See COPYING in the distribution."))
(home-page "https://www.freedesktop.org/wiki/Software/fontconfig"))) (home-page "https://www.freedesktop.org/wiki/Software/fontconfig"))))
;;; The documentation of fontconfig is built in a separate package, as it
;;; causes a dramatic increase in the size of the closure of fontconfig. This
;;; is intentionally named 'fontconfig', as it's intended as the user-facing
;;; fontconfig package.
(define-public fontconfig-with-documentation
(package
(inherit fontconfig)
(name "fontconfig")
(outputs (cons "doc" (package-outputs fontconfig)))
(arguments
(substitute-keyword-arguments (package-arguments fontconfig)
((#:configure-flags configure-flags)
`(delete "--disable-docs" ,configure-flags))
((#:phases phases '%standard-phases)
`(modify-phases ,phases
(add-after 'install 'move-man-sections
(lambda* (#:key outputs #:allow-other-keys)
;; Move share/man/man{3,5} to the "doc" output. Leave "man1" in
;; "out" for convenience.
(let ((out (assoc-ref outputs "out"))
(doc (assoc-ref outputs "doc")))
(for-each (lambda (section)
(let ((source (string-append out "/share/man/"
section))
(target (string-append doc "/share/man/"
section)))
(copy-recursively source target)
(delete-file-recursively source)))
'("man3" "man5")))))))))
(native-inputs
(append (package-native-inputs fontconfig)
`(("docbook-utils" ,docbook-utils))))
(properties (alist-delete 'hidden? (package-properties fontconfig)))))
(define-public t1lib (define-public t1lib
(package (package