* Re: guile-ncurses unicode support
2024-05-27 10:15 guile-ncurses unicode support tmarjeski
@ 2024-06-03 23:22 ` Frank Terbeck
[not found] ` <1555342211.843809.1717478647462@mail.yahoo.com>
0 siblings, 1 reply; 3+ messages in thread
From: Frank Terbeck @ 2024-06-03 23:22 UTC (permalink / raw)
To: tmarjeski; +Cc: help-guix, bug-guile-ncurses
Hi!
tmarjeski@gmail.com wrote:
[…]
> I'm having issues running the game this way, and I suspect there is no
> unicode support enabled on the guile-ncurses package build, even though
> it says that there is. Everything is working fine on my Arch system
> using guile and guile-ncurses from their package manager.
>
> When I run my game (which uses unicode characters), I only see "?" in
> place of the unicode. I attempted to `guix build guile-ncurses
> --no-substitutes` and install from there, but it did not work.
>
> Does this sound like an issue with guile-ncurses, or perhaps I am
> missing something crucial for `guix shell` to work properly?
I have just run into this as well, though I am using guix on top of De-
bian. But that difference should not matter.
I believe this is an issue with the guile-ncurses build in guix, that is
caused by an issue in guile-ncurses' configure.ac, that seems to behave
in unexpected ways with the "--with-ncursesw" option, that the guix
build uses.
To check I've put in this patch into guile-ncurses:
diff --git a/configure.ac b/configure.ac
index 51cc785..6615664 100644
--- a/configure.ac
+++ b/configure.ac
@@ -115,6 +115,8 @@ AC_ARG_WITH(ncursesw,
[with_ncursesw=no],
[with_ncursesw=check])
+echo "DEBUG: ($with_ncursesw)"
+
AC_MSG_NOTICE([checking for ncurses])
have_ncursesw_curses_h=no
I am using this guix-shell from a guile-ncurses git repository clone:
% guix shell --pure ncurses coreutils grep sed gawk gcc-toolchain \
make autoconf automake libtool pkg-config guile \
texinfo
With that, just calling the configure script:
% ./configure
…
DEBUG: (check)
configure: checking for ncurses
checking for ncursesw/curses.h... no
checking for ncurses/curses.h... no
checking for curses.h... yes
checking for library containing initscr... -lncursesw
checking for library containing u32_strconv_from_locale... -lunistring
checking for library containing new_menu... -lmenuw
checking for library containing new_form... -lformw
checking for library containing new_panel... -lpanelw
…
That looks very much like wide-character ncurses, and indeed if I build
it and run a little test script I get this:
% make
…
% ./tools/uninstalled-env guile -c '(use-modules (ncurses curses)) (format #t "wide-ncurses? ~a~%" %wide-ncurses)' 2> /dev/null
wide-ncurses? #t
That looks good.
Now with --with-ncursesw:
% ./configure --with-ncursesw
…
DEBUG: (no)
configure: checking for ncurses
checking for ncurses/curses.h... no
checking for curses.h... yes
checking for library containing initscr... -lncurses
checking for library containing new_menu... -lmenu
checking for library containing new_form... -lform
checking for library containing new_panel... -lpanel
checking for library containing initscr... (cached) -lncurses
…
…unexpected. Reading the configure.ac file looks to me like it is inten-
ded, that with this option things should actually error out instead of
falling back to the non-wide ncurses build, but this looks like it is a
synonym for --without-ncursesw.
Just to check, if I run my little test script:
% make
…
% ./tools/uninstalled-env guile -c '(use-modules (ncurses curses)) (format #t "wide-ncurses? ~a~%" %wide-ncurses)' 2> /dev/null
wide-ncurses? #f
Which confirms the suspicion.
I think what is actually intended is this:
diff --git a/configure.ac b/configure.ac
index 51cc785..cd8b8d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,7 +112,7 @@ esac
AC_ARG_WITH(ncursesw,
[AS_HELP_STRING([--without-ncursesw],
[Don't use ncursesw (wide character support)])],
- [with_ncursesw=no],
+ [with_ncursesw=$with_ncursesw],
[with_ncursesw=check])
AC_MSG_NOTICE([checking for ncurses])
@@ -147,13 +147,15 @@ then
[AC_MSG_FAILURE([curses.h could not be found])])
fi
-AS_IF([test "$with_ncursesw" = check],
+AS_IF([test "$with_ncursesw" = check || test "$with_ncursesw" = yes],
[AC_SEARCH_LIBS([initscr], [ncursesw],
[AC_DEFINE([HAVE_NCURSESW],
[1],
[Define if you have libncursesw])
with_ncursesw=yes],
- [AC_MSG_FAILURE([--with-ncursesw was given, but, test for ncursesw failed])])])
+ [AS_IF([test "$with_ncursesw" = check],
+ [with_ncursesw=no],
+ [AC_MSG_FAILURE([--with-ncursesw was given, but, test for ncursesw failed])])])])
AS_IF([test "$with_ncursesw" = no],
[AC_SEARCH_LIBS([initscr], [ncurses],
I am Cc:ing bug-guile-ncurses@gnu.org, which is the contact for the
maintainer as per the guile-ncurses homepage. I am not an expert in
autoconf, so this might not be the most idiomatic way of doing this.
In the meantime, the guix build could just drop --without-ncursesw from
their build instructions to make this work: Guix's ncurses has wide-cha-
racter support and the default of guile-ncurses is to test for this, so
it will succeed. A patch for that might look like this (untested):
diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index 94417079c7..982b59efe7 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -2718,8 +2718,12 @@ (define-public guile-ncurses
(guix build utils))
#:imported-modules ((guix build guile-build-system)
,@%gnu-build-system-modules)
- #:configure-flags (list "--with-ncursesw" ; Unicode support
- "--with-gnu-filesystem-hierarchy")
+ #:configure-flags (list
+ ;; This is currently commented out due to a bug
+ ;; in configure.ac of guile-ncurses, which makes
+ ;; this behave just like --without-ncurses.
+ ;;"--with-ncursesw" ; Unicode support
+ "--with-gnu-filesystem-hierarchy")
#:phases
(modify-phases %standard-phases
(add-before 'build 'fix-libguile-ncurses-file-name
Regards, Frank
^ permalink raw reply related [flat|nested] 3+ messages in thread