diff options
| author | Josselin Poiret <dev@jpoiret.xyz> | 2024-01-17 11:54:22 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2024-08-31 10:44:51 +0200 |
| commit | 40878bfc38a937ecb3fe58186152919bfd9be005 (patch) | |
| tree | 34a7ae1948893c6f3f201ec0a25461b723b9e6d1 /gnu/packages/cryptsetup.scm | |
| parent | 80f0228b0e29ddbe097e14464fd66ddf452fffaf (diff) | |
gnu: cryptsetup-static: Fix static build.
* gnu/packages/cryptsetup.scm (cryptsetup-static): Pass static variants of
dependencies. Also work around wrong pkg-config paths of util-linux for the
static output.
Change-Id: I025f241b02ee0ea80227ef7d31789571e635ef2c
Diffstat (limited to 'gnu/packages/cryptsetup.scm')
| -rw-r--r-- | gnu/packages/cryptsetup.scm | 86 |
1 files changed, 45 insertions, 41 deletions
diff --git a/gnu/packages/cryptsetup.scm b/gnu/packages/cryptsetup.scm index 8e2bdb6d9e4..8ff649bccc0 100644 --- a/gnu/packages/cryptsetup.scm +++ b/gnu/packages/cryptsetup.scm | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #:use-module (guix packages) | 23 | #:use-module (guix packages) |
| 24 | #:use-module (guix download) | 24 | #:use-module (guix download) |
| 25 | #:use-module (guix build-system gnu) | 25 | #:use-module (guix build-system gnu) |
| 26 | #:use-module (guix gexp) | ||
| 26 | #:use-module (guix utils) | 27 | #:use-module (guix utils) |
| 27 | #:use-module (gnu packages) | 28 | #:use-module (gnu packages) |
| 28 | #:use-module (gnu packages gnupg) | 29 | #:use-module (gnu packages gnupg) |
| @@ -116,56 +117,59 @@ files). This assumes LIBRARY uses Libtool." | |||
| 116 | (inherit cryptsetup) | 117 | (inherit cryptsetup) |
| 117 | (name "cryptsetup-static") | 118 | (name "cryptsetup-static") |
| 118 | (arguments | 119 | (arguments |
| 119 | '(#:configure-flags '("--disable-shared" | 120 | (substitute-keyword-arguments (package-arguments cryptsetup) |
| 120 | "--enable-static-cryptsetup" | 121 | ((#:configure-flags flags ''()) |
| 121 | 122 | `(cons* "--disable-shared" | |
| 122 | "--disable-veritysetup" | 123 | "--enable-static-cryptsetup" |
| 123 | "--disable-cryptsetup-reencrypt" | ||
| 124 | "--disable-integritysetup" | ||
| 125 | |||
| 126 | ;; The default is OpenSSL which provides better PBKDF performance. | ||
| 127 | "--with-crypto_backend=gcrypt" | ||
| 128 | |||
| 129 | "--disable-blkid" | ||
| 130 | ;; 'libdevmapper.a' pulls in libpthread, libudev and libm. | ||
| 131 | "LIBS=-ludev -pthread -lm") | ||
| 132 | |||
| 133 | #:allowed-references () ;this should be self-contained | ||
| 134 | |||
| 135 | #:modules ((ice-9 ftw) | ||
| 136 | (ice-9 match) | ||
| 137 | (guix build utils) | ||
| 138 | (guix build gnu-build-system)) | ||
| 139 | 124 | ||
| 140 | #:phases (modify-phases %standard-phases | 125 | "--disable-veritysetup" |
| 141 | (add-after 'install 'remove-cruft | 126 | "--disable-integritysetup" |
| 142 | (lambda* (#:key outputs #:allow-other-keys) | 127 | ;; Bypass broken pkg-config paths for the static output of |
| 143 | ;; Remove everything except the 'cryptsetup' command. | 128 | ;; util-linux. Only blkid is located through pkg-config, not |
| 144 | (let ((out (assoc-ref outputs "out"))) | 129 | ;; uuid. |
| 145 | (with-directory-excursion out | 130 | (format #f "BLKID_CFLAGS=-I~a" |
| 146 | (let ((dirs (scandir "." | 131 | (search-input-directory %build-inputs "include/blkid")) |
| 147 | (match-lambda | 132 | (format #f "BLKID_LIBS=-L~a -lblkid" |
| 148 | ((or "." "..") #f) | 133 | (dirname (search-input-file %build-inputs "lib/libblkid.a"))) |
| 149 | (_ #t))))) | 134 | ,flags)) |
| 150 | (for-each delete-file-recursively | 135 | ((#:allowed-references refs '()) |
| 151 | (delete "sbin" dirs)) | 136 | '()) |
| 152 | (for-each (lambda (file) | 137 | ((#:modules modules '()) |
| 153 | (rename-file (string-append file | 138 | '((ice-9 ftw) |
| 154 | ".static") | 139 | (ice-9 match) |
| 155 | file) | 140 | (guix build utils) |
| 156 | (remove-store-references file)) | 141 | (guix build gnu-build-system))) |
| 157 | '("sbin/cryptsetup")) | 142 | ((#:phases phases #~%standard-phases) |
| 158 | #t)))))))) | 143 | #~(modify-phases #$phases |
| 144 | (add-after 'install 'remove-cruft | ||
| 145 | (lambda* (#:key outputs #:allow-other-keys) | ||
| 146 | ;; Remove everything except the 'cryptsetup' command. | ||
| 147 | (let ((out (assoc-ref outputs "out"))) | ||
| 148 | (with-directory-excursion out | ||
| 149 | (let ((dirs (scandir "." | ||
| 150 | (match-lambda | ||
| 151 | ((or "." "..") #f) | ||
| 152 | (_ #t))))) | ||
| 153 | (for-each delete-file-recursively | ||
| 154 | (delete "sbin" dirs)) | ||
| 155 | (for-each (lambda (file) | ||
| 156 | (rename-file (string-append file | ||
| 157 | ".static") | ||
| 158 | file) | ||
| 159 | (remove-store-references file)) | ||
| 160 | '("sbin/cryptsetup")) | ||
| 161 | #t))))))))) | ||
| 159 | (inputs | 162 | (inputs |
| 160 | (let ((libgcrypt-static | 163 | (let ((libgcrypt-static |
| 161 | (package | 164 | (package |
| 162 | (inherit (static-library libgcrypt)) | 165 | (inherit (static-library libgcrypt)) |
| 163 | (propagated-inputs | 166 | (propagated-inputs |
| 164 | `(("libgpg-error-host" ,(static-library libgpg-error))))))) | 167 | `(("libgpg-error-host" ,(static-library libgpg-error))))))) |
| 165 | `(("json-c" ,json-c-0.13) | 168 | `(("argon2" ,(static-library argon2)) |
| 169 | ("json-c" ,(static-library json-c-0.13)) | ||
| 166 | ("libgcrypt" ,libgcrypt-static) | 170 | ("libgcrypt" ,libgcrypt-static) |
| 167 | ("lvm2" ,lvm2-static) | 171 | ("lvm2" ,lvm2-static) |
| 168 | ("util-linux" ,util-linux "static") | 172 | ("util-linux" ,util-linux "static") |
| 169 | ("util-linux" ,util-linux "lib") | 173 | ("util-linux" ,util-linux "lib") |
| 170 | ("popt" ,popt)))) | 174 | ("popt" ,(static-library popt))))) |
| 171 | (synopsis "Hard disk encryption tool (statically linked)"))) | 175 | (synopsis "Hard disk encryption tool (statically linked)"))) |
