update some hints mechanics for 2020
Allow sharing of common code between different hints files
through use of: #-INCLUDE
new folder created: sys/unix/hints/include
new hints include files:
sys/unix/hints/include/multiw-1.2020
sys/unix/hints/include/multiw-2.2020
structure the early parts of sys/unix/hints/linux.2020 and
sys/unix/hints/macOS.2020 consistently, and utilize #-INCLUDE multiw-1.2020
and #-INCLUDE multiw-2.2020 in them. That will allow the Makefile lines
that they contain to be maintained in a single place.
This commit is contained in:
@@ -1,137 +1,51 @@
|
||||
#
|
||||
# NetHack 3.7 linux.2020 $NHDT-Date: 1597072358 2020/08/10 15:12:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.2 $
|
||||
# NetHack 3.7 linux.2020 $NHDT-Date: 1597332698 2020/08/13 15:31:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.5 $
|
||||
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
|
||||
# NetHack may be freely redistributed. See license for details.
|
||||
#
|
||||
#-PRE
|
||||
#---------------------------------------------------------------------
|
||||
# Linux hints file with support for multiple window ports (interfaces)
|
||||
# Tested on:
|
||||
# - Ubuntu focal
|
||||
#
|
||||
# This hints file supports tty, curses, x11, and Qt in the same binary,
|
||||
# but:
|
||||
# If this doesn't work for your distribution, consider making a new
|
||||
# hints file for it, rather than changing this one.
|
||||
# And let us know about it.
|
||||
#
|
||||
# - For x11 support, you'll need to obtain and install x11 development libraries.
|
||||
# For example, on Ubuntu 20.04 (as of August 2020):
|
||||
# sudo apt-get install libx11-dev
|
||||
# sudo apt-get install libmotif-dev
|
||||
# sudo apt-get install libxaw7-dev
|
||||
# sudo apt install xfonts-utils
|
||||
# (That last one is for bdftopcf and mkfontdir utils)
|
||||
#
|
||||
# - For Qt support, you'll need to obtain and install Qt.
|
||||
# For example, on Ubuntu 20.04 (as of August 2020):
|
||||
# sudo apt-get install qtbase5-dev
|
||||
# sudo apt-get install qtmultimedia5-dev
|
||||
#
|
||||
# Another odd note about Qt on Linux is that if you find you are getting
|
||||
# the following error trying to run NetHack after you build it:
|
||||
# "error while loading shared libraries: libQt5Core.so.5:
|
||||
# cannot open shared object file: No such file or directory"
|
||||
# you may have to fix that (one-time only) by the following command:
|
||||
# sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
|
||||
#
|
||||
# - For curses support, you may need to obtain and install the
|
||||
# ncurses development libraries if they aren't already installed
|
||||
# with your distribution. They seem to be there already with Ubuntu 20.04, but
|
||||
# for example, if you needed to install ncurses:
|
||||
# sudo apt-get install libncurses-dev
|
||||
#
|
||||
# - tty support shouldn't require any prerequisite additional packages.
|
||||
#
|
||||
# Assuming you have the prerequisite packages mentioned above, you can
|
||||
# specify, right on the make command line, which window ports (or interfaces)
|
||||
# to include in your build. Doing it via the make command line means that won't
|
||||
# have to edit the Makefile.
|
||||
#
|
||||
# make WANT_WIN_QT=1 WANT_WIN_X11=1 WANT_WIN_CURSES=1 WANT_WIN_TTY=1 install
|
||||
#
|
||||
# Add WANT_DEFAULT=Qt (or other interface) if you want nethack to use
|
||||
# something other than tty as the default interface.
|
||||
#
|
||||
# 1. Which windowing interface(s) should be included in this binary?
|
||||
# One or more of these can be manually uncommented and/or can be specified
|
||||
# on the 'make' command line. If none are enabled, tty will be used.
|
||||
#WANT_WIN_TTY=1
|
||||
#WANT_WIN_CURSES=1
|
||||
#WANT_WIN_X11=1
|
||||
#WANT_WIN_QT=1
|
||||
|
||||
# 1a. What is the default window system?
|
||||
# Exactly one of these can be manually uncommented and/or can be specified
|
||||
# on the 'make' command line. If none is enabled, the first among
|
||||
# WANT_WIN_{tty,curses,X11,Qt} that is enabled will become default.
|
||||
#WANT_DEFAULT=tty
|
||||
#WANT_DEFAULT=curses
|
||||
#WANT_DEFAULT=Qt
|
||||
#WANT_DEFAULT=X11
|
||||
#-PRE
|
||||
# linux.2020 hints file provides a single-user build for Linux (such
|
||||
# as Ubuntu focal).
|
||||
|
||||
#-INCLUDE multiw-1.2020
|
||||
|
||||
# 4. If you set WANT_WIN_QT, you need to
|
||||
# A) set QTDIR either here or in the environment to point to the Qt5
|
||||
# Library installation root.
|
||||
# B) set XPMLIB to point to the Xpm library
|
||||
ifndef WANT_WIN_QT
|
||||
ifdef WANT_WIN_ALL
|
||||
WANT_WIN_QT=1
|
||||
endif
|
||||
endif
|
||||
ifdef WANT_WIN_QT
|
||||
QTDIR=/usr
|
||||
endif # WANT_WIN_QT
|
||||
endif # WANT_WIN_QT
|
||||
ifndef LIBXPM
|
||||
LIBXPM= -L/opt/X11/lib -lXpm
|
||||
endif
|
||||
|
||||
# 2. Not customizable in this linux.2020 hints file, which provides
|
||||
# a single-user build for Linux (such as Ubuntu focal).
|
||||
#5. Other
|
||||
GAMEUID = $(USER)
|
||||
GAMEGRP = games
|
||||
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
# You shouldn't need to change anything below here (in the hints file; if
|
||||
# you're reading this in Makefile augmented by hints, that may not be true).
|
||||
#
|
||||
|
||||
# Make sure that at least one interface is enabled.
|
||||
ifndef WANT_WIN_TTY
|
||||
ifndef WANT_WIN_CURSES
|
||||
ifndef WANT_WIN_X11
|
||||
ifndef WANT_WIN_QT
|
||||
WANT_WIN_TTY=1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Make sure that a default interface is specified; this doesn't guarantee
|
||||
# sanity for something like 'make WANT_WIN_CURSES=1 WANT_DEFAULT=X11' but
|
||||
# 'makedefs -v' would notice, complain, and quit causing 'make' to quit.
|
||||
ifndef WANT_DEFAULT
|
||||
# pick the first one enabled among { tty, curses, X11, Qt }
|
||||
ifdef WANT_WIN_TTY
|
||||
WANT_DEFAULT=tty
|
||||
else
|
||||
ifdef WANT_WIN_CURSES
|
||||
WANT_DEFAULT=curses
|
||||
else
|
||||
ifdef WANT_WIN_X11
|
||||
WANT_DEFAULT=X11
|
||||
else
|
||||
ifdef WANT_WIN_QT
|
||||
WANT_DEFAULT=Qt
|
||||
else
|
||||
# ? shouldn't be able to get here...
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# compiler detection
|
||||
CCISCLANG := $(shell echo `$(CC) --version` | grep clang)
|
||||
ifeq "$(CCISCLANG)" ""
|
||||
CXX=g++ -std=gnu++11
|
||||
else
|
||||
CXX=clang++ -std=gnu++11
|
||||
endif
|
||||
|
||||
ifdef WANT_WIN_QT
|
||||
# Qt5 requires C++11
|
||||
LINK = $(CXX)
|
||||
#MOC = moc
|
||||
else
|
||||
LINK = $(CC)
|
||||
endif
|
||||
#-INCLUDE multiw-2.2020
|
||||
|
||||
# XXX -g vs -O should go here, -I../include goes in the makefile
|
||||
CFLAGS=-g -O -I../include -DNOTPARMDECL
|
||||
ifeq "$(CCISCLANG)" ""
|
||||
# get the version of gcc
|
||||
@@ -140,13 +54,26 @@ ifeq "$(GCCGTEQ9)" "1"
|
||||
CFLAGS+=-Wno-format-overflow
|
||||
endif #gcc version greater than or equal to 9
|
||||
endif #not clang
|
||||
# As of LLVM build 2336.1.00, this gives dozens of spurious messages, so
|
||||
# leave it out by default.
|
||||
#CFLAGS+=-Wunreachable-code
|
||||
#CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit \
|
||||
# -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings
|
||||
#CFLAGS+=-DGCC_WARN
|
||||
|
||||
# NetHack sources control
|
||||
CFLAGS+=-DDLB
|
||||
CFLAGS+=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\"
|
||||
CFLAGS+=-DHACKDIR=\"$(HACKDIR)\"
|
||||
CFLAGS+=-DDEFAULT_WINDOW_SYS=\"$(WANT_DEFAULT)\"
|
||||
CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
|
||||
CFLAGS+=-DTIMED_DELAY
|
||||
CFLAGS+=-DHACKDIR=\"$(HACKDIR)\"
|
||||
CFLAGS+=-DDUMPLOG
|
||||
CFLAGS+=-DCONFIG_ERROR_SECURE=FALSE
|
||||
#CFLAGS+=-DGREPPATH=\"/usr/bin/grep\"
|
||||
CFLAGS+=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\"
|
||||
# older binaries use NOCLIPPING, but that disables SIGWINCH
|
||||
#CFLAGS+=-DNOCLIPPING
|
||||
#CFLAGS+=-DNOMAIL
|
||||
#CFLAGS+=-DEXTRA_SANITY_CHECKS
|
||||
#CFLAGS+=-DEDIT_GETLIN
|
||||
#CFLAGS+=-DSCORE_ON_BOTL
|
||||
@@ -154,25 +81,22 @@ CFLAGS+=-DCONFIG_ERROR_SECURE=FALSE
|
||||
#CFLAGS+=-DTTY_TILES_ESCCODES
|
||||
#CFLAGS+=-DTTY_SOUND_ESCCODES
|
||||
|
||||
WINSRC =
|
||||
WINOBJ0 =
|
||||
WINLIB =
|
||||
CFLAGS+= $(WINCFLAGS) #from multiwin.2020
|
||||
|
||||
VARDATND =
|
||||
VARDATND0 =
|
||||
CURSESLIB =
|
||||
|
||||
#ifdef WANT_WIN_CHAIN
|
||||
#HINTSRC=$(CHAINSRC)
|
||||
#HINTOBJ=$(CHAINOBJ)
|
||||
#endif # WANT_WIN_CHAIN
|
||||
|
||||
ifdef WANT_WIN_TTY
|
||||
WINSRC += $(WINTTYSRC)
|
||||
WINOBJ0 += $(WINTTYOBJ)
|
||||
CURSESLIB = -lncurses -ltinfo
|
||||
else # !WANT_WIN_TTY
|
||||
CFLAGS += -DNOTTYGRAPHICS
|
||||
endif # !WANT_WIN_TTY
|
||||
endif
|
||||
|
||||
ifdef WANT_WIN_CURSES
|
||||
CFLAGS += -DCURSES_GRAPHICS
|
||||
WINSRC += $(WINCURSESSRC)
|
||||
WINOBJ0 += $(WINCURSESOBJ)
|
||||
CURSESLIB = -lncurses -ltinfo
|
||||
endif
|
||||
|
||||
@@ -181,7 +105,6 @@ WINLIB += $(CURSESLIB)
|
||||
endif
|
||||
|
||||
ifdef WANT_WIN_X11
|
||||
CFLAGS += -DX11_GRAPHICS
|
||||
USE_XPM=1
|
||||
WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11
|
||||
VARDATND0 += x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
|
||||
@@ -196,32 +119,27 @@ CFLAGS += -DUSE_XPM
|
||||
WINX11LIB += -lXpm
|
||||
VARDATND0 += rip.xpm
|
||||
endif
|
||||
WINSRC += $(WINX11SRC)
|
||||
WINOBJ0 += $(WINX11OBJ)
|
||||
WINLIB += $(WINX11LIB)
|
||||
LFLAGS=-L/opt/X11/lib
|
||||
endif # WANT_WIN_X11
|
||||
|
||||
ifdef WANT_WIN_QT
|
||||
CFLAGS += -DQT_GRAPHICS
|
||||
# Qt5 requires C++11
|
||||
LINK = $(CXX)
|
||||
QTCXXFLAGS += -Wno-deprecated-declarations
|
||||
QTCXXFLAGS += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags)
|
||||
QTCXXFLAGS += -fPIC
|
||||
WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs)
|
||||
WINSRC += $(WINQTSRC)
|
||||
WINOBJ0 += $(WINQTOBJ)
|
||||
VARDATND0 += nhtiles.bmp rip.xpm nhsplash.xpm pet_mark.xbm pilemark.xbm
|
||||
# XXX if /Developer/qt exists and QTDIR not set, use that
|
||||
ifndef QTDIR
|
||||
$(error QTDIR not defined in the environment or Makefile)
|
||||
endif # QTDIR
|
||||
# XXX make sure QTDIR points to something reasonable
|
||||
POSTINSTALL+= cp -n sys/unix/sysconf $(INSTDIR)/sysconf; \
|
||||
$(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; \
|
||||
$(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; \
|
||||
chmod $(VARFILEPERM) $(INSTDIR)/sysconf;
|
||||
POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; \
|
||||
( cd $(INSTDIR); mkfontdir -x .lev );
|
||||
else
|
||||
LINK = $(CC)
|
||||
endif # !WANT_WIN_QT
|
||||
|
||||
# prevent duplicate tile.o in WINOBJ
|
||||
@@ -240,11 +158,14 @@ POSTINSTALL+= cp -n sys/unix/sysconf $(INSTDIR)/sysconf; \
|
||||
$(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; \
|
||||
$(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; \
|
||||
chmod $(VARFILEPERM) $(INSTDIR)/sysconf;
|
||||
|
||||
ifneq "$(CCISCLANG)" ""
|
||||
# gdb may not be installed if clang is chosen compiler so the game
|
||||
# won't start in that case due to a sysconf error. Comment out
|
||||
# relevant lines in sysconf.
|
||||
POSTINSTALL+= sed -i -e 's;^GDBPATH=/usr/bin/gdb;\#GDBPATH=/usr/bin/gdb;' \
|
||||
-e 's;PANICTRACE_GDB=1;PANICTRACE_GDB=0;' $(INSTDIR)/sysconf;
|
||||
endif
|
||||
|
||||
# when building liblua.a, avoid warning that use of tmpnam() should be
|
||||
# replaced by mkstemp(); the lua code doesn't use nethack's config.h so
|
||||
@@ -257,6 +178,7 @@ LFLAGS=-rdynamic
|
||||
# if TTY_TILES_ESCCODES
|
||||
#WINSRC += tile.c
|
||||
#WINOBJ += tile.o
|
||||
# endif
|
||||
|
||||
CHOWN=true
|
||||
CHGRP=true
|
||||
|
||||
Reference in New Issue
Block a user