summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2019-07-22 14:53:12 +0200
committerMarius Bakke <mbakke@fastmail.com>2019-07-22 16:22:22 +0200
commitec0de9d8bcc46bb6911b1f9ea135a354bac65b1a (patch)
treea6ec7b042e55acdbe9816d23f4a3a59e70ac4a8a
parent8dea61731bf08f4861b7904c1d40d9f5678495a3 (diff)
downloadguix-ec0de9d8bcc46bb6911b1f9ea135a354bac65b1a.tar.gz
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.
-rw-r--r--gnu/packages/backup.scm2
-rw-r--r--gnu/packages/compression.scm32
-rw-r--r--gnu/packages/linux.scm3
-rw-r--r--gnu/packages/sync.scm2
-rw-r--r--gnu/packages/tor.scm2
5 files changed, 35 insertions, 6 deletions
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:
        ;; <https://bugs.gnu.org/30662>
        ("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 <me@tobias.gr>
 ;;; Copyright © 2016 David Craven <david@craven.ch>
 ;;; 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 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
 ;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
@@ -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