From 8d0cfb05fa34254a9279e7585f43816557a676c8 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 15 May 2026 12:11:34 -0400 Subject: [PATCH] rename netbsd.500 to bsd.500 In past releases of NetHack, there was a myriad of different hints files for different operating systems, and even different versions of operating systems. It made maintenance a chore, because all the variable hints files had to be updated for a wanted change, or (as typically was the case), some lesser-used hints files were left behind and became outdated. Instead of going down that road again, this renames sys/unix/hints/netbsd.500 to sys/unix/hints/bsd.500 Where things need to differ for a different bsd flavour, the differences can be shrouded in things like .if ${WHICHBSD} == "NETBSD" .else .endif This change is being done to make maintenance easier, at the cost of making the resulting Makefiles a little more complex, but there won't be as many separate Makefile hints to maintain. This commit is being done instead of merging pull request #1531 which would add a new sys/unix/hints/openbsd.500 file. Only tested on NetBSD so far. Please let us know if there's an issue on other bsd's, and we will attempt to fix thos issues. Closes #1531 Close --- include/unixconf.h | 2 +- sys/unix/hints/{netbsd.500 => bsd.500} | 12 +++++++++++- sys/unix/hints/include/whichbsd.500 | 22 ++++++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) rename sys/unix/hints/{netbsd.500 => bsd.500} (88%) create mode 100644 sys/unix/hints/include/whichbsd.500 diff --git a/include/unixconf.h b/include/unixconf.h index 1fe51c128..f4856055c 100644 --- a/include/unixconf.h +++ b/include/unixconf.h @@ -338,7 +338,7 @@ #endif #if defined(BSD) || defined(ULTRIX) -#if !defined(DGUX) && !defined(SUNOS4) && !defined(__NetBSD__) +#if !defined(DGUX) && !defined(SUNOS4) && !defined(__NetBSD__) && !defined(__FreeBSD__) #define memcpy(d, s, n) bcopy(s, d, n) #define memcmp(s1, s2, n) bcmp(s2, s1, n) #endif diff --git a/sys/unix/hints/netbsd.500 b/sys/unix/hints/bsd.500 similarity index 88% rename from sys/unix/hints/netbsd.500 rename to sys/unix/hints/bsd.500 index 8a688a630..14187680a 100644 --- a/sys/unix/hints/netbsd.500 +++ b/sys/unix/hints/bsd.500 @@ -12,6 +12,10 @@ # This hints file provides the legacy configuration that NetHack has shipped # with historically - this means you will most likely need to hand edit .h # and Makefiles. +# +# note: '#-INCLUDE' is not just a comment. setup.sh inserts the contents of +# a file found in sys/unix/hints/include +#-INCLUDE whichbsd.500 PREFIX=/usr/local @@ -52,11 +56,17 @@ VARDIRPERM = 0755 .ifdef MAKEFILE_DOC MAKEDEFS = ../util/makedefs NEEDMAKEDEFS = $(MAKEDEFS) + +.if ${WHICHBSD} == "NETBSD" .if exists (/usr/pkg/bin/groff) NROFF = /usr/pkg/bin/groff .else NROFF = groff -.endif +.endif # ? Is NROFF groff or /usr/pkg/bin/groff +.else # WHICHBSD is not NETBSD +NROFF = groff +.endif # WHICHBSD + # NROFF_FLAGS comes from a hints file GUIDEBOOK = Guidebook # regular ASCII file COLCMD = col -bx diff --git a/sys/unix/hints/include/whichbsd.500 b/sys/unix/hints/include/whichbsd.500 new file mode 100644 index 000000000..c2bd28795 --- /dev/null +++ b/sys/unix/hints/include/whichbsd.500 @@ -0,0 +1,22 @@ +#================================================================= +# NetHack 5.0 include/whichbsd.500 $NHDT-Date: 1597332785 2020/08/13 15:33:05 $ $NHDT-Branch: NetHack-5.0 $ +# +# +# +.ifdef WHICHBSD +.undef WHICHBSD +.endif + +.if ${.MAKE.OS} == "FreeBSD" +WHICHBSD=FREEBSD +.elif ${.MAKE.OS} == "OpenBSD" +WHICHBSD=OPENBSD +.elif ${.MAKE.OS} == "NetBSD" +WHICHBSD=NETBSD +.else +WHICHBSD=OTHERBSD +.endif + +# End of whichbsd.500 -PRE section +#================================================================= +