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,8 +316,9 @@ Font Format (WOFF).")
(license license:expat))) (license license:expat)))
(define-public fontconfig (define-public fontconfig
(hidden-package
(package (package
(name "fontconfig") (name "fontconfig-minimal")
(version "2.13.1") (version "2.13.1")
(source (origin (source (origin
(method url-fetch) (method url-fetch)
@ -327,7 +328,6 @@ Font Format (WOFF).")
(patches (search-patches "fontconfig-hurd-path-max.patch")) (patches (search-patches "fontconfig-hurd-path-max.patch"))
(sha256 (base32 (sha256 (base32
"0hb700a68kk0ip51wdlnjjc682kvlrmb6q920mzajykdk0mdsmgn")))) "0hb700a68kk0ip51wdlnjjc682kvlrmb6q920mzajykdk0mdsmgn"))))
(outputs '("out" "doc"))
(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)
@ -342,7 +342,8 @@ Font Format (WOFF).")
("pkg-config" ,pkg-config))) ("pkg-config" ,pkg-config)))
(arguments (arguments
`(#:configure-flags `(#:configure-flags
(list "--with-cache-dir=/var/cache/fontconfig" (list "--disable-docs"
"--with-cache-dir=/var/cache/fontconfig"
;; register the default fonts ;; register the default fonts
(string-append "--with-default-fonts=" (string-append "--with-default-fonts="
(assoc-ref %build-inputs "font-dejavu") (assoc-ref %build-inputs "font-dejavu")
@ -362,29 +363,7 @@ Font Format (WOFF).")
;; 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
(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"))
#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") (synopsis "Library for configuring and customizing font access")
(description (description
"Fontconfig can discover new fonts when installed automatically; "Fontconfig can discover new fonts when installed automatically;
@ -398,7 +377,41 @@ 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