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 <jy6x2b32pie9@yahoo.com>
Part-of: https://codeberg.org/gentoo/gentoo/pulls/422
Merges: https://codeberg.org/gentoo/gentoo/pulls/422
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
NHOrus
2026-03-26 17:03:49 +03:00
committed by Sam James
parent 9acd2f324a
commit c95cb2e9cc
3 changed files with 113 additions and 0 deletions

View File

@@ -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
}

View File

@@ -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 <sys/ioctl.h>
# tcflsh use TCFLSH ioctl from <termio.h>
# 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;

View File

@@ -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: