commit:     cb18b96260b1940f67c4f1e3a99136215c0684ee
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 17 16:21:10 2021 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Fri Sep 17 16:23:37 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cb18b962

sys-fs/cryptsetup: fix link error with USE=static

Closes: https://bugs.gentoo.org/813441
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 ...tup-2.4.1.ebuild => cryptsetup-2.4.1-r1.ebuild} |  6 +++-
 .../files/cryptsetup-2.4.1-external-tokens.patch   | 34 ++++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/sys-fs/cryptsetup/cryptsetup-2.4.1.ebuild 
b/sys-fs/cryptsetup/cryptsetup-2.4.1-r1.ebuild
similarity index 95%
rename from sys-fs/cryptsetup/cryptsetup-2.4.1.ebuild
rename to sys-fs/cryptsetup/cryptsetup-2.4.1-r1.ebuild
index 09141d7320f..214b5c462e3 100644
--- a/sys-fs/cryptsetup/cryptsetup-2.4.1.ebuild
+++ b/sys-fs/cryptsetup/cryptsetup-2.4.1-r1.ebuild
@@ -46,7 +46,10 @@ BDEPEND="
 
 S="${WORKDIR}/${P/_/-}"
 
-PATCHES=( "${FILESDIR}"/${PN}-2.0.4-fix-static-pwquality-build.patch )
+PATCHES=(
+       "${FILESDIR}"/cryptsetup-2.0.4-fix-static-pwquality-build.patch
+       "${FILESDIR}"/cryptsetup-2.4.1-external-tokens.patch
+)
 
 pkg_setup() {
        local CONFIG_CHECK="~DM_CRYPT ~CRYPTO ~CRYPTO_CBC ~CRYPTO_SHA256"
@@ -82,6 +85,7 @@ src_configure() {
                $(use_enable nls)
                $(use_enable pwquality)
                $(use_enable reencrypt cryptsetup-reencrypt)
+               $(use_enable !static external-tokens)
                $(use_enable static static-cryptsetup)
                $(use_enable static-libs static)
                $(use_enable udev)

diff --git a/sys-fs/cryptsetup/files/cryptsetup-2.4.1-external-tokens.patch 
b/sys-fs/cryptsetup/files/cryptsetup-2.4.1-external-tokens.patch
new file mode 100644
index 00000000000..1777a02652c
--- /dev/null
+++ b/sys-fs/cryptsetup/files/cryptsetup-2.4.1-external-tokens.patch
@@ -0,0 +1,34 @@
+From a1b577c085cc9ef6b95c4556ec8815070828ee6c Mon Sep 17 00:00:00 2001
+From: Hector Martin <[email protected]>
+Date: Fri, 17 Sep 2021 05:44:18 +0000
+Subject: [PATCH] Do not attempt to unload external tokens if
+ USE_EXTERNAL_TOKENS is disabled.
+
+This allows building a static binary as long as --disable-external-tokens is 
used
+---
+ lib/luks2/luks2_token.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/lib/luks2/luks2_token.c b/lib/luks2/luks2_token.c
+index d34cebf5..88d84418 100644
+--- a/lib/luks2/luks2_token.c
++++ b/lib/luks2/luks2_token.c
+@@ -245,6 +245,7 @@ int crypt_token_register(const crypt_token_handler 
*handler)
+ 
+ void crypt_token_unload_external_all(struct crypt_device *cd)
+ {
++#if USE_EXTERNAL_TOKENS
+       int i;
+ 
+       for (i = LUKS2_TOKENS_MAX - 1; i >= 0; i--) {
+@@ -258,6 +259,7 @@ void crypt_token_unload_external_all(struct crypt_device 
*cd)
+               if (dlclose(CONST_CAST(void *)token_handlers[i].u.v2.dlhandle))
+                       log_dbg(cd, "%s", dlerror());
+       }
++#endif
+ }
+ 
+ static const void
+-- 
+GitLab
+

Reply via email to