Opened 10 days ago

Last modified 9 days ago

#69831 assigned enhancement

nethack: enable curses graphics

Reported by: jnielsendotnet Owned by: jflude
Priority: Normal Milestone:
Component: ports Version:
Keywords: haspatch Cc: Nax (Maxime Bacoux)
Port: nethack

Description

The attached allows "OPTIONS=windowtype:curses" to work.

Attachments (1)

nethack_curses.patch (1.4 KB) - added by jnielsendotnet 10 days ago.
Update Portfile and add patch file to enable curses interface

Download all attachments as: .zip

Change History (5)

Changed 10 days ago by jnielsendotnet

Attachment: nethack_curses.patch added

Update Portfile and add patch file to enable curses interface

comment:1 Changed 10 days ago by jmroot (Joshua Root)

Cc: Nax added
Owner: set to jflude
Port: nethack added
Status: newassigned

comment:2 Changed 10 days ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added
Summary: games/nethack enable curses graphicsnethack: enable curses graphics

I'm surprised this didn't already work since the port already has a dependency on the ncurses port.

Assuming I understand you correctly and this changes the runtime behavior of the program, the revision must be increased.

This port has a nethack343 subport, so make sure this fix is applied both to the main port and to the nethack343 subport, assuming each one needs it, and that the revision of each one that needs it is increased.

Specifying CFLAGS manually like this is not great. In fact it highlights that the port hasn't been using the CFLAGS that MacPorts wants all ports to use (for example the default optimization flags), which are in ${configure.cflags}, just as the CPPFLAGS that should be used are in ${configure.cppflags} and the LDFLAGS that should be used are in ${configure.ldflags}. The makefile portgroup can help Portfiles with nonstandard Makefiles use these flags properly, or it can be done manually. Then adding to CFLAGS is a simple matter of e.g. configure.cflags-append -I../include -DCURSES_GRAPHICS -DNOTPARMDECL, except that these really look like CPPFLAGS to me, not CFLAGS.

The nethack343 subport even manually adds -O2 optimization flags and performs some convoluted gyrations in the menucolors variant to add more CFLAGS which would be simplified by making the portfile use the standard variables.

comment:3 Changed 10 days ago by jnielsendotnet

The "curses interface" in Nethack is more than just a dependency on the ncurses library, it's a very different way of displaying the game. It still uses a text interface but it draws "windows" for different parts of the game including the map, inventory, status and message history. The "tty" interface just has the map and a small status area and inventory or long message history is overlaid on top of the map. Defining "CURSES_GRAPHICS" is what enables support for the alternative interface; the other changes are all needed for compilation and linking to succeed.

I'm happy to submit another patch with the revision incremented.

I agree the existing flags in the port are kind of a mess, however I'm not experienced enough with MacPorts internals to be competent at fixing them.

In Nethack 3.4.3 the curses interface was only available as an external patchset. This is true of several other features present in 3.6 as well (such as MENUCOLOR), and the port currently doesn't bring any of those in. I don't have an opinion on whether that should change but adding 3rd-party optional code is beyond the scope of what I'm trying to do, which is to make it easier for other MacPorts users to benefit from the existing code in 3.6.

comment:4 Changed 9 days ago by ryandesign (Ryan Carsten Schmidt)

Agreed, if the feature didn't exist in 3.4.3, then don't add it there.

My other remarks about general cleanup were more directed at the port maintainers than at you.

Note: See TracTickets for help on using tickets.