commit:     2cff69fec866f90fb9743ebfbae0dec140553e2b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 21 08:11:52 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan 21 08:12:01 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2cff69fe

app-crypt/tpm2-tools: fix bashism in configure

Closes: https://bugs.gentoo.org/922592
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../tpm2-tools/files/tpm2-tools-5.6-bashism.patch  | 47 ++++++++++++++++++++++
 ...2-tools-5.6.ebuild => tpm2-tools-5.6-r1.ebuild} |  1 +
 2 files changed, 48 insertions(+)

diff --git a/app-crypt/tpm2-tools/files/tpm2-tools-5.6-bashism.patch 
b/app-crypt/tpm2-tools/files/tpm2-tools-5.6-bashism.patch
new file mode 100644
index 000000000000..01ce4301d4e3
--- /dev/null
+++ b/app-crypt/tpm2-tools/files/tpm2-tools-5.6-bashism.patch
@@ -0,0 +1,47 @@
+https://github.com/tpm2-software/tpm2-tools/pull/3339
+
+From 9f244c3f74747b7f79c8c6813657b2f2f8a1c844 Mon Sep 17 00:00:00 2001
+From: Sam James <[email protected]>
+Date: Sun, 21 Jan 2024 08:08:28 +0000
+Subject: [PATCH] configure.ac: fix bashisms
+
+configure scripts need to be runnable with a POSIX-compliant /bin/sh.
+
+On many (but not all!) systems, /bin/sh is provided by Bash, so errors
+like this aren't spotted. Notably Debian defaults to /bin/sh provided
+by dash which doesn't tolerate such bashisms as '=='.
+
+This retains compatibility with bash.
+
+Fixes configure warnings/errors like:
+```
+checking for libcurl... yes
+./configure: 15201: test: xauto: unexpected operator
+./configure: 15286: test: xauto: unexpected operator
+checking for efivar/efivar.h... yes
+```
+
+This fixes a build error later on too:
+```
+/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: 
lib/libcommon.a(libcommon_a-tpm2_eventlog_yaml.o): in function 
`yaml_devicepath':
+tpm2_eventlog_yaml.c:(.text.yaml_devicepath+0x2f): undefined reference to 
`efidp_format_device_path'
+/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: 
tpm2_eventlog_yaml.c:(.text.yaml_devicepath+0x61): undefined reference to 
`efidp_format_device_path'
+```
+
+Bug: https://bugs.gentoo.org/922592
+Signed-off-by: Sam James <[email protected]>
+--- a/configure.ac
++++ b/configure.ac
+@@ -94,9 +94,9 @@ AC_ARG_WITH([efivar],
+ )
+ 
+ # use the true program to avoid failing hard
+-AS_IF([test "x$with_efivar" == "xauto"],
++AS_IF([test "x$with_efivar" = "xauto"],
+   [PKG_CHECK_MODULES([EFIVAR], [efivar], [AC_CHECK_HEADERS([efivar/efivar.h], 
, [true])], [true])],
+-  [test "x$with_efivar" == "xyes"],
++  [test "x$with_efivar" = "xyes"],
+   [PKG_CHECK_MODULES([EFIVAR], [efivar], 
[AC_CHECK_HEADERS([efivar/efivar.h])])],
+ )
+ 
+

diff --git a/app-crypt/tpm2-tools/tpm2-tools-5.6.ebuild 
b/app-crypt/tpm2-tools/tpm2-tools-5.6-r1.ebuild
similarity index 98%
rename from app-crypt/tpm2-tools/tpm2-tools-5.6.ebuild
rename to app-crypt/tpm2-tools/tpm2-tools-5.6-r1.ebuild
index 3eb1badf0637..04fb5536f1f5 100644
--- a/app-crypt/tpm2-tools/tpm2-tools-5.6.ebuild
+++ b/app-crypt/tpm2-tools/tpm2-tools-5.6-r1.ebuild
@@ -41,6 +41,7 @@ PATCHES=(
        
"${FILESDIR}/${PN}-5.6-test-eventlog-fix-check-eventlog.sh-if-efivar.h-exis.patch"
        
"${WORKDIR}/${PN}-5.6-tpm2_eventlog-Create-raw-and-pretty-print-format-for.patch"
        "${FILESDIR}/${PN}-5.6-Makefile-am-Dont-require-pandoc-for-tests.patch"
+       "${FILESDIR}/${PN}-5.6-bashism.patch"
 )
 
 python_check_deps() {

Reply via email to