]> granicus.if.org Git - nethack/commitdiff
Provide Qt 5 configuration on Linux
authorRay Chason <ray.chason@protonmail.com>
Thu, 24 May 2018 02:59:47 +0000 (22:59 -0400)
committerPasi Kallinen <paxed@alt.org>
Sun, 9 Sep 2018 15:10:20 +0000 (18:10 +0300)
* CXX specifies -std=gnu++11
* WINQT5LIB variable added
* Hints file can specify CXX and MOC

sys/unix/Makefile.src
sys/unix/hints/linux-qt4
sys/unix/hints/linux-qt5 [new file with mode: 0644]

index 98c80a2fdd3fae1fb893517ae8cf5b4d3ceb68a5..4f9fa874e664bbc6df8c00444cf026548ff8cfc3 100644 (file)
@@ -163,7 +163,8 @@ GNOMEINC=-I/usr/lib/glib/include -I/usr/lib/gnome-libs/include -I../win/gnome
 # NetHack is standard C.  If using Qt, uncomment the LINK line here to get
 # the C++ libraries linked in.
 CXXFLAGS = $(CFLAGS) -I. -I$(QTDIR)/include
-CXX=g++
+CXX ?= g++
+MOC ?= moc
 #LINK=g++
 #      For cross-compiling, eg. with gcc on Linux (see also CC further up):
 #CXX=arm-linux-g++
@@ -277,6 +278,9 @@ WINQTLIB = -L$(QTDIR)/lib -lqt
 # libraries for Qt 4
 WINQT4LIB = `pkg-config QtGui --libs`
 #
+# libraries for Qt 5 (use with WINQT4SRC and WINQT4OBJ)
+WINQT5LIB = `pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs`
+#
 # libraries for KDE (with Qt)
 WINKDELIB = -lkdecore -lkdeui -lXext
 #
@@ -566,25 +570,25 @@ qttableview.moc: ../include/qttableview.h
 
 # Qt 4 windowport meta-object-compiler output
 qt4kde0.moc : ../win/Qt4/qt4kde0.h
-       $(QTDIR)/bin/moc -o qt4kde0.moc ../win/Qt4/qt4kde0.h
+       $(QTDIR)/bin/$(MOC) -o qt4kde0.moc ../win/Qt4/qt4kde0.h
 qt4main.moc : ../win/Qt4/qt4main.h
-       $(QTDIR)/bin/moc -o qt4main.moc ../win/Qt4/qt4main.h
+       $(QTDIR)/bin/$(MOC) -o qt4main.moc ../win/Qt4/qt4main.h
 qt4map.moc : ../win/Qt4/qt4map.h
-       $(QTDIR)/bin/moc -o qt4map.moc ../win/Qt4/qt4map.h
+       $(QTDIR)/bin/$(MOC) -o qt4map.moc ../win/Qt4/qt4map.h
 qt4menu.moc : ../win/Qt4/qt4menu.h
-       $(QTDIR)/bin/moc -o qt4menu.moc ../win/Qt4/qt4menu.h
+       $(QTDIR)/bin/$(MOC) -o qt4menu.moc ../win/Qt4/qt4menu.h
 qt4msg.moc : ../win/Qt4/qt4msg.h
-       $(QTDIR)/bin/moc -o qt4msg.moc ../win/Qt4/qt4msg.h
+       $(QTDIR)/bin/$(MOC) -o qt4msg.moc ../win/Qt4/qt4msg.h
 qt4plsel.moc : ../win/Qt4/qt4plsel.h
-       $(QTDIR)/bin/moc -o qt4plsel.moc ../win/Qt4/qt4plsel.h
+       $(QTDIR)/bin/$(MOC) -o qt4plsel.moc ../win/Qt4/qt4plsel.h
 qt4set.moc : ../win/Qt4/qt4set.h
-       $(QTDIR)/bin/moc -o qt4set.moc ../win/Qt4/qt4set.h
+       $(QTDIR)/bin/$(MOC) -o qt4set.moc ../win/Qt4/qt4set.h
 qt4stat.moc : ../win/Qt4/qt4stat.h
-       $(QTDIR)/bin/moc -o qt4stat.moc ../win/Qt4/qt4stat.h
+       $(QTDIR)/bin/$(MOC) -o qt4stat.moc ../win/Qt4/qt4stat.h
 qt4xcmd.moc : ../win/Qt4/qt4xcmd.h
-       $(QTDIR)/bin/moc -o qt4xcmd.moc ../win/Qt4/qt4xcmd.h
+       $(QTDIR)/bin/$(MOC) -o qt4xcmd.moc ../win/Qt4/qt4xcmd.h
 qt4yndlg.moc : ../win/Qt4/qt4yndlg.h
-       $(QTDIR)/bin/moc -o qt4yndlg.moc ../win/Qt4/qt4yndlg.h
+       $(QTDIR)/bin/$(MOC) -o qt4yndlg.moc ../win/Qt4/qt4yndlg.h
 
 #      build monst.o and objects.o before executing '$(MAKE) makedefs'
 $(MAKEDEFS): $(FIRSTOBJ) \
index 34c8863d502b09c4448ade385cf82272ad67b7b3..ebf441682cdf2375918872e7873922399e41fc29 100644 (file)
@@ -31,11 +31,13 @@ CFLAGS+=-DQT_GRAPHICS -DDEFAULT_WINDOW_SYS=\"Qt\" -DNOTTYGRAPHICS
 CFLAGS+=`pkg-config QtGui --cflags`
 
 LINK=g++
-CXX=g++
+CXX=g++ -std=gnu++11
 
 WINSRC = $(WINQT4SRC)
 WINOBJ = $(WINQT4OBJ)
 WINLIB = $(WINQT4LIB)
+MOC = moc
+#MOC = moc-qt4
 
 VARDATND = nhtiles.bmp rip.xpm nhsplash.xpm pet_mark.xbm pilemark.xbm
 
diff --git a/sys/unix/hints/linux-qt5 b/sys/unix/hints/linux-qt5
new file mode 100644 (file)
index 0000000..8532cc2
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# NetHack 3.6  linux-qt5 $NHDT-Date: 1432512814 2015/05/25 00:13:34 $  $NHDT-Branch: master $:$NHDT-Revision: 1.12 $
+# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
+# NetHack may be freely redistributed.  See license for details.
+#
+#-PRE
+# Linux hints file
+# This hints file provides a single-user Qt5 build for Linux, specifically
+# for Fedora 26.
+
+
+#PREFIX=/usr
+PREFIX=$(wildcard ~)/nh/install
+HACKDIR=$(PREFIX)/games/lib/$(GAME)dir
+SHELLDIR = $(PREFIX)/games
+INSTDIR=$(HACKDIR)
+VARDIR = $(HACKDIR)
+
+
+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);
+
+CFLAGS=-g -O -I../include -DNOTPARMDECL
+CFLAGS+=-DHACKDIR=\"$(HACKDIR)\"
+CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\"
+CFLAGS+=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\"
+CFLAGS+=-DTIMED_DELAY
+CFLAGS+=-DDUMPLOG
+CFLAGS+=-DCONFIG_ERROR_SECURE=FALSE
+CFLAGS+=-DQT_GRAPHICS -DDEFAULT_WINDOW_SYS=\"Qt\" -DNOTTYGRAPHICS
+CFLAGS+=`pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags` -fPIC
+
+LINK=g++
+CXX=g++ -std=gnu++11
+
+WINSRC = $(WINQT4SRC)
+WINOBJ = $(WINQT4OBJ)
+WINLIB = $(WINQT5LIB)
+#MOC = moc
+MOC = moc-qt5
+
+VARDATND = nhtiles.bmp rip.xpm nhsplash.xpm pet_mark.xbm pilemark.xbm
+
+QTDIR=/usr
+
+CHOWN=true
+CHGRP=true
+VARDIRPERM = 0755
+VARFILEPERM = 0600
+GAMEPERM = 0755
+
+# note: needs libxt-dev libxaw7-dev libx11-dev bdftopcf