diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2021-02-04 16:22:48 +0100 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2021-02-04 16:23:26 +0100 |
commit | 0643488ed89b919ccdef4d57792c71ace85c3bd5 (patch) | |
tree | 71049de080caf5d87d851e31f516e0b25c8903d6 | |
parent | 6b99bf8a6f5c594d667e5f4c76d5d4771b9c99c0 (diff) | |
download | guix-0643488ed89b919ccdef4d57792c71ace85c3bd5.tar.gz |
gnu: Add r-freetypeharfbuzz.
* gnu/packages/cran.scm (r-freetypeharfbuzz): New variable.
-rw-r--r-- | gnu/packages/cran.scm | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm index d4de1f1eef..a8563da8ae 100644 --- a/gnu/packages/cran.scm +++ b/gnu/packages/cran.scm @@ -55,6 +55,7 @@ #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix utils) + #:use-module (guix build-system gnu) #:use-module (guix build-system r) #:use-module (gnu packages) #:use-module (gnu packages algebra) @@ -25960,3 +25961,79 @@ itself.")))) "This package provides a set of fonts. This is useful when you want to avoid system fonts to make sure your outputs are reproducible.") (license license:gpl3))) + +(define-public r-freetypeharfbuzz + (package + (name "r-freetypeharfbuzz") + (version "0.2.6") + (source + (origin + (method url-fetch) + (uri (cran-uri "freetypeharfbuzz" version)) + (sha256 + (base32 + "0r3icgnq3jk4fm6z92cmhzdmflbk5df8zsmjg0dzpc4y48xafnk7")))) + (properties + `((upstream-name . "freetypeharfbuzz"))) + (build-system r-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'prepare-static-libraries + (lambda* (#:key inputs #:allow-other-keys) + (mkdir-p "src/target/include") + (let ((freetype (assoc-ref inputs "static-freetype")) + (harfbuzz (assoc-ref inputs "static-harfbuzz"))) + (substitute* "src/Makevars.in" + (("include @MK_FILE@") "") ; do not build static libs + (("^HB_STATIC_LIB =.*") + (string-append "HB_STATIC_LIB = " harfbuzz "/lib/libharfbuzz.a\n")) + (("^FT_STATIC_LIB =.*") + (string-append "FT_STATIC_LIB = " freetype "/lib/libfreetype.a\n"))) + (copy-recursively (string-append freetype "/include") + "src/target/include") + (copy-recursively (string-append harfbuzz "/include") + "src/target/include"))))))) + (propagated-inputs + `(("r-fontquiver" ,r-fontquiver))) + ;; This may defeat the purpose of this package as our versions of freetype + ;; and harfbuzz obviously differ from the tarballs offered by this + ;; project. On the other hand, Guix arguably does a better job at + ;; "ensur[ing] deterministic computation". + (native-inputs + `(("static-freetype" + ,(package + (inherit (static-package freetype)) + (arguments + `(#:configure-flags + (list "--enable-static=yes" + "--with-pic=yes" + "--without-zlib" + "--without-bzip2" + "--without-png" + "--without-harfbuzz"))))) + ("static-harfbuzz" + ,(package + (inherit (static-package harfbuzz)) + (arguments + `(#:tests? #false ; fail because shared library is disabled + #:configure-flags + (list "--enable-static=yes" + "--enable-shared=no" + "--with-pic=yes" + "--with-freetype=yes" + "--without-icu" + "--without-cairo" + "--without-fontconfig" + "--without-glib"))))))) + (inputs + `(("zlib" ,zlib))) + (home-page "https://cran.r-project.org/package=freetypeharfbuzz") + (synopsis "Deterministic computation of text box metrics") + (description + "Unlike other tools that dynamically link to the Cairo stack, +freetypeharfbuzz is statically linked to specific versions of the FreeType and +harfbuzz libraries. This ensures deterministic computation of text box +extents for situations where reproducible results are crucial (for instance +unit tests of graphics).") + (license license:gpl3))) |