dev-scheme/scm: Fix REQUIRED_USE, add missing ifdef

`bignums` hard-depends on `arrays` and `inexact`, require use.
fallback function for `arrays` was gated with wrong define.

Closes: https://bugs.gentoo.org/972877
Signed-off-by: NHOrus <jy6x2b32pie9@yahoo.com>
Part-of: https://codeberg.org/gentoo/gentoo/pulls/660
Merges: https://codeberg.org/gentoo/gentoo/pulls/660
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
NHOrus
2026-04-18 21:50:16 +03:00
committed by Sam James
parent cb8651c461
commit c44d1016c3
2 changed files with 206 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
diff '--color=auto' -Naur scm.old/scl.c scm/scl.c
--- scm.old/scl.c 2026-04-18 21:41:05.718448466 +0300
+++ scm/scl.c 2026-04-18 21:41:28.657818441 +0300
@@ -953,7 +953,7 @@
/* at this point, we have a legitimate floating point result */
if (lead_sgn==-1) res = -res;
if (i==len)
-# ifdef SINGLES
+# if defined SINGLES && defined ARRAYS
return shrtp ? makflo(res) : makdbl(res, 0.0);
# else
return makdbl(res, 0.0);

View File

@@ -0,0 +1,194 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# Version magic thanks to masterdriverz and UberLord using bash array instead of tr
trarr="0abcdefghi"
MY_PV="$(ver_cut 1)${trarr:$(ver_cut 2):1}$(ver_cut 3)"
MY_P=${PN}-${MY_PV}
inherit toolchain-funcs flag-o-matic
DESCRIPTION="SCM is a Scheme implementation from the author of slib"
HOMEPAGE="https://people.csail.mit.edu/jaffer/SCM.html"
SRC_URI="https://groups.csail.mit.edu/mac/ftpdir/scm/${MY_P}.zip"
S=${WORKDIR}/${PN}
LICENSE="LGPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="arrays bignums cautious dynamic-linking engineering-notation gsubr inexact ioext macro ncurses posix readline regex sockets unix"
REQUIRED_USE="bignums? ( arrays inexact )"
BDEPEND="app-arch/unzip"
DEPEND=">=dev-scheme/slib-3.1.5
dev-util/cproto
ncurses? ( sys-libs/ncurses:0= )
readline? ( sys-libs/libtermcap-compat )"
RDEPEND="${DEPEND}"
PATCHES=(
"${FILESDIR}"/${P}-ported-fixes.patch
"${FILESDIR}"/${P}-c99.patch
"${FILESDIR}"/${P}-QA.patch
"${FILESDIR}"/${P}-ncurses.patch
"${FILESDIR}"/${P}-arrays.patch
)
src_prepare() {
default
sed \
-e "s|\"gcc\"|\"$(tc-getCC)\"|g" \
-e "s|\"ld\"|\"$(tc-getLD)\"|g" \
-e "s|\"-shared\"|\"-shared ${LDFLAGS}\"|g" \
-i ./build.scm || die
}
src_configure() {
append-cflags -std=gnu17
./configure \
--prefix="${EPREFIX}"/usr \
--mandir="${EPREFIX}"/usr/share/man \
--infodir="${EPREFIX}"/usr/share/info \
--datadir="${EPREFIX}"/usr/share \
--sysconfdir="${EPREFIX}"/etc \
--localstatedir="${EPREFIX}"/var/lib \
--libdir="${EPREFIX}"/usr/$(get_libdir) \
--docdir="${EPREFIX}"/usr/share/doc/${PF} \
--htmldir="${EPREFIX}"/usr/share/doc/${PF}/html \
|| die
}
src_compile() {
# SLIB is required to build SCM.
local slibpath="${EPREFIX}/usr/share/slib/"
if [ -n "$SCHEME_LIBRARY_PATH" ]; then
einfo "using SLIB $SCHEME_LIBRARY_PATH"
elif [ -d ${slibpath} ]; then
export SCHEME_LIBRARY_PATH=${slibpath}
fi
einfo "Making scmlit"
emake -j1 CC=$(tc-getCC) scmlit clean
einfo "Building scm"
local features=""
use arrays && features+="arrays"
use bignums && features+=" bignums"
use cautious && features+=" cautious"
use engineering-notation && features+=" engineering-notation"
use inexact && features+=" inexact"
use macro && features+=" macro"
( use readline ||
use ncurses ||
use regex ||
use posix ||
use ioext ||
use gsubr ||
use sockets ||
use unix ||
use dynamic-linking ) && features+=" dynamic-linking"
./build \
--compiler-options="${CFLAGS}" \
--linker-options="${LDFLAGS} -L${EPREFIX}/$(get_libdir)" \
-s "${EPREFIX}"/usr/$(get_libdir)/scm \
-F ${features:="none"} \
-h system \
-o scm || die
einfo "Building DLLs"
if use readline; then
./build \
--compiler-options="${CFLAGS}" \
--linker-options="${LDFLAGS}" \
-h system \
-F edit-line \
-t dll || die
fi
if use ncurses ; then
./build \
--compiler-options="${CFLAGS}" \
--linker-options="${LDFLAGS}" \
-F curses \
-h system \
-t dll || die
fi
if use regex ; then
./build \
--compiler-options="${CFLAGS}" \
--linker-options="${LDFLAGS}" \
-c rgx.c \
-h system \
-t dll || die
fi
if use gsubr ; then
./build \
--compiler-options="${CFLAGS}" \
--linker-options="${LDFLAGS}" \
-c gsubr.c \
-h system \
-t dll || die
fi
if use ioext ; then
./build \
--compiler-options="${CFLAGS}" \
--linker-options="${LDFLAGS}" \
-c ioext.c \
-h system \
-t dll || die
fi
if use posix; then
./build \
--compiler-options="${CFLAGS}" \
--linker-options="${LDFLAGS}" \
-c posix.c \
-h system \
-t dll || die
fi
if use sockets ; then
./build \
--compiler-options="${CFLAGS}" \
--linker-options="${LDFLAGS}" \
-c socket.c \
-h system \
-t dll || die
fi
if use unix ; then
./build \
--compiler-options="${CFLAGS}" \
--linker-options="${LDFLAGS}" \
-c unix.c \
-h system \
-t dll || die
fi
}
src_test() {
emake check
}
src_install() {
emake -j1 DESTDIR="${D}" man1dir="${EPREFIX}"/usr/share/man/man1/ \
install
doinfo scm.info
doinfo hobbit.info
}
regen_catalog() {
einfo "Regenerating catalog..."
scm -e "(require 'new-catalog)"
}
pkg_postinst() {
[[ -z ${ROOT} ]] && regen_catalog
}
pkg_config() {
regen_catalog
}