From ec0de9d8bcc46bb6911b1f9ea135a354bac65b1a Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Mon, 22 Jul 2019 14:53:12 +0200 Subject: 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. --- gnu/packages/backup.scm | 2 +- gnu/packages/compression.scm | 32 ++++++++++++++++++++++++++++++-- gnu/packages/linux.scm | 3 ++- gnu/packages/sync.scm | 2 +- gnu/packages/tor.scm | 2 +- 5 files changed, 35 insertions(+), 6 deletions(-) (limited to 'gnu/packages') diff --git a/gnu/packages/backup.scm b/gnu/packages/backup.scm index 6f319ccf16..47a6a9bf85 100644 --- a/gnu/packages/backup.scm +++ b/gnu/packages/backup.scm @@ -627,7 +627,7 @@ detection, and lossless compression.") ;; transitional package for now: ;; ("python-msgpack" ,python-msgpack-transitional) - ("zstd" ,zstd))) + ("zstd" ,zstd "lib"))) (synopsis "Deduplicated, encrypted, authenticated and compressed backups") (description "Borg is a deduplicating backup program. Optionally, it supports compression and authenticated encryption. The main goal of Borg is to diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm index a6a2a04f6f..3c5d355519 100644 --- a/gnu/packages/compression.scm +++ b/gnu/packages/compression.scm @@ -13,7 +13,7 @@ ;;; Copyright © 2016, 2017, 2018, 2019 Tobias Geerinckx-Rice ;;; Copyright © 2016 David Craven ;;; Copyright © 2016, 2019 Kei Kebreau -;;; Copyright © 2016, 2018 Marius Bakke +;;; Copyright © 2016, 2018, 2019 Marius Bakke ;;; Copyright © 2017 ng0 ;;; Copyright © 2017 Manolis Fragkiskos Ragkousis ;;; Copyright © 2017 Theodoros Foradis @@ -1372,13 +1372,41 @@ or junctions, and always follows hard links.") (sha256 (base32 "13nlsqhkn276frxrzjdn7wz0j9zz414lf336885ykyxcvw2a0gr9")))) (build-system gnu-build-system) + (outputs '("out" ;1.1MiB executables and documentation + "lib" ;1MiB shared library and headers + "static")) ;1MiB static library (arguments `(#: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 (list "CC=gcc" (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 ;; environment's ‘xz’ for what amounts to a dubious feature anyway. "HAVE_LZMA=0" diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 7d3800c541..52883282e8 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -3862,7 +3862,8 @@ and copy/paste text in the console and in xterm.") ("lzo" ,lzo) ("zlib" ,zlib) ("zlib:static" ,zlib "static") - ("zstd" ,zstd))) + ("zstd" ,zstd "lib") + ("zstd:static" ,zstd "static"))) (native-inputs `(("pkg-config" ,pkg-config) ("asciidoc" ,asciidoc) ("python" ,python) diff --git a/gnu/packages/sync.scm b/gnu/packages/sync.scm index faff25ddc1..1c80b7978e 100644 --- a/gnu/packages/sync.scm +++ b/gnu/packages/sync.scm @@ -227,7 +227,7 @@ and does not hamper local file system performance.") ("rsync" ,rsync))) ;for tests (inputs `(("xz" ,xz) ;for liblzma - ("zstd" ,zstd) + ("zstd" ,zstd "lib") ("curl" ,curl) ("acl" ,acl) ("libselinux" ,libselinux) diff --git a/gnu/packages/tor.scm b/gnu/packages/tor.scm index 25bd520d6b..8b5e8032ad 100644 --- a/gnu/packages/tor.scm +++ b/gnu/packages/tor.scm @@ -67,7 +67,7 @@ ("libevent" ,libevent) ("libseccomp" ,libseccomp) ("xz" ,xz) - ("zstd" ,zstd))) + ("zstd" ,zstd "lib"))) (home-page "https://www.torproject.org/") (synopsis "Anonymous network router to improve privacy on the Internet") (description -- cgit v1.2.3