Commit Graph

410 Commits

Author SHA1 Message Date
nhmall
c12344cd48 build dos in CI but skip faltering Terminus font steps 2025-11-10 12:56:49 -05:00
nhmall
2c747b079e revert some CI test changes 2025-11-10 09:19:47 -05:00
nhmall
efbc0d8f8f more troubleshooting Terminus font use in CI environment 2025-11-10 08:52:06 -05:00
nhmall
4dfdeb8e92 follow-up in seldom-used places 2025-11-08 14:53:50 -05:00
Hector Denis
4e29db079b Fix QTCXXFLAGS and WINLIB when compiling with WANT_WINT_QT6.
The previous code made incorrect assumptions about Qt6's file hierarchy. Reuse automatic configuration (with pkg-config) for Qt5, and replace '5' by '6'.
Also fix a typo in multiw-2.370.
2025-11-05 18:20:55 +01:00
nhmall
f636749ea2 suppress dozens of new compiler warnings with clang-21
Turn off default -Wdeprecated-octal-literals warning with clang-21

One example of many:

In file included from objects.c:22:
../include/objects.h:137:1: warning: octal literals without a '0o' prefix are deprecated
      [-Wdeprecated-octal-literals]
  137 | PROJECTILE("arrow", NoDes,
      | ^
../include/objects.h:119:48: note: expanded from macro 'PROJECTILE'
  119 |            BITS(kn, 1, 1, 0, 0, 1, 0, 0, 0, 0, PIERCE, sub, metal), \
      |                                                ^
../include/objclass.h:79:18: note: expanded from macro 'PIERCE'
   79 | #define PIERCE   01 /* pointed weapon punctures target */
      |                  ^
In file included from objects.c:22:
../include/objects.h:140:1: warning: octal literals without a '0o' prefix are deprecated
      [-Wdeprecated-octal-literals]
  140 | PROJECTILE("elven arrow", "runed arrow",
      | ^
../include/objects.h:119:48: note: expanded from macro 'PROJECTILE'
  119 |            BITS(kn, 1, 1, 0, 0, 1, 0, 0, 0, 0, PIERCE, sub, metal), \
      |                                                ^
../include/objclass.h:79:18: note: expanded from macro 'PIERCE'
   79 | #define PIERCE   01 /* pointed weapon punctures target */
      |                  ^
In file included from objects.c:22:
../include/objects.h:143:1: warning: octal literals without a '0o' prefix are deprecated
      [-Wdeprecated-octal-literals]
  143 | PROJECTILE("orcish arrow", "crude arrow",
      | ^
../include/objects.h:119:48: note: expanded from macro 'PROJECTILE'
  119 |            BITS(kn, 1, 1, 0, 0, 1, 0, 0, 0, 0, PIERCE, sub, metal), \
      |                                                ^
../include/objclass.h:79:18: note: expanded from macro 'PIERCE'
   79 | #define PIERCE   01 /* pointed weapon punctures target */
      |                  ^
2025-10-22 12:52:10 -04:00
nhmall
349fbe93b1 less verbose compiler command lines during build
If using hints file sys/unix/hints/linux.370 or sys/unix/hints/macOS.370
allow the majority of the boilerplate compile switches to reside in a
compiler response file, instead of on the command line.

Include one of the following on your make command line:

make response=1
  or
make resp=1

It can be combined with other make command line options. See
sys/unix/README-hints for further information about those.

The response files that it uses are:
    CC   (clang or gcc)    src/nethack_cc.rsp
    CXx  (clang++ or g++)  src/nethack_cxx.rsp

Note: I think the reduced clutter should actually become the default,
and the override should be noresponse=1 to NOT use it, but I'm
not sure how others feel, so for now, it requires
    make resp=1
Feedback on whether that should become the default or not
is welcome.

Tested on Linux with gcc-15 and on Linux with clang-20.

I haven't had a chance to test it on macOS yet.
2025-09-07 12:50:54 -04:00
nhmall
6c22e7af45 attempt to ensure the correct curses.h is used on Linux
OpenSUSE Tumbleweed ncurses 6.5 requires the one in
/usr/include/ncursesw/curses.h, if ncursesw is being used.

Otherwise, several needed function prototypes are not there.

Fixes #1427
2025-07-10 22:44:56 -04:00
nhmall
34b42d2354 recent qt6 requires c++20
There are warnings within the qt6 header files if c++20 is not used, for example:

usr/include/x86_64-linux-gnu/qt6/QtCore/qfuturesynchronizer.h:21:5: warning: use of the 'nodiscard' attribute is a C++20 extension [-Wc++20-attribute-extensions]
   21 |     Q_NODISCARD_CTOR_X("Use future.waitForFinished() instead.")
      |     ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qcompilerdetection.h:972:43: note: expanded from macro 'Q_NODISCARD_CTOR_X'
  972 | #    define Q_NODISCARD_CTOR_X(message) [[nodiscard(message)]]
      |                                           ^
1 warning generated.

qmake6 --version
QMake version 3.1
Using Qt version 6.8.3 in /usr/lib/x86_64-linux-gnu
2025-06-29 11:59:07 -04:00
nhmall
a654d08c3b save/restore changes - part 3
This is the third of a series of savefile-related changes.

    This adds early-days experimental support for a completely optional
    'sfctool' utility (savefile conversion tool), to be able to export
    a savefile's contents into a more portable format. There are likely
    to be bugs at this stage. In this initial first-attempt, the export
    format is a very simple ascii output.

    NetHack can be built entirely, without also building this tool.
    NetHack has no dependencies on the tool.

    Attempts were made to minimize duplication of existing NetHack code.
    To achieve that, unfortunately, #ifdef SFCTOOL and #ifndef SFCTOOL
    had to be sprinkled around through some of the existing NetHack
    source code, so that it could be re-used for building the utility.

    The process for building the sfctool typically recompiles the source
    files with #define SFCTOOL and a distinct object file with SF- is
    produced.

sfctool notes:

    Universal ctags is used and required to produce the sfctool utility.

    Some targets were added to the Unix and Windows Makefiles to
    facilitate the build process.

         make sfctool

    That should build a copy in util.

    Note: At present, the Unix Makefiles do not copy sfctool over to the
          NetHack playground during 'make install' or 'make update'.
          Until that gets resolved by someone, The tool will
          have to be manually copied there by the builder/admin if
          desired.
          cp util/sfctool ~/nh/install/games/lib/nethackdir/sfctool

    Also, a separate Visual Studio sfctool.sln solution was written and
    placed in sys/windows/vs. That has has only very limited testing.

    Usage:

      i)  To convert an existing savefile to an exportascii format
          that co-resides with the savefile:

          sfctool -c savefile

          That *must* be executed on the same platform / architecture /
          data model that produced the save file in the first place.

     ii)  To unconvert an existing exportascii format export file to a
          historical format savefile that can then be used by NetHack:

          sfctool -u savefile

          That must be executed on the same target platform / architecture /
          data model that was used to build the NetHack that will
          utilize the save file that results.

     A Windows example:

          sfctool -c Fred.NetHack-saved-game

          That should result in creation of Fred.NetHack-saved-game.exportascii
          from existing savefile:
              %USERPROFILE%\AppData\Local\NetHack\3.7\Fred.NetHack-saved-game

     A Unix example:

          sfctool -c 1000wizard

          That should result in creation of 1000wizard.exportascii.gz
          from existing savefile in the playground save directory:
              1000wizard.gz

  Current Mechanics:
     1. Makefile recipe, or script uses universal ctags to produce
        util/sf.tags.

     2. util/sftags is built and executed to read util/sf.tags and
        generate: include/sfproto.h and src/sfdata.c.

     3. util/sfctool is built from the following:
        generated file compiled with -DSFCTOOL:
                    src/sfdata.c       -> sfdata.o
        existing files compiled with -DSFCTOOL:
                    util/sfctool.c     -> sfctool.o
                    util/sfexpasc.c    -> sfexpasc.o
                    src/alloc.c        -> sf-alloc.o
                    src/monst.c        -> sf-monst.o
                    src/objects.c      -> sf-objects.o
                    src/sfbase.c       -> sfbase.o
                    src/sfstruct.c     -> sfstruct.o
                    src/nhlua.c        -> sf-nhlua.o
                    util/panic.c       -> panic.o
                    src/date.c         -> sf-date.o
                    src/decl.c         -> sf-decl.o
                    src/artifact.c     -> sf-artifact.o
                    src/dungeon.c      -> sf-dungeon.o
                    src/end.c          -> sf-end.o
                    src/engrave.c      -> sf-engrave.o
                    src/cfgfiles.c     -> sf-cfgfiles.o
                    src/files.c        -> sf-files.o
                    src/light.c        -> sf-light.o
                    src/mdlib.c        -> sf-mdlib.o
                    src/mkmaze.c       -> sf-mkmaze.o
                    src/mkroom.c       -> sf-mkroom.o
                    src/o_init.c       -> sf-o_init.o
                    src/region.c       -> sf-region.o
                    src/restore.c      -> sf-restore.o
                    src/rumors.c       -> sf-rumors.o
                    src/sys.c          -> sf-sys.o
                    src/timeout.c      -> sf-timeout.o
                    src/track.c        -> sf-track.o
                    src/version.c      -> sf-version.o
                    src/worm.c         -> sf-worm.o
                    src/strutil.c      -> strutil.o
2025-05-25 20:38:17 -04:00
nhmall
8ac31b24f6 libnh build
The macOS.370 has not yet been tested, but it is patterned after
the linux.370 changes.
2025-05-12 08:45:26 -04:00
nhmall
8f38267775 use documented SIG_RET_TYPE for Linux with gcc 2025-04-20 13:13:30 -04:00
nhmall
5560bdb27c msdos recover 2025-04-15 19:53:50 -04:00
nhmall
fbb8ef2fa6 follow-up: set STRIPBS in Makefiles 2025-03-10 17:18:58 -04:00
nhmall
bddca2ded5 musl libc build, rather than glibc
We've had reports of a couple of issues building against musl libc.

Issues reported:
  - build procedures utilize cat for Guidebook-creation, and cat
    is deprecated in distros that use musl libc.

  - some of the CRASHREPORT code is using library functions that
    are not available in the musl libc environment. The reported
    functions were backtrace() and backtrace_symbols(), which use
    header file /usr/include/execinfo.h.

So we'll try to accommodate this. Since we don't have a means of
autodetecting the musl libc situation during the build (as of yet), the
builder will have to specify 'make musl=1' on the make command line.

Specifying 'musl=1' on the make command line will:
1. ensure that NOCRASHREPORT gets defined in the C preprocessor.
2. set COLCMD to be '../util/stripbs' instead of 'col -bx'.

Closes #1393
2025-03-10 17:14:24 -04:00
Keni
372ebd9d80 NOSTATICFN/NONOSTATICFN typos and logic fixes 2025-02-17 11:50:55 -05:00
nhmall
7cc118365c quiet down mips cross-compile
Even though most of these are cast to void (but not all), the
mips cross-compiler seems determined to warn about them anyway.

Suppress that particular warning altogether to quiet the build.
That is not the ideal approach, but if the normal way of whitelisting
individual cases isn't working, I'm not sure of another course of
action.
2025-01-05 15:51:11 -05:00
nhmall
37758c7e48 some tty updates
Add a note about NO_TERMS to include/wintty.h for clarity.

Rename tty_startup and tty_shutdown to term_startup() and
term_shutdown(). They are found in termcap.c for !NO_TERMS
like most of the other term_ routines, as well as having
versions for several of the NO_TERMS platforms. They aren't
part of the tty_interface called from the core. The tty
implementation does call and rely on them.

Remove some conditional #ifdef's around term_shutdown()
(formerly tty_shutdown()) and just ensure that all the
tty platforms have an implementation that they can link
with, even if it is just a stub presently.

Put the protype for nethack_exit in extern.h to reduce
maintenance to a single spot, and remove it from other
locations. A warning in the msdos cross-compile led to
this change.
2025-01-04 19:01:34 -05:00
nhmall
e20908fa4f remove an unused part of msdos cross-compile 2024-12-30 12:59:00 -05:00
nhmall
ac50b7fecc update the msdos cross-compile
date.c wasn't always being recompiled.
A couple of other bits.
2024-12-30 12:52:35 -05:00
nhmall
7b4445f040 make msdos lib/djgpp/target folder more hierarchical
Instead of flat, have bin, lib and include folders for
the native DOS pieces.

If you have been cross-compiling for MSDOS, you will
need to carry out the following to bring things up-to-date:

    sys/msdos/fetch-cross-compiler.sh
    make CROSS_TO_MSDOS=1 WANT_DEBUG=1 package
2024-12-29 12:11:03 -05:00
nhmall
45b2a6c49a more C standard progress
There was a transcription error in the comments in cstd.h for
the standard list of header files, where only the description
remained for <stdlib.h>, not the name of the file itself.

Remove several extraneous inclusions of the standard C99 headers.

Tested on the following afterwards:
Linux (using hints/linux.370) including tty, curses, qt6, and X11
macOS (using hints/macOS.370) including tty, curses, qt5, and X11
Windows MSYS2 using sys/windows/GNUmakefile
Windows Visual Studio using sys/windows/Makefile.nmake
msdos cross-compile on Ubuntu using djgpp cross-compiler
2024-12-20 10:32:38 -05:00
nhmall
f32e766728 MIPS cross-compile bit
Use 3 additional Makefile variables
2024-12-17 19:16:00 -05:00
nhmall
6ce2ae956e simplify inclusion of debugging capability in msdos package
This build command will include line number info, gdb.exe or nhgdb.bat in the package:

        make CROSS_TO_MSDOS=1 WANT_DEBUG=1 package

This build command will not include line number info, gdb.exe or nhgdb.bat in the package:

        make CROSS_TO_MSDOS=1 package
2024-12-17 15:33:39 -05:00
nhmall
0a5948fffc follow-up on msdos cross-compile
Obtain gdb.exe during the execution of sys/msdosfetch-cross-compiler.sh
ahead of the build, so that the Makefile just has to move it into place.
2024-12-15 20:08:10 -05:00
nhmall
69600c3f38 add an optional deploy-to-dosbox target for msdos cross-compile
The WANT_DEBUG=1 will cause the cross-compile to include line
number information in the NetHack executable, useful for
backtraces and gdb debugging sessions.

How a developer can use the optional deploy-to-dosbox target:
    make CROSS_TO_MSDOS=1 WANT_DEBUG=1 dosbox=/mnt/c/dosbox deploy-to-dosbox

where dosbox= points to the directory which will be mounted for
your drive in dosbox

THe deploy-to-dosbox recipe ensures that a target copy of gdb.exe
ends up alongside nethack.exe at the target, including:
  - placing the source code that gdb requires on the target
    in the nhsrc subfolder.
  - an nhgdb.bat that supplies the right switches to gdb
    for locating the NetHack sources.
2024-12-15 10:26:49 -05:00
nhmall
fd7c314e9e adjust compiler switches in msdos cross-compile 2024-12-15 10:15:23 -05:00
nhmall
8b08244c9b Cross-compile build fixes
recover was not being built correctly under cross compilation
2024-12-01 13:24:30 -05:00
nhmall
c81af23c8c place MIPS cross-compile game in targets subfolder 2024-12-01 09:10:33 -05:00
nhmall
f8d9b288b9 Merge branch 'NetHack-3.7' of https://github.com/guillaumebrunerie/NetHack into NetHack-3.7 2024-11-30 15:54:21 -05:00
nhmall
88301902f8 remove a left-over piece of a test 2024-11-30 14:47:04 -05:00
nhmall
0792e5fe9e expand implicit fallthrough detection to non-gcc compilers
gcc has recognized various "magic comments" for white-listing
occurrences of implicit fallthrough in switch statements for
a long time:

    The range and shape of "falls through" comments accepted are
    contingent upon the level of the warning. (The default level is =3.)

    -Wimplicit-fallthrough=0 disables the warning altogether.
    -Wimplicit-fallthrough=1 treats any kind of comment as a "falls through" comment.
    -Wimplicit-fallthrough=2 essentially accepts any comment that contains something
     that matches (case insensitively) "falls?[ \t-]*thr(ough|u)" regular expression.
    -Wimplicit-fallthrough=3 case sensitively matches a wide range of regular
     expressions, listed in the GCC manual. E.g., all of these are accepted:
        /* Falls through. */
        /* fall-thru */
        /* Else falls through. */
        /* FALLTHRU */
        /* ... falls through ... */
       etc.
    -Wimplicit-fallthrough=4 also, case sensitively matches a range of regular
     expressions but is much more strict than level =3.
    -Wimplicit-fallthrough=5 doesn't recognize any comments.

Plenty of other compilers did not recognize the gcc comment convention,
and up until now the compiler warning for detecting unintended
fallthrough had to be suppressed on other compilers. That's because the code
in NetHack has been relying on the gcc approach, and only the gcc approach.

The C23 standard introduces an attribute [[fallthrough]] for the
functionality, when implicit fallthrough warnings have been enabled.

Several popular compilers already support that, or a very similar attribute
style approach, today, even ahead of their C23 support:

       C compiler                       whitelist approach
       ---------------------------   -------------------------------------
       C23 conforming compilers         [[fallthrough]]

       clang versions supporting
       standards prior to
       C23                              __attribute__((__fallthrough__))

       Microsoft Visual Studio
       since VS 2022 17.4.
       The warning C5262 controls
       whether the implict
       fallthrough is detected and
       warned about with
       /std:clatest.                    [[fallthrough]]

This adds support to NetHack for the attribute approach by inserting a
macro FALLTHROUGH to the existing cases that require white-listing, so
other compilers can analyze things too.

The definition of the FALLTHROUGH macro is controlled in include/tradstdc.h.

The gcc comment approach has also been left in place at this time.
2024-11-30 14:16:27 -05:00
Guillaume Brunerie
52876c4798 WASM fixes 2024-11-30 17:07:10 +01:00
nhmall
37793be6eb more quieting of Qt6 build warnings 2024-11-20 09:56:01 -05:00
nhmall
3e903fd79a quiet warnings on recent Qt, macOS Sequoia 15.1, latest Xcode 2024-11-17 10:03:04 -05:00
nhmall
b61c3e5138 repair msdos cross-compile (take 2) 2024-10-05 17:40:03 -04:00
nhmall
575030548a repair msdos cross-compile 2024-10-05 16:48:52 -04:00
G. Branden Robinson
d116052796 Build *roff documents with groff warnings enabled.
...some of them, at any rate.  We shut off (1) warnings provoked by Matt
Bishop's "mn" macro package, and (2) warnings spuriously emitted by
groff 1.23 and previous when "-wall" (or "-ww") is specified.

Also update explanatory comments.
2024-09-14 09:58:12 -05:00
nhkeni
aa542afe53 Merge branch 'NetHack-3.7' into keni-prefix 2024-09-06 15:07:19 -04:00
nhmall
4353ee49d8 sed substitution went too far (wasm cross-compile)
Also, link with hacklib
2024-07-28 12:27:02 -04:00
nhkeni
a8b5e88744 add the git prefix to the long version output
Tested on MacOS, written and not tested for Linux, not attempted for Windows
2024-06-19 12:28:13 -04:00
Mika Kuoppala
20f8af224b hints/linux.370: Add support for ubsan (undefined behaviour sanitizer) for gcc
This will add an option to compile and link nethack executable
with ubsan and catch undefined behaviour errors on runtime.
2024-06-09 09:34:57 -04:00
nhmall
fce82ac0f3 Merge branch 'patch-4' of https://github.com/nikolas/NetHack into NetHack-3.7 2024-05-07 10:15:17 -04:00
Pasi Kallinen
a57d0e6f4f Curses: add support for the palette config option
Depends on CHANGE_COLOR compile-time option.

Also allow multiple palette-definitions in the config file.
2024-04-13 12:01:43 +03:00
nhmall
d0c543748e follow-up: use VIEWDEPRECATIONS instead of KEEPDEPRECATIONS 2024-04-01 15:04:07 -04:00
nhmall
61252f5c02 allow KEEPDEPRECATIONS=1 on make command line to see what's deprecated 2024-04-01 14:59:41 -04:00
nikolas
f507ebba47 Fix typo in linux.370 hint file 2024-03-21 14:46:03 -04:00
Pasi Kallinen
4030ef13a0 Curses: implement the windowcolors option
Allow changing the curses windows foreground and background colors,
for example:

OPTIONS=windowcolor:menu #8000F0/20F080 message grey/blue
2024-03-17 18:41:52 +02:00
nhkeni
0227a2e0bf hints/macOS.370: remove testing code 2024-03-16 19:42:42 -04:00
nhkeni
59486fb8ad something concrete for discussion:
infrastructure for NOSTATICFN, replacing NOSTATICCORE
2024-03-13 11:39:24 -04:00