commit:     a15989d262b96617d9b163afee720aab041be3c2
Author:     Eli Schwartz <eschwartz93 <AT> gmail <DOT> com>
AuthorDate: Thu Mar  7 02:20:41 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Mar  7 11:46:25 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a15989d2

sci-physics/siscone: fix some critical existence failures in autoconf

Ancient 2008 macros that don't work and have been updated, and other
bashisms.

Closes: https://bugs.gentoo.org/890780
Signed-off-by: Eli Schwartz <eschwartz93 <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...ix-broken-bashisms-resulting-in-logic-fai.patch | 71 ++++++++++++++++++++++
 sci-physics/siscone/siscone-3.0.5.ebuild           | 21 ++++++-
 2 files changed, 91 insertions(+), 1 deletion(-)

diff --git 
a/sci-physics/siscone/files/0001-configure-fix-broken-bashisms-resulting-in-logic-fai.patch
 
b/sci-physics/siscone/files/0001-configure-fix-broken-bashisms-resulting-in-logic-fai.patch
new file mode 100644
index 000000000000..33e56b5e188b
--- /dev/null
+++ 
b/sci-physics/siscone/files/0001-configure-fix-broken-bashisms-resulting-in-logic-fai.patch
@@ -0,0 +1,71 @@
+From fd2218e4a671f4aae752620481e541799585fa20 Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <[email protected]>
+Date: Wed, 6 Mar 2024 20:06:07 -0500
+Subject: [PATCH] configure: fix broken bashisms resulting in logic failure
+
+In a configure check that was carefully written for pre-unix-wars
+versions of the bourne shell, some code which was only valid using GNU
+bash was included.
+
+Bash provides the standard `test XXX = YYY` or `[ XXX = YYY ]`
+utilities. It also provides the ability to spell the equals sign as a
+double equals. This does nothing whatsoever -- it adds no new
+functionality to bash, it forbids nothing, it is *literally* an exact
+alias.
+
+It should never be used under any circumstances. All developers must
+immediately forget that it exists. Using it is non-portable and does not
+work in /bin/sh scripts such as configure scripts, and it results in
+dangerous muscle memory when used in bash scripts because it makes
+people unthinkingly use the double equals even in /bin/sh scripts. To
+add insult to injury, it makes scripts take up more disk space (by a
+whole byte! and sometimes even a few bytes...)
+
+Delete this accidental bashism, and restore the ability to get correct
+./configure behavior on systems where /bin/sh is something other than a
+symlink to GNU bash.
+
+Signed-off-by: Eli Schwartz <[email protected]>
+---
+ configure.ac | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index c0ac33c..619e162 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -44,7 +44,7 @@ AC_ARG_ENABLE(debug,
+       [  --enable-debug      Turn on debug compiler information],
+       [ENABLE_DEBUG_FLAG="$enableval"],
+       [ENABLE_DEBUG_FLAG="yes"])
+-if [[ "x$ENABLE_DEBUG_FLAG" == "xyes" ]] ; then
++if test "$ENABLE_DEBUG_FLAG" = yes ; then
+    CXXFLAGS=${CXXFLAGS}" -g "
+ fi
+ 
+@@ -63,7 +63,7 @@ dnl AM_LDFLAGS=" -lm "
+ dnl if the debug flags are on, check if we can also use 
+ dnl some profiling tools
+ dnl COMMENTED: Pass LDFLAGS to configure instead
+-dnl if [[ "x$ENABLE_DEBUG_FLAG" == "xyes" ]] ; then
++dnl if test "$ENABLE_DEBUG_FLAG" = yes ; then
+ dnl    AC_CHECK_LIB(profiler, google_initializer_module_profiler)
+ dnl    AC_CHECK_LIB(pthread, pthread_create)
+ dnl    AC_CHECK_LIB(tcmalloc, malloc)
+@@ -81,11 +81,11 @@ CXXFLAGS="$CXXFLAGS -Werror=deprecated-declarations"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <memory>]],[[int *a= new 
int(1); std::auto_ptr<int> b; b.reset(a);]])],
+     [ac_compilation_deprecated="no"],[ac_compilation_deprecated="yes"])
+ AC_MSG_RESULT([$ac_compilation_deprecated])
+-if [[ "$ac_compilation_deprecated" == "yes" ]] ; then
++if test "$ac_compilation_deprecated" = yes ; then
+    AC_MSG_CHECKING([[if $CXX $CXXFLAGS supports atd::unique_ptr]])
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <memory>]],[[int *a= new 
int(1); std::unique_ptr<int> b; b.reset(a);]])],
+     [ac_supports_unique_ptr="yes"],[as_supports_unique_ptr="no"])
+-    if [[ "$ac_supports_unique_ptr" == "yes" ]] ; then
++    if test "$ac_supports_unique_ptr" = "yes" ; then
+        AC_DEFINE(USES_UNIQUE_PTR_AS_AUTO_PTR, [], [use unique_ptr instead of 
auto_ptr])
+     fi
+     AC_MSG_RESULT([$ac_supports_unique_ptr])
+-- 
+2.43.0
+

diff --git a/sci-physics/siscone/siscone-3.0.5.ebuild 
b/sci-physics/siscone/siscone-3.0.5.ebuild
index d66ff8180740..1205f84ddbbf 100644
--- a/sci-physics/siscone/siscone-3.0.5.ebuild
+++ b/sci-physics/siscone/siscone-3.0.5.ebuild
@@ -1,8 +1,10 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
 
+inherit autotools
+
 DESCRIPTION="Hadron Seedless Infrared-Safe Cone jet algorithm"
 HOMEPAGE="https://siscone.hepforge.org/";
 SRC_URI="https://siscone.hepforge.org/downloads/${P}.tar.gz";
@@ -12,6 +14,23 @@ SLOT="0"
 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
 IUSE="examples"
 
+BDEPEND="dev-build/autoconf-archive"
+
+PATCHES=(
+       
"${FILESDIR}"/0001-configure-fix-broken-bashisms-resulting-in-logic-fai.patch
+)
+
+src_prepare() {
+       default
+
+       # The included copy of this macro is from 2008 and totally broken.
+       # https://bugs.gentoo.org/890780
+       rm m4/ax_prefix_config_h.m4 || die
+
+       # Rebuild after patch to configure.ac, removal of broken macro
+       eautoreconf
+}
+
 src_configure() {
        econf --disable-static
 }

Reply via email to