From c95cb2e9cc113ab3c5b87ed71068210e875b806e Mon Sep 17 00:00:00 2001 From: NHOrus Date: Thu, 26 Mar 2026 17:03:49 +0300 Subject: [PATCH] dev-scheme/elk: Mark as C17, enable parallel build Package uses C function polymorphism, can't be ported to C23 without rewrite due to interpreter functions accepting func pointer with one or two arguments, depending on function. Fixes dependency ordering in makefiles, allowing parallel build. Enables tests when build with gcc, as comment about 1. them beingrun and 2. them failing if run from default test runner is false. But noted-flaky test always fails when build with clang. Fix fpurge problem on musl systems as we did for zsh Closes: https://bugs.gentoo.org/943984 Closes: https://bugs.gentoo.org/936285 Bug: https://bugs.gentoo.org/880349 Bug: https://bugs.gentoo.org/942412 Signed-off-by: NHOrus Part-of: https://codeberg.org/gentoo/gentoo/pulls/422 Merges: https://codeberg.org/gentoo/gentoo/pulls/422 Signed-off-by: Sam James --- dev-scheme/elk/elk-3.99.8-r3.ebuild | 54 +++++++++++++++++++ dev-scheme/elk/files/elk-3.99.8-fpurge.patch | 36 +++++++++++++ .../files/elk-3.99.8-makefile-ordering.patch | 23 ++++++++ 3 files changed, 113 insertions(+) create mode 100644 dev-scheme/elk/elk-3.99.8-r3.ebuild create mode 100644 dev-scheme/elk/files/elk-3.99.8-fpurge.patch create mode 100644 dev-scheme/elk/files/elk-3.99.8-makefile-ordering.patch diff --git a/dev-scheme/elk/elk-3.99.8-r3.ebuild b/dev-scheme/elk/elk-3.99.8-r3.ebuild new file mode 100644 index 0000000000000..49bf62511993c --- /dev/null +++ b/dev-scheme/elk/elk-3.99.8-r3.ebuild @@ -0,0 +1,54 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools flag-o-matic toolchain-funcs + +DESCRIPTION="Scheme implementation designed to be embeddable extension to C/C++ applications" +HOMEPAGE="http://sam.zoy.org/elk/" +SRC_URI="http://sam.zoy.org/elk/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64" + +PATCHES=( + "${FILESDIR}"/${P}-implicit-int-incompat-ptr.patch + "${FILESDIR}"/${P}-implicit-function.patch + "${FILESDIR}"/${P}-c99-build-fix.patch + "${FILESDIR}"/${P}-makefile-ordering.patch + "${FILESDIR}"/${P}-fpurge.patch +) + +src_prepare() { + default + eautoreconf +} + +src_configure() { + #uses functional polymorphism, can't be ported to C23 + append-cflags -std=gnu17 + + econf --disable-static +} + +src_test() { + # gc test is noted flakey and always fails when build with clang + if tc-is-gcc; then + emake check + fi +} + +src_install() { + # parallel install is broken + emake -j1 DESTDIR="${D}" \ + docsdir="${EPREFIX}"/usr/share/doc/${PF} \ + examplesdir="${EPREFIX}"/usr/share/doc/${PF}/examples \ + install + einstalldocs + docompress -x /usr/share/doc/${PF} + + # no static archives + find "${D}" -name '*.la' -delete || die +} diff --git a/dev-scheme/elk/files/elk-3.99.8-fpurge.patch b/dev-scheme/elk/files/elk-3.99.8-fpurge.patch new file mode 100644 index 0000000000000..d621a23d2f42a --- /dev/null +++ b/dev-scheme/elk/files/elk-3.99.8-fpurge.patch @@ -0,0 +1,36 @@ +Inspired by https://github.com/gentoo/gentoo/commit/cd306dc1d9273c423759a74166f9805ac8e8b5dd +Fix fpurge on musl +https://bugs.gentoo.org/936285 +--- a/configure.ac ++++ b/configure.ac +@@ -316,7 +316,7 @@ + # tiocflush use TIOCFLUSH ioctl from + # tcflsh use TCFLSH ioctl from + # Leave the variable(s) empty if flushing is not supported. +-AC_CHECK_FUNCS(fpurge) ++AC_CHECK_DECLS(fpurge) + + AC_CACHE_CHECK([for BSD-style flushing], + [ac_cv_have_bsd_flush], +--- a/src/print.c ++++ b/src/print.c +@@ -205,7 +205,7 @@ + if (PORT(port)->flags & P_STRING) + return; + f = PORT(port)->file; +-#if defined(HAVE_FPURGE) ++#if HAVE_DELC_FPURGE + (void)fpurge (f); + #elif defined(HAVE_BSD_FLUSH) + f->_cnt = 0; +--- a/src/read.c ++++ b/src/read.c +@@ -144,7 +144,7 @@ + if (PORT(port)->flags & P_STRING) + return; + f = PORT(port)->file; +-#if defined(HAVE_FPURGE) ++#if HAVE_DECL_FPURGE + (void)fpurge (f); + #elif defined(HAVE_BSD_FLUSH) + f->_cnt = 0; diff --git a/dev-scheme/elk/files/elk-3.99.8-makefile-ordering.patch b/dev-scheme/elk/files/elk-3.99.8-makefile-ordering.patch new file mode 100644 index 0000000000000..95fa97fb023a0 --- /dev/null +++ b/dev-scheme/elk/files/elk-3.99.8-makefile-ordering.patch @@ -0,0 +1,23 @@ +Fix ordering problems, allow parallel build. +https://bugs.gentoo.org/880349 +--- a/Makefile.am ++++ b/Makefile.am +@@ -1,6 +1,6 @@ + NULL = + +-SUBDIRS = include src lib scm doc examples test ++SUBDIRS = . include src lib scm doc examples test + DIST_SUBDIRS = $(SUBDIRS) + + EXTRA_DIST = \ +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -66,7 +66,7 @@ + $(NULL) + + bin_PROGRAMS = elk +-elk_LDADD = $(top_builddir)/src/libelk.la ++elk_LDADD = libelk.la + elk_SOURCES = main.c + + install-exec-hook: