gnu: zstd: Move libraries to separate outputs.

* gnu/packages/compression.scm (zstd)[outputs]: New field.
[arguments]: Add phase 'adjust-libary-locations'.  Pass LIBDIR and INCLUDEDIR
in <#:make-flags>.
* gnu/packages/backup.scm (borg)[inputs]: Change ZSTD to ZSTD:LIB.
* gnu/packages/sync.scm (casync)[inputs]: Likewise.
* gnu/packages/tor.scm (tor)[inputs]: Likewise.
* gnu/packages/linux.scm (btrfs-progs)[inputs]: Likewise.  Add ZSTD:STATIC.
This commit is contained in:
Marius Bakke 2019-07-22 14:53:12 +02:00
parent 8dea61731b
commit ec0de9d8bc
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA
5 changed files with 35 additions and 6 deletions

View file

@ -627,7 +627,7 @@ (define-public borg
;; transitional package for now: ;; transitional package for now:
;; <https://bugs.gnu.org/30662> ;; <https://bugs.gnu.org/30662>
("python-msgpack" ,python-msgpack-transitional) ("python-msgpack" ,python-msgpack-transitional)
("zstd" ,zstd))) ("zstd" ,zstd "lib")))
(synopsis "Deduplicated, encrypted, authenticated and compressed backups") (synopsis "Deduplicated, encrypted, authenticated and compressed backups")
(description "Borg is a deduplicating backup program. Optionally, it (description "Borg is a deduplicating backup program. Optionally, it
supports compression and authenticated encryption. The main goal of Borg is to supports compression and authenticated encryption. The main goal of Borg is to

View file

@ -13,7 +13,7 @@
;;; Copyright © 2016, 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2016, 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2016 David Craven <david@craven.ch> ;;; Copyright © 2016 David Craven <david@craven.ch>
;;; Copyright © 2016, 2019 Kei Kebreau <kkebreau@posteo.net> ;;; Copyright © 2016, 2019 Kei Kebreau <kkebreau@posteo.net>
;;; Copyright © 2016, 2018 Marius Bakke <mbakke@fastmail.com> ;;; Copyright © 2016, 2018, 2019 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2017 ng0 <ng0@n0.is> ;;; Copyright © 2017 ng0 <ng0@n0.is>
;;; Copyright © 2017 Manolis Fragkiskos Ragkousis <manolis837@gmail.com> ;;; Copyright © 2017 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org> ;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
@ -1372,13 +1372,41 @@ (define-public zstd
(sha256 (sha256
(base32 "13nlsqhkn276frxrzjdn7wz0j9zz414lf336885ykyxcvw2a0gr9")))) (base32 "13nlsqhkn276frxrzjdn7wz0j9zz414lf336885ykyxcvw2a0gr9"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(outputs '("out" ;1.1MiB executables and documentation
"lib" ;1MiB shared library and headers
"static")) ;1MiB static library
(arguments (arguments
`(#:phases `(#:phases
(modify-phases %standard-phases (modify-phases %standard-phases
(delete 'configure)) ; no configure script (delete 'configure) ;no configure script
(add-after 'install 'adjust-library-locations
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(lib (assoc-ref outputs "lib"))
(static (assoc-ref outputs "static"))
(shared-libs (string-append lib "/lib"))
(static-libs (string-append static "/lib")))
;; Move the static library to its own output to save ~1MiB.
(mkdir-p static-libs)
(for-each (lambda (ar)
(link ar (string-append static-libs "/"
(basename ar)))
(delete-file ar))
(find-files shared-libs "\\.a$"))
;; While here, remove prefix= from the pkg-config file because it
;; is unused, and because it contains a needless reference to $out.
;; XXX: It would be great if #:disallow-references worked between
;; outputs.
(substitute* (string-append shared-libs "/pkgconfig/libzstd.pc")
(("^prefix=.*") ""))
#t))))
#:make-flags #:make-flags
(list "CC=gcc" (list "CC=gcc"
(string-append "PREFIX=" (assoc-ref %outputs "out")) (string-append "PREFIX=" (assoc-ref %outputs "out"))
(string-append "LIBDIR=" (assoc-ref %outputs "lib") "/lib")
(string-append "INCLUDEDIR=" (assoc-ref %outputs "lib") "/include")
;; Skip auto-detection of, and creating a dependency on, the build ;; Skip auto-detection of, and creating a dependency on, the build
;; environment's xz for what amounts to a dubious feature anyway. ;; environment's xz for what amounts to a dubious feature anyway.
"HAVE_LZMA=0" "HAVE_LZMA=0"

View file

@ -3862,7 +3862,8 @@ (define-public btrfs-progs
("lzo" ,lzo) ("lzo" ,lzo)
("zlib" ,zlib) ("zlib" ,zlib)
("zlib:static" ,zlib "static") ("zlib:static" ,zlib "static")
("zstd" ,zstd))) ("zstd" ,zstd "lib")
("zstd:static" ,zstd "static")))
(native-inputs `(("pkg-config" ,pkg-config) (native-inputs `(("pkg-config" ,pkg-config)
("asciidoc" ,asciidoc) ("asciidoc" ,asciidoc)
("python" ,python) ("python" ,python)

View file

@ -227,7 +227,7 @@ (define-public casync
("rsync" ,rsync))) ;for tests ("rsync" ,rsync))) ;for tests
(inputs (inputs
`(("xz" ,xz) ;for liblzma `(("xz" ,xz) ;for liblzma
("zstd" ,zstd) ("zstd" ,zstd "lib")
("curl" ,curl) ("curl" ,curl)
("acl" ,acl) ("acl" ,acl)
("libselinux" ,libselinux) ("libselinux" ,libselinux)

View file

@ -67,7 +67,7 @@ (define-public tor
("libevent" ,libevent) ("libevent" ,libevent)
("libseccomp" ,libseccomp) ("libseccomp" ,libseccomp)
("xz" ,xz) ("xz" ,xz)
("zstd" ,zstd))) ("zstd" ,zstd "lib")))
(home-page "https://www.torproject.org/") (home-page "https://www.torproject.org/")
(synopsis "Anonymous network router to improve privacy on the Internet") (synopsis "Anonymous network router to improve privacy on the Internet")
(description (description