commit:     12a43f5f35a998543b802c8c37c9908232010fbc
Author:     Eli Schwartz <eschwartz93 <AT> gmail <DOT> com>
AuthorDate: Sun May 26 17:27:38 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu May 30 02:20:11 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=12a43f5f

dev-scheme/guile: fix implicit function decls in configure due to gnulib

backport fix for round.m4, exit() -> return

Also fix bashism:

test $var = no

fails if $var is only ever defined after this line. gnulib is brilliant
software and naturally does exactly this, because it is highly logical
to only define code after you try to use it.

Probably.  It's hard to tell because the actual code that gets run is:

func_gl_gnulib_m4code_5264294aa0a5557541b53c8c741f7f31

since the other sparkling aspect of gnulib's innovative brilliance is
the realization that *of course* the most robust way to design software
is to use checksums as *replacements* for function names.

Or, "that time Eli got jiatanned by gnulib".

The quoting was silently "fixed" upstream in:
https://github.com/coreutils/gnulib/commit/db1ee11e2168af7137db53289a92e306d2277b0b

It is the same "fix" we do here, thus restoring dash <--> bash
compatibility and preventing:

```
 * QA Notice: Abnormal configure code
 *
 * ./configure: 38012: test: =: unexpected operator
```

although it seems to me gnulib is just more generally broken.

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

 .../guile/files/guile-2.2.7-fix-buggy-gnulib.patch | 85 ++++++++++++++++++++
 dev-scheme/guile/guile-2.2.7-r2.ebuild             | 90 ++++++++++++++++++++++
 2 files changed, 175 insertions(+)

diff --git a/dev-scheme/guile/files/guile-2.2.7-fix-buggy-gnulib.patch 
b/dev-scheme/guile/files/guile-2.2.7-fix-buggy-gnulib.patch
new file mode 100644
index 000000000000..20f04c3b095c
--- /dev/null
+++ b/dev-scheme/guile/files/guile-2.2.7-fix-buggy-gnulib.patch
@@ -0,0 +1,85 @@
+From 76d84a62e84d4206d41ffed16b8baa5af2d1e62f Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <eschwart...@gmail.com>
+Date: Sun, 26 May 2024 13:02:54 -0400
+Subject: [PATCH 1/2] fix invalid bash code causing the wrong type of failure
+
+test $var = no
+
+fails if $var is only ever defined after this line. gnulib is brilliant
+software and naturally does exactly this, because it is highly logical
+to only define code after you try to use it.
+
+Probably. It's hard to tell because the actual code that gets run is:
+
+func_gl_gnulib_m4code_5264294aa0a5557541b53c8c741f7f31
+
+since the other sparkling aspect of gnulib's innovative brilliance is
+the realization that *of course* the most robust way to design software
+is to use checksums as *replacements* for function names.
+
+Or, "that time Eli got jiatanned by gnulib".
+
+The quoting was silently "fixed" upstream in:
+https://github.com/coreutils/gnulib/commit/db1ee11e2168af7137db53289a92e306d2277b0b
+
+It is the same "fix" we do here, thus restoring dash <--> bash
+compatibility and preventing:
+
+```
+ * QA Notice: Abnormal configure code
+ *
+ * ./configure: 38012: test: =: unexpected operator
+```
+
+although it seems to me gnulib is just more generally broken.
+---
+ m4/timegm.m4 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/m4/timegm.m4 b/m4/timegm.m4
+index 510e25a..34e5347 100644
+--- a/m4/timegm.m4
++++ b/m4/timegm.m4
+@@ -11,7 +11,7 @@ AC_DEFUN([gl_FUNC_TIMEGM],
+   REPLACE_TIMEGM=0
+   AC_CHECK_FUNCS_ONCE([timegm])
+   if test $ac_cv_func_timegm = yes; then
+-    if test $gl_cv_func_working_mktime = no; then
++    if test "$gl_cv_func_working_mktime" = no; then
+       # Assume that timegm is buggy if mktime is.
+       REPLACE_TIMEGM=1
+     fi
+-- 
+2.44.1
+
+
+From fa98775e2a0bc6e33de851a8bd399635b977d0e6 Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <eschwart...@gmail.com>
+Date: Sun, 26 May 2024 13:07:25 -0400
+Subject: [PATCH 2/2] gnulib: backport fix for Modern C in round.m4
+
+https://github.com/coreutils/gnulib/commit/f12a7bbb4acaaa72f48e452e04da2a4dd749a664
+
+Fixes undefined exit() by switching it to merely return. That's the
+upstream fix, so use it although arguably one could simply #include the
+headers for functions that are used...
+---
+ m4/round.m4 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/m4/round.m4 b/m4/round.m4
+index 45b7df4..d4ef7f2 100644
+--- a/m4/round.m4
++++ b/m4/round.m4
+@@ -57,7 +57,7 @@ int main()
+     * (double) (1U << ((DBL_MANT_DIG + 3) / 5))
+     * (double) (1U << ((DBL_MANT_DIG + 4) / 5));
+   volatile double x = 0.5 - 0.5 / TWO_MANT_DIG;
+-  exit (x < 0.5 && round (x) != 0.0);
++  return (x < 0.5 && round (x) != 0.0);
+ }]])], [gl_cv_func_round_works=yes], [gl_cv_func_round_works=no],
+         [case "$host_os" in
+            netbsd* | aix*) gl_cv_func_round_works="guessing no";;
+-- 
+2.44.1
+

diff --git a/dev-scheme/guile/guile-2.2.7-r2.ebuild 
b/dev-scheme/guile/guile-2.2.7-r2.ebuild
new file mode 100644
index 000000000000..e11937c153c9
--- /dev/null
+++ b/dev-scheme/guile/guile-2.2.7-r2.ebuild
@@ -0,0 +1,90 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools
+
+MAJOR="2.2"
+DESCRIPTION="GNU Ubiquitous Intelligent Language for Extensions"
+HOMEPAGE="https://www.gnu.org/software/guile/";
+SRC_URI="mirror://gnu/guile/${P}.tar.xz"
+
+LICENSE="LGPL-3+"
+SLOT="12/2.2-1" # libguile-2.2.so.1 => 2.2-1
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="debug debug-malloc +deprecated +networking +nls +regex +threads" # 
upstream recommended +networking +nls
+REQUIRED_USE="regex" # workaround for bug 596322
+RESTRICT="strip"
+
+RDEPEND="
+       >=dev-libs/boehm-gc-7.0:=[threads?]
+       dev-libs/gmp:=
+       dev-libs/libffi:=
+       dev-libs/libltdl:=
+       dev-libs/libunistring:0=
+       sys-libs/ncurses:0=
+       sys-libs/readline:0=
+       virtual/libcrypt:="
+DEPEND="${RDEPEND}"
+BDEPEND="
+       virtual/pkgconfig
+       dev-build/libtool
+       sys-devel/gettext"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-2.2.3-gentoo-sandbox.patch"
+       "${FILESDIR}/${PN}-2.2.7-stack-up.patch"
+       # Modern C bug in round.m4
+       # /bin/sh bug in timegm.m4
+       "${FILESDIR}"/${PN}-2.2.7-fix-buggy-gnulib.patch
+)
+
+# guile generates ELF files without use of C or machine code
+# It's a portage's false positive. bug #677600
+QA_PREBUILT='*[.]go'
+
+DOCS=( GUILE-VERSION HACKING README )
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+src_configure() {
+       # see bug #676468
+       mv prebuilt/32-bit-big-endian{,.broken} || die
+
+       econf \
+               --disable-error-on-warning \
+               --disable-rpath \
+               --disable-static \
+               --enable-posix \
+               --without-libgmp-prefix \
+               --without-libiconv-prefix \
+               --without-libintl-prefix \
+               --without-libltdl-prefix \
+               --without-libreadline-prefix \
+               --without-libunistring-prefix \
+               $(use_enable debug guile-debug) \
+               $(use_enable debug-malloc) \
+               $(use_enable deprecated) \
+               $(use_enable networking) \
+               $(use_enable nls) \
+               $(use_enable regex) \
+               $(use_with threads)
+}
+
+src_install() {
+       default
+
+       # From Novell
+       # https://bugzilla.novell.com/show_bug.cgi?id=874028#c0
+       dodir /usr/share/gdb/auto-load/$(get_libdir)
+       mv "${ED}"/usr/$(get_libdir)/libguile-*-gdb.scm 
"${ED}"/usr/share/gdb/auto-load/$(get_libdir) || die
+
+       # necessary for registering slib, see bug 206896
+       keepdir /usr/share/guile/site
+
+       find "${D}" -name '*.la' -delete || die
+}

Reply via email to