dev-scheme/racket: patch ncurses for expeditor support

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
This commit is contained in:
Maciej Barć
2022-02-14 16:48:15 +01:00
parent 5361be1350
commit 10954586c3
3 changed files with 167 additions and 1 deletions
@@ -0,0 +1,154 @@
From 683388b0fcc8d0cc386e0ab749bcbba7cea18c8f Mon Sep 17 00:00:00 2001
From: Matthew Flatt <mflatt@racket-lang.org>
Date: Mon, 14 Feb 2022 06:26:25 -0700
Subject: [PATCH] configure: try -ltinfo as curses linking flag
---
ac/curses.m4 | 21 +++++++++++++++++++--
bc/configure | 34 +++++++++++++++++++++++++++++++++-
cs/c/configure | 34 +++++++++++++++++++++++++++++++++-
3 files changed, 85 insertions(+), 4 deletions(-)
diff --git a/ac/curses.m4 b/ac/curses.m4
index 25b0f1f99a3..d713c990949 100644
--- a/ac/curses.m4
+++ b/ac/curses.m4
@@ -22,7 +22,7 @@ if test "${skip_curses_check}" = "no" ; then
if test "${enable_curses}" = "no" ; then
if test "${enable_portable}" = "yes" ; then
if test "${curses_portable_link}" != "" ; then
- # Try adding portabel link flags
+ # Try adding portable link flags
ORIG_LIBS="$LIBS"
ORIG_CPPFLAGS="$CPPFLAGS"
ORIG_PREFLAGS="$PREFLAGS"
@@ -62,7 +62,24 @@ if test "${skip_curses_check}" = "no" ; then
LIBS="$ORIG_LIBS"
curses_lib_flag=""
fi
- fi
+ fi
+ if test "${enable_curses}" = "no" ; then
+ # Try adding -lncurses -ltinfo
+ ORIG_LIBS="$LIBS"
+ curses_lib_flag=" -lncurses -ltinfo"
+ LIBS="$LIBS $curses_lib_flag"
+ AC_TRY_LINK(
+ [#include <curses.h>]
+ [#include <term.h>],
+[ int errret; ]
+[ setupterm("", 0, &errret);]
+ return 0;
+ , enable_curses=yes, enable_curses=no)
+ if test "${enable_curses}" = "no" ; then
+ LIBS="$ORIG_LIBS"
+ curses_lib_flag=""
+ fi
+ fi
fi
fi
fi
diff --git a/bc/configure b/bc/configure
index 543fab87411..132d2dedd6c 100755
--- a/bc/configure
+++ b/bc/configure
@@ -5991,7 +5991,7 @@ rm -f core conftest.err conftest.$ac_objext \
if test "${enable_curses}" = "no" ; then
if test "${enable_portable}" = "yes" ; then
if test "${curses_portable_link}" != "" ; then
- # Try adding portabel link flags
+ # Try adding portable link flags
ORIG_LIBS="$LIBS"
ORIG_CPPFLAGS="$CPPFLAGS"
ORIG_PREFLAGS="$PREFLAGS"
@@ -6055,6 +6055,38 @@ if ac_fn_c_try_link "$LINENO"; then :
else
enable_curses=no
fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test "${enable_curses}" = "no" ; then
+ LIBS="$ORIG_LIBS"
+ curses_lib_flag=""
+ fi
+ fi
+ if test "${enable_curses}" = "no" ; then
+ # Try adding -lncurses -ltinfo
+ ORIG_LIBS="$LIBS"
+ curses_lib_flag=" -lncurses -ltinfo"
+ LIBS="$LIBS $curses_lib_flag"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <curses.h>
+ #include <term.h>
+int
+main ()
+{
+ int errret;
+ setupterm("", 0, &errret);
+ return 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ enable_curses=yes
+else
+ enable_curses=no
+fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test "${enable_curses}" = "no" ; then
diff --git a/cs/c/configure b/cs/c/configure
index db2132b7f4d..2ec78292f56 100755
--- a/cs/c/configure
+++ b/cs/c/configure
@@ -5635,7 +5635,7 @@ rm -f core conftest.err conftest.$ac_objext \
if test "${enable_curses}" = "no" ; then
if test "${enable_portable}" = "yes" ; then
if test "${curses_portable_link}" != "" ; then
- # Try adding portabel link flags
+ # Try adding portable link flags
ORIG_LIBS="$LIBS"
ORIG_CPPFLAGS="$CPPFLAGS"
ORIG_PREFLAGS="$PREFLAGS"
@@ -5699,6 +5699,38 @@ if ac_fn_c_try_link "$LINENO"; then :
else
enable_curses=no
fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test "${enable_curses}" = "no" ; then
+ LIBS="$ORIG_LIBS"
+ curses_lib_flag=""
+ fi
+ fi
+ if test "${enable_curses}" = "no" ; then
+ # Try adding -lncurses -ltinfo
+ ORIG_LIBS="$LIBS"
+ curses_lib_flag=" -lncurses -ltinfo"
+ LIBS="$LIBS $curses_lib_flag"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <curses.h>
+ #include <term.h>
+int
+main ()
+{
+ int errret;
+ setupterm("", 0, &errret);
+ return 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ enable_curses=yes
+else
+ enable_curses=no
+fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test "${enable_curses}" = "no" ; then
+3
View File
@@ -26,6 +26,9 @@ Whether you're just starting out, want to know more about programming language a
<flag name="futures">
Enable racket/future library for fine-grained hardware parallelism
</flag>
<flag name="ncurses">
Add ncurses support for expeditor (REPL expression editor)
</flag>
<flag name="places">
Enable racket/place library for share-nothing parallelism and message-passing communication. Compared to futures, places are heavyweight, but they have a simpler performance model.
</flag>
@@ -25,7 +25,7 @@ LICENSE="
# where we use _p, _pre, etc it will have to be set manually.
SLOT="0/${PV}"
KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86"
IUSE="+chez +doc +futures +jit minimal +places +threads"
IUSE="+chez +doc +futures +jit minimal ncurses +places +threads"
# See bug #809785 re chez/threads
REQUIRED_USE="chez? ( futures places ) futures? ( jit threads ) places? ( threads )"
@@ -33,9 +33,17 @@ DEPEND="
!dev-tex/slatex
dev-db/sqlite:3
dev-libs/libffi:=
ncurses? ( sys-libs/ncurses:= )
"
RDEPEND="${DEPEND}"
# Backports that will be probably available in next release (8.5)
PATCHES=(
# Pick correct ncurses library
# https://github.com/racket/racket/commit/683388b0fcc8d0cc386e0ab749bcbba7cea18c8f
"${FILESDIR}"/${P}-ncurses.patch
)
# "mred" and "mzscheme" are binaries generated by Racket, not CC
QA_FLAGS_IGNORED="usr/bin/mred usr/bin/mzscheme"
@@ -81,6 +89,7 @@ src_configure() {
--enable-libs
$(usex chez "--enable-cs --enable-csonly" "--enable-bc --enable-bconly")
$(use_enable doc docs)
$(use_enable ncurses curses)
)
# Some options are togglable only for the BC version (are forced in CS)
! use chez && myconf+=(