Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 777642

Summary: games-roguelike/nethack-3.6.6 does not build with CURSES_GRAPHICS support
Product: Gentoo Linux Reporter: Eben Bruyns <eben>
Component: Current packagesAssignee: Gentoo Games <games>
Status: UNCONFIRMED ---    
Severity: normal CC: dion, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: rough ebuild that will build nethack for tty and curses but not X

Description Eben Bruyns 2021-03-22 07:11:25 UTC
Created attachment 692859 [details]
rough ebuild that will build nethack for tty and curses but not X

Nethack does not build with CURSES_GRAPHICS.

I chased my tail on this one for a while, mostly because I'm not familiar with ebuilds.

Eventually I've managed to narrow it down to the hints file. I used the sys/unix/hints/linux file. I think the old hints file is not sufficient for a CURSES_GRAPHICS build.

I didn't mange to get it to work with X so I just commented the parts relating to X out. I suspect it would be changes to the hints file again.

I've attached my rough ebuild that now builds a version of Nethack with tty and curses support.

I hope this information is helpful in some way.
Comment 2 Jazeel Abdul-Jabbar 2021-10-14 02:31:14 UTC
The above link has helped tremendously.
To enable ncurses support, one needs to first modify the ebuild and add "append-cflags -DCURSES_GRAPHICS" under the src_compile() section.

The appropriate hints file must also be changed. The file to modify depends on whether the X use flag is enabled or not.
If the 'X' use flag is enabled, files/nethack-3.6.3-hint-x11 must be changed so that the section containing
WINSRC = $(WINTTYSRC) $(WINX11SRC)
WINOBJ = $(WINTTYOBJ) $(WINX11OBJ)
WINLIB = $(WINTTYLIB) $(WINX11LIB)
becomes
WINSRC = $(WINTTYSRC) $(WINX11SRC) $(WINCURSESSRC)
WINOBJ = $(WINTTYOBJ) $(WINX11OBJ) $(WINCURSESOBJ)
WINLIB = $(WINTTYLIB) $(WINX11LIB) $(WINCURSESLIB)

If the X use flag is not enabled, files/nethack-3.6.3-hint-tty will be used by the ebuild instead, and the above modification should be made to that file.

I believe these changes should be default to the nethack ebuild and hints file(s) seeing as ncurses is already a dependency.
Comment 3 Morton Pellung 2022-11-01 11:34:49 UTC
Confirming fix proposed by Jazbeel for TTY: add one cflags and curses sources to *-hint-tty and the pretty curses graphics work in console - yay! - thank you Jazbeel for info!

+1 for fixing this :-)

Notes: I investigated this because Nethack@Termux on Android tablet has curses graphics. However, both Debian and Ubuntu nethack-console package seem to be compiled only with default tty support and no curses - why? So there must be a reason?

Looking at the NH366 source package, sys/unix/hints/linux has curses enabled, but the nethack-3.6.6-hint-tty used by the Gentoo ebuild has not. Hm.
Comment 4 Morton Pellung 2022-11-17 21:58:08 UTC
First, apology for misspelling Jazeel in last comment - sorry

Second, I was unable to find a codepage437 translation tool in Gentoo's ebuilds to use curses AND IBMgraphics - the best terminal experience. A workaround is to use this cp437 tool: https://github.com/keaston/cp437
Compile cp437 binary and put somewhere in PATH.

in .nethackrc:
OPTIONS=windowtype:curses,IBMgraphics

and then chain-start nethack via cp437:
"cp437 nethack"

...enjoy nice terminal graphics on Gentoo!
HTH :-)