summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-11-22 22:40:49 +0100
committerLudovic Courtès <ludo@gnu.org>2016-11-22 23:45:01 +0100
commit106b389e525f93a56bd1d25fd33eecbd552a8c93 (patch)
tree29ccb2cc410c7597cb7c2faced1b54430dbda050 /gnu
parent01f94cca19ebd843d6a518530f8acc4fc61b116b (diff)
gnu: Add 'cryptsetup-static'.
* gnu/packages/cryptsetup.scm (static-library): New procedure. (cryptsetup-static): New variable.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/cryptsetup.scm65
1 files changed, 65 insertions, 0 deletions
diff --git a/gnu/packages/cryptsetup.scm b/gnu/packages/cryptsetup.scm
index 183c568fd96..da58facffba 100644
--- a/gnu/packages/cryptsetup.scm
+++ b/gnu/packages/cryptsetup.scm
@@ -1,5 +1,6 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Andreas Enge <andreas@enge.fr> 2;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
3;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
3;;; 4;;;
4;;; This file is part of GNU Guix. 5;;; This file is part of GNU Guix.
5;;; 6;;;
@@ -58,3 +59,67 @@ setup information in the partition header, enabling the users to transport
58or migrate their data seamlessly.") 59or migrate their data seamlessly.")
59 (license license:gpl2) 60 (license license:gpl2)
60 (home-page "https://gitlab.com/cryptsetup/cryptsetup"))) 61 (home-page "https://gitlab.com/cryptsetup/cryptsetup")))
62
63(define (static-library library)
64 "Return a variant of package LIBRARY that provides static libraries ('.a'
65files). This assumes LIBRARY uses Libtool."
66 (package
67 (inherit library)
68 (name (string-append (package-name library) "-static"))
69 (arguments
70 (substitute-keyword-arguments (package-arguments library)
71 ((#:configure-flags flags ''())
72 `(append '("--disable-shared" "--enable-static")
73 ,flags))))))
74
75(define-public cryptsetup-static
76 ;; Stripped-down statically-linked 'cryptsetup' command for use in initrds.
77 (package
78 (inherit cryptsetup)
79 (name "cryptsetup-static")
80 (arguments
81 '(#:configure-flags '("--disable-shared"
82 "--enable-static-cryptsetup"
83
84 ;; 'libdevmapper.a' pulls in libpthread and libudev.
85 "LIBS=-ludev -pthread")
86
87 #:allowed-references () ;this should be self-contained
88
89 #:modules ((ice-9 ftw)
90 (ice-9 match)
91 (guix build utils)
92 (guix build gnu-build-system))
93
94 #:phases (modify-phases %standard-phases
95 (add-after 'install 'remove-cruft
96 (lambda* (#:key outputs #:allow-other-keys)
97 ;; Remove everything except the 'cryptsetup' command and
98 ;; its friend.
99 (let ((out (assoc-ref outputs "out")))
100 (with-directory-excursion out
101 (let ((dirs (scandir "."
102 (match-lambda
103 ((or "." "..") #f)
104 (_ #t)))))
105 (for-each delete-file-recursively
106 (delete "sbin" dirs))
107 (for-each (lambda (file)
108 (rename-file (string-append file
109 ".static")
110 file)
111 (remove-store-references file))
112 '("sbin/cryptsetup" "sbin/veritysetup"))
113 #t))))))))
114 (inputs
115 (let ((libgcrypt-static
116 (package
117 (inherit (static-library libgcrypt))
118 (propagated-inputs
119 `(("libgpg-error-host" ,(static-library libgpg-error)))))))
120 `(("libgcrypt" ,libgcrypt-static)
121 ("lvm2" ,lvm2-static)
122 ("util-linux" ,util-linux "static")
123 ("util-linux" ,util-linux)
124 ("popt" ,popt))))
125 (synopsis "Hard disk encryption tool (statically linked)")))