rework Windows build instructions
This commit is contained in:
@@ -1,218 +1,42 @@
|
||||
Copyright (c) NetHack Development Team 1990-2024
|
||||
NetHack may be freely redistributed. See license for details.
|
||||
==============================================================
|
||||
Instructions for compiling and installing
|
||||
NetHack 3.7 on a Windows system
|
||||
(Windows 8.x/10/11 or later only)
|
||||
==============================================================
|
||||
Last revision: $NHDT-Date: 1594155895 2020/07/07 21:04:55 $
|
||||
Copyright (c) NetHack Development Team 1990-2024
|
||||
NetHack may be freely redistributed. See license for details.
|
||||
==============================================================
|
||||
Instructions for compiling NetHack 3.7 on a Windows system
|
||||
(Windows 8.x/10/11 or later only)
|
||||
==============================================================
|
||||
Last revision: $NHDT-Date: 1594155895 2020/07/07 21:04:55 $
|
||||
|
||||
Credit for the porting of NetHack to the Win32 Console Subsystem goes to
|
||||
the NT Porting Team started by Michael Allison.
|
||||
See file dat\History for credits and history of NetHack for Windows.
|
||||
|
||||
Credit for the Win32 Graphical version of NetHack (aka "NetHack for
|
||||
Windows" or NetHackW) goes to Alex Kompel who initially developed and
|
||||
contributed the port.
|
||||
/-----------------------------------------------------------------------\
|
||||
| Download a prebuilt package of NetHack for Windows from NetHack.org |
|
||||
\----------------------------------------------------------- -----------/
|
||||
|
||||
Alex Kompel, Dion Nicolaas, Yitzhak Sapir, Derek S. Ray, Michael Allison,
|
||||
Pasi Kallinen, Bart House, and Janet Walz contributed to the maintenance
|
||||
of the tty and graphical windows versions of NetHack 3.7.0.
|
||||
|
||||
The build Makefiles and procedures produce two executables:
|
||||
a. A TTY and curses version of NetHack in nethack.exe
|
||||
b. A Windows and curses graphical version in nethackw.exe.
|
||||
|
||||
You can use one of the following build environments:
|
||||
o A copy of Microsoft Visual Studio 2017 Community Edition or
|
||||
a copy of Microsoft Visual Studio 2019 Community Edition or
|
||||
a copy of Microsoft Visual Studio 2022 Community Edition
|
||||
|
||||
OR
|
||||
|
||||
o An up-to-date copy of MinGW-w64. MinGW-w64 is a collection of
|
||||
GNU C Compiler (GCC) executables, headers, files and import
|
||||
libraries. The official site for MinGW-w64 is
|
||||
https://www.mingw-w64.org/
|
||||
There are a few packaged distributions of MinGW-w64. We've tried
|
||||
out these ones, but there are likely others that will work:
|
||||
|
||||
MSYS2
|
||||
- https://www.msys2.org/
|
||||
- Download the installer, and start the appropriate bash shell.
|
||||
|
||||
MinGW-w64 - winlibs standalone build
|
||||
- https://github.com/brechtsanders/winlibs_mingw
|
||||
- Download one of the releases from
|
||||
https://github.com/brechtsanders/winlibs_mingw/releases
|
||||
and extract the contents into a folder (ideally in a folder
|
||||
without spaces in the path), and add the location of the
|
||||
subfolder containing gcc.exe to your PATH.
|
||||
|
||||
/---------------------------------------------\
|
||||
| Directories for a Windows NetHack build |
|
||||
\---------------------------------------------/
|
||||
|
||||
|
||||
(NetHack-top)
|
||||
|
|
||||
+-----+-----+------+-----+---+---------------+-----------+-----~-----+
|
||||
| | | | | | | | |
|
||||
util dat doc include lib src sys win submodules
|
||||
| | | |
|
||||
+----------+ +------+ +----+ +----+
|
||||
| | | | | | | |
|
||||
| | | | | | | |
|
||||
lua-5.4.6 pdcursesmod share windows tty win32 lua pdcurses
|
||||
|
|
||||
vs
|
||||
|
|
||||
+----------+-------+--------+--------+-----------+-------+-----+------+
|
||||
| | | | | | | | |
|
||||
makedefs NetHack NetHackW PDCurses PDCursesGui tile2bmp tilemap tiles uudecode
|
||||
FIXME:
|
||||
|
||||
|
||||
/-----------------------------------------------------------------------\
|
||||
| Required components that are not bundled in the NetHack repository |
|
||||
\-----------------------------------------------------------------------/
|
||||
| Build and package NetHack for Windows yourself |
|
||||
\----------------------------------------------------------- -----------/
|
||||
|
||||
NetHack 3.7 for Windows requires at least one mandatory 3rd party source that
|
||||
is not directly distributed within the NetHack repository, and an additional
|
||||
optional 3rd party source if you want to build curses interface support into
|
||||
your binaries.
|
||||
We provide documentation for the follow three different approaches
|
||||
and tool suites that may be used to compile and package
|
||||
NetHack for Windows:
|
||||
|
||||
The mandatory 3rd party source that is needed for NetHack 3.7 is Lua.
|
||||
1. With the Visusal Studio Integrated Development Environment (IDE).
|
||||
The steps are documented in sys/windows/build-vs.txt.
|
||||
|
||||
The optional 3rd party source that can be used is pdcursesmod, which is
|
||||
needed if you are building in support for the curses interface.
|
||||
2. At the Windows command line, using Visual Studio's nmake.exe.
|
||||
The steps are documented in sys/windows/build-nmake.txt.
|
||||
|
||||
The Makefiles distributed for building under Windows have features to
|
||||
make obtaining the 3rd party sources easier, but you can obtain them
|
||||
manually if you wish. See "Manually obtaining mandatory and optional
|
||||
3rd party sources" later in this document if you wish to obtain them
|
||||
yourself, without relying on features of the distributed Makefiles.
|
||||
3. At the bash shell using MSYS2.
|
||||
The steps are documented in sys/windows/build-msys2.txt.
|
||||
|
||||
/-----------------------------------------------------------\
|
||||
| Building And Running Using Visual Studio 2017, 2019, 2022 |
|
||||
\-----------------------------------------------------------/
|
||||
/--------------------------------------------------------------\
|
||||
| If you experience a problem |
|
||||
\--------------------------------------------------------------/
|
||||
|
||||
If you are NOT using the Visual Studio IDE, or you prefer to build
|
||||
using a Make utility and a Makefile proceed to "Building Using Make".
|
||||
|
||||
When using either Visual Studio 2017, 2019, or 2022, you simply need to
|
||||
load the solution file within the IDE, build the solution and run the version
|
||||
of NetHack you wish to run.
|
||||
|
||||
The Visual Studio NetHack solution file can be found here:
|
||||
sys\windows\vs\NetHack.sln
|
||||
|
||||
The steps are:
|
||||
1. Launch the IDE.
|
||||
2. Open the appropriate solution file in sys\windows\vs\NetHack.sln.
|
||||
3. Select the build configuration you wish to use (Release, Debug, etc.).
|
||||
4. From the build menu, select build solution.
|
||||
5. Type F5 to start debugging.
|
||||
|
||||
|
||||
/-------------------------------------------\
|
||||
| Building From the Command Line Using Make |
|
||||
\-------------------------------------------/
|
||||
|
||||
Two different versions of NetHack will be built for Windows from the
|
||||
command line using the Makefile approach:
|
||||
A tty port utilizing the Win32 Console I/O subsystem Console,
|
||||
and a curses interface in an executabled called NetHack.exe.
|
||||
NetHack
|
||||
A Win32 native port built on the Windows API Graphical NetHack,
|
||||
and graphical curses in an executable called NetHackW.exe.
|
||||
|
||||
The Makefile configurations will build both; NetHack.exe and NetHackW.exe
|
||||
and will be able to use the same datafiles, save files and bones files.
|
||||
|
||||
Since the last official release of NetHack, compilers and computer
|
||||
architectures have evolved and you can now choose whether to build
|
||||
a 32-bit x86 version, or a 64-bit x64 version. The default Makefile
|
||||
is set up for a 32-bit x86 version, but that's only because it will
|
||||
run on the most number of existing Windows environments. Change it if you
|
||||
want. Be aware that NetHack's save files and bones files in the 3.7.0
|
||||
release have not yet evolved enough to allow them to interchange between
|
||||
the 32-bit version and the 64-bit version (or between different platforms).
|
||||
That may change in future.
|
||||
|
||||
I. Dispelling the Myths:
|
||||
|
||||
Compiling NetHack for Windows is not as easy as it sounds, nor as hard
|
||||
as it looks, however it will behoove you to read this entire section
|
||||
through before beginning the task.
|
||||
|
||||
We have provided a Makefile for each of the following compilers:
|
||||
|
||||
o Microsoft Visual Studio 2017 or 2019 or 2022 C++ Compiler
|
||||
The Community Editions are fine and available at no cost,
|
||||
although registration with the vendor is required.
|
||||
sys/windows/Makefile.nmake is provided for use with
|
||||
Microsoft's nmake.
|
||||
|
||||
o MinGW-w64 gcc compiler environment and GNU make.
|
||||
sys/windows/Makefile.mingw and sys/windows/Makefile.mingw.depend
|
||||
are provided for use with GNU make provided with mingw-w64.
|
||||
|
||||
II. To compile your copy of NetHack on a Windows machine:
|
||||
|
||||
Setting Up
|
||||
|
||||
1. It almost goes without saying that you should make sure that your
|
||||
tools are set up and running correctly. That includes ensuring that
|
||||
all the necessary environment variables for the compiler environment
|
||||
are set correctly and that they will be found when searching your PATH.
|
||||
|
||||
Change your current directory to the src subfolder of the nethack
|
||||
source tree, if you are at the top of the NetHack source tree.
|
||||
cd src
|
||||
|
||||
2. Change your current directory to the sys\windows subfolder of the nethack
|
||||
source tree and execute nhsetup.bat, to place copies of the Makefiles in
|
||||
the src subfolder.
|
||||
|
||||
From the command prompt:
|
||||
cd sys\windows
|
||||
.\nhsetup.bat
|
||||
|
||||
3. Change your current directory to the src subfolder of the nethack
|
||||
source tree. This assumes you are still in the sys\windows folder
|
||||
from step #2:
|
||||
cd ..\..\src
|
||||
|
||||
4. Edit your Makefile if you wish, but it is not required unless
|
||||
you are altering the build options.
|
||||
|
||||
Compiling
|
||||
|
||||
5. Now that everything is set up...
|
||||
|
||||
Change your current directory to the NetHack src directory.
|
||||
|
||||
For the Visual Studio compiler, issue these commands:
|
||||
nmake install
|
||||
|
||||
For mingw GCC:
|
||||
Issue these commands:
|
||||
make -f Makefile.mingw32 clean
|
||||
make -f Makefile.mingw32 depend
|
||||
make -f Makefile.mingw32
|
||||
|
||||
(some older versions of mingw may require mingw32-make in
|
||||
place of plain make in the commands above)
|
||||
|
||||
If you get any errors along the way then something has not been set
|
||||
up correctly or perhaps you mistyped the commands shown above.
|
||||
|
||||
The time it takes to compile depends on your particular machine of course.
|
||||
On a slower machine, you might take the opportunity to grab a beverage.
|
||||
|
||||
If all goes well, you will get NetHack executables with all of the
|
||||
required support files in the binary subfolder of the NetHack tree.
|
||||
NetHack.exe is the tty plus curses version. NetHackW.exe is the windows
|
||||
graphical plus graphical curses version.
|
||||
Executing NetHack on your machine
|
||||
|
||||
Your personal config file will be created from a template file the
|
||||
first time you fire up NetHack. If you want to edit it you can use
|
||||
@@ -225,74 +49,8 @@ Compiling
|
||||
|
||||
Play NetHack.
|
||||
|
||||
Notes:
|
||||
|
||||
1. To rebuild NetHack after changing something, change your current directory
|
||||
to src and issue the appropriate command for your compiler:
|
||||
|
||||
For Microsoft compiler:
|
||||
nmake
|
||||
|
||||
For GCC:
|
||||
make -f Makefile.mingw32
|
||||
|
||||
(some older versions of mingw may require mingw32-make in
|
||||
place of plain make in the command above)
|
||||
|
||||
2. Depending on the build and compiler and tools used above, the
|
||||
executable produced by the TTY build is either:
|
||||
- a 32-bit (x86) .exe file,
|
||||
which should run on any recent Win32 environment.
|
||||
or
|
||||
- a 64-bit (x64) .exe file,
|
||||
which should run on any 64-bit Windows O/S.
|
||||
|
||||
**Note**: saved games and bones files are NOT compatible between the
|
||||
32-bit and the 64-bit versions at this time.
|
||||
|
||||
|
||||
/--------------------------------------------------------------\
|
||||
| Manually obtaining mandatory and optional 3rd party sources. |
|
||||
\--------------------------------------------------------------/
|
||||
|
||||
|
||||
Via git (recommended)
|
||||
|
||||
If you obtained your NetHack sources by cloning from a git repository such
|
||||
as https://github.com/NetHack/NetHack and you have git installed and
|
||||
available and you are online, you simply need to execute the following
|
||||
command from the top level NetHack folder to populate source code into the
|
||||
submodules/lua and submodules/pdcursesmod folders:
|
||||
|
||||
git submodule init
|
||||
git submodule update
|
||||
|
||||
|
||||
Via zip download
|
||||
|
||||
If you obtained your NetHack sources from a zip file or git is not available
|
||||
to you, you'll have to obtain Lua and pdcurses from their respective
|
||||
locations (at the time of this writing).
|
||||
Windows 10 or newer is assumed below, because wget and tar were included with
|
||||
Windows in that version and beyond.
|
||||
|
||||
o obtain Lua
|
||||
cd lib
|
||||
wget http://www.lua.org/ftp/lua-5.4.6.tar.gz
|
||||
tar -xvf lua-5.4.6.tar.gz
|
||||
cd ..
|
||||
|
||||
o obtain pdcursesmod
|
||||
cd lib
|
||||
wget --no-check-certificate ^
|
||||
https://github.com/Bill-Gray/PDCursesMod/archive/refs/tags/v4.4.0.tar.gz ^
|
||||
--output-document=pdcursesmod.tar.gz
|
||||
tar -xvf pdcursesmod.tar.gz
|
||||
ren PDCursesMod-4.4.0 pdcursesmod
|
||||
cd ..
|
||||
|
||||
/--------------------------------------------------------------\
|
||||
| If you experience a problem |
|
||||
| If you experience a problem |
|
||||
\--------------------------------------------------------------/
|
||||
|
||||
If you discover a bug and wish to report it, or if you have comments
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
# The default make target (so just typing 'mingw32-make').
|
||||
#
|
||||
|
||||
default: install
|
||||
default: package
|
||||
|
||||
#---------------------------------------------------------------
|
||||
# Where do you want the game to be built (which folder)?
|
||||
@@ -263,6 +263,8 @@ WCURSES =../win/curses
|
||||
WSHR =../win/share
|
||||
QT =../win/Qt
|
||||
SNDWAVDIR = ../sound/wav
|
||||
BinDir = ../binary
|
||||
PkgDir = ../package
|
||||
|
||||
#
|
||||
# Object directory.
|
||||
@@ -1129,6 +1131,29 @@ $(GAMEDIR)/NetHack.exe: $(NHOBJS) $(NHRES) $(DATE_O) $(LUALIB) $(PDCLIB) $(HLHAC
|
||||
$(ONH)/%.o: $(SRC)/%.c $(NHLUAH) | $(ONH)
|
||||
$(cc) $(CFLAGSNH) $< -o$@
|
||||
|
||||
#==========================================
|
||||
# package
|
||||
#==========================================
|
||||
TARGET_CPU = x64
|
||||
NHV=370
|
||||
PKGFILES = .nethackrc.template Guidebook.txt license NetHack.exe NetHack.txt \
|
||||
NetHackW.exe opthelp nhdat370 record symbols sysconf.template
|
||||
FILESTOZIP = $(addprefix $(GAMEDIR)/, $(PKGFILES))
|
||||
MAINZIP = $(PkgDir)/nethack-$(NHV)-win-$(TARGET_CPU)-msys2.zip
|
||||
|
||||
package: binary $(FILESTOZIP) $(MAINZIP)
|
||||
@echo NetHack Windows package created: $(MAINZIP)
|
||||
|
||||
$(MAINZIP): $(FILESTOZIP) | $(PkgDir)
|
||||
/c/Windows/System32/tar -a -cf $(MAINZIP) -C $(GAMEDIR) $(PKGFILES)
|
||||
@echo NetHack Windows package created: $(MAINZIP)
|
||||
|
||||
$(PkgDir):
|
||||
@mkdir -p $@
|
||||
|
||||
CLEAN_DIR += $(PkgDir)
|
||||
CLEAN_FILE += $(MAINZIP)
|
||||
|
||||
# In NetHack 3.7, date.c must be recompiled after any other file is compiled,
|
||||
# otherwise the game internal build timestamp (and potentially git hash)
|
||||
# will not be accurate.
|
||||
@@ -1187,7 +1212,7 @@ CLEAN_FILE += $(NHTARGET) $(NHOBJS) $(NHRES)
|
||||
#=============== TARGETS ==================
|
||||
#==========================================
|
||||
|
||||
.PHONY: all clean default install lua makedefs recover $(PDCURSES) $(PDCURSES)w \
|
||||
.PHONY: all clean default binary lua makedefs recover $(PDCURSES) $(PDCURSES)w \
|
||||
tile2bmp tilemap uudecode dlb nethackw nethack tileutil \
|
||||
fetchlua fetchpdcurses
|
||||
|
||||
@@ -1195,30 +1220,30 @@ CLEAN_FILE += $(NHTARGET) $(NHOBJS) $(NHRES)
|
||||
# Everything
|
||||
#
|
||||
|
||||
all: install
|
||||
all: package
|
||||
|
||||
TO_INSTALL = $(GAMEDIR)/NetHack.exe $(RTARGETS) $(GAMEDIRDLLS) \
|
||||
TO_BINARY = $(GAMEDIR)/NetHack.exe $(RTARGETS) $(GAMEDIRDLLS) \
|
||||
$(addprefix $(GAMEDIR)/, \
|
||||
$(addsuffix .template, sysconf .nethackrc symbols) \
|
||||
Guidebook.txt NetHack.txt license opthelp record)
|
||||
|
||||
ifeq "$(HAVE_SOUNDLIB)" "Y"
|
||||
TO_INSTALL += $(addprefix $(GAMEDIR)/, $(addsuffix .wav, $(WAVLIST)))
|
||||
TO_BINARY += $(addprefix $(GAMEDIR)/, $(addsuffix .wav, $(WAVLIST)))
|
||||
endif
|
||||
|
||||
ifeq "$(USE_LUADLL)" "Y"
|
||||
TO_INSTALL += $(LUADLL)
|
||||
TO_BINARY += $(LUADLL)
|
||||
endif
|
||||
|
||||
ifneq "$(SKIP_NETHACKW)" "Y"
|
||||
TO_INSTALL += $(GAMEDIR)/NetHackW.exe
|
||||
TO_BINARY += $(GAMEDIR)/NetHackW.exe
|
||||
endif
|
||||
|
||||
ifeq "$(USE_DLB)" "Y"
|
||||
TO_INSTALL += $(DLB)
|
||||
TO_BINARY += $(DLB)
|
||||
endif
|
||||
|
||||
install: fetchlua fetchpdcurses $(TO_INSTALL)
|
||||
binary: fetchlua fetchpdcurses $(TO_BINARY)
|
||||
ifdef CI_COMPILER
|
||||
ls -l $(SRC)
|
||||
ls -l $(DAT)
|
||||
@@ -1255,7 +1280,7 @@ $(GAMEDIR)/%: $(MSWSYS)/%
|
||||
$(GAMEDIR)/%: $(SNDWAVDIR)/%
|
||||
cp $< $@
|
||||
|
||||
CLEAN_FILE += $(TO_INSTALL)
|
||||
CLEAN_FILE += $(TO_BINARY)
|
||||
|
||||
clean:
|
||||
@-rm -f $(CLEAN_FILE)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
# The default make target (so just typing 'nmake' is useful).
|
||||
#
|
||||
|
||||
default : install
|
||||
default : package
|
||||
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
@@ -96,7 +96,7 @@ GIT_AVAILABLE = N
|
||||
# You can override INTERNET_AVAILABLE and GIT_AVAILABLE on the nmake command
|
||||
# line by adding GIT=1
|
||||
# for example:
|
||||
# nmake GIT=1 install
|
||||
# nmake GIT=1 package
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
# This Makefile will attempt to auto-detect your selected target architecture
|
||||
@@ -171,6 +171,8 @@ X11 = ..\win\X11 # X11 support files
|
||||
LIBDIR = ..\lib # libraries and external bits
|
||||
SUBM = ..\submodules # NetHack git submodules
|
||||
SndWavDir = ..\sound\wav # sound files that get integrated
|
||||
BinDir = ..\binary
|
||||
PkgDir = ..\package
|
||||
|
||||
#==============================================================================
|
||||
# Sanity checks for prerequisite Lua and pdcursesmod
|
||||
@@ -1370,18 +1372,7 @@ DLB =
|
||||
# Everything
|
||||
#
|
||||
|
||||
all : install
|
||||
|
||||
install: envchk.tag libdir.tag ottydir$(TARGET_CPU).tag \
|
||||
outldir$(TARGET_CPU).tag oguidir$(TARGET_CPU).tag \
|
||||
oluadir$(TARGET_CPU).tag opdcdir$(TARGET_CPU).tag \
|
||||
opdccdir$(TARGET_CPU).tag opdcgdir$(TARGET_CPU).tag \
|
||||
$(LUASRC)\lua.h $(PDCDEP) \
|
||||
$(INCL)\nhlua.h $(OUTL)utility.tag \
|
||||
$(DAT)\data $(DAT)\rumors $(DAT)\oracles $(DAT)\engrave \
|
||||
$(DAT)\epitaph $(DAT)\bogusmon $(GAMEDIR)\NetHack.exe \
|
||||
$(GAMEDIR)\NetHackW.exe $(GAMEDIRDLLS) install.tag
|
||||
@echo Done.
|
||||
all : package
|
||||
|
||||
!IF "$(INTERNET_AVAILABLE)" == "Y"
|
||||
!IF "$(GIT_AVAILABLE)" == "Y"
|
||||
@@ -1480,7 +1471,7 @@ $(GAMEDIR)\NetHack.exe : gamedir.tag $(OTTY)consoletty.o \
|
||||
$(OTTY)date.o
|
||||
$(OTTY)console.res
|
||||
<< keep
|
||||
@if exist install.tag del install.tag
|
||||
@if exist binary.tag del binary.tag
|
||||
|
||||
#---------
|
||||
# NetHackW
|
||||
@@ -1510,7 +1501,7 @@ $(GAMEDIR)\NetHackW.exe : gamedir.tag $(OGUI)tile.o \
|
||||
# install
|
||||
#--------
|
||||
#
|
||||
install.tag: $(DAT)\data $(DAT)\rumors $(DAT)\oracles $(DLB) \
|
||||
binary.tag: $(DAT)\data $(DAT)\rumors $(DAT)\oracles $(DLB) \
|
||||
$(HACKCSRC) $(SOUNDSRCS)
|
||||
! IF ("$(USE_DLB)"=="Y")
|
||||
copy nhdat$(NHV) $(GAMEDIR)
|
||||
@@ -1549,7 +1540,7 @@ install.tag: $(DAT)\data $(DAT)\rumors $(DAT)\oracles $(DLB) \
|
||||
@if exist $(GAMEDIR)\NetHackW.PDB echo NOTE: You may want to remove $(GAMEDIR:\=/)/NetHackW.PDB to conserve space
|
||||
-if exist $(MSWSYS)\.nethackrc.template copy $(MSWSYS)\.nethackrc.template $(GAMEDIR)
|
||||
-if not exist $(GAMEDIR)\record. goto>$(GAMEDIR)\record.
|
||||
echo install done > $@
|
||||
echo binary built > $@
|
||||
|
||||
# copy $(MSWSYS)\windsyshlp $(GAMEDIR)
|
||||
|
||||
@@ -1766,6 +1757,11 @@ libdir.tag:
|
||||
@if not exist $(LIBDIR)\*.* mkdir $(LIBDIR)
|
||||
@echo directory created >$@
|
||||
|
||||
pkgdir.tag:
|
||||
if NOT exist $(PkgDir)\*.* echo creating directory $(PkgDir:\=/)
|
||||
if NOT exist $(PkgDir)\*.* mkdir $(PkgDir)
|
||||
@echo directory created >$@
|
||||
|
||||
#==========================================
|
||||
# Notify of any CL environment variables
|
||||
# in effect since they change the compiler
|
||||
@@ -2298,6 +2294,41 @@ $(SndWavDir)\sound_Wooden_Harp_G.wav: $(SndWavDir)\sound_Wooden_Harp_G.uu $(U)uu
|
||||
$(SndWavDir)\sa2_xpleveldown.wav: $(SndWavDir)\sa2_xpleveldown.uu $(U)uudecode.exe
|
||||
$(SndWavDir)\sa2_xplevelup.wav: $(SndWavDir)\sa2_xplevelup.uu $(U)uudecode.exe
|
||||
|
||||
#===============================================================================
|
||||
# packaging
|
||||
#===============================================================================
|
||||
|
||||
PKGFILES = .nethackrc.template Guidebook.txt license NetHack.exe NetHack.txt \
|
||||
NetHackW.exe opthelp nhdat370 record symbols sysconf.template
|
||||
FILESTOZIP = $(BinDir)\.nethackrc.template $(BinDir)\Guidebook.txt $(BinDir)\license \
|
||||
$(BinDir)\NetHack.exe $(BinDir)\NetHack.txt $(BinDir)\NetHackW.exe \
|
||||
$(BinDir)\opthelp $(BinDir)\nhdat370 $(BinDir)\record \
|
||||
$(BinDir)\symbols $(BinDir)\sysconf.template
|
||||
DBGSYMS = NetHack.PDB NetHackW.PDB
|
||||
PDBTOZIP = $(BinDir)\NetHack.PDB $(BinDir)\NetHackW.PDB
|
||||
MAINZIP = $(PkgDir)\nethack-$(NHV)-win-$(TARGET_CPU).zip
|
||||
DBGSYMZIP = $(PkgDir)\nethack-$(NHV)-win-$(TARGET_CPU)-debugsymbols.zip
|
||||
|
||||
package: binary $(FILESTOZIP) $(MAINZIP) $(DBGSYMZIP)
|
||||
@echo NetHack Windows package created: $(MAINZIP)
|
||||
|
||||
$(MAINZIP): $(FILESTOZIP)
|
||||
if not exist $(PkgDir)\*.* mkdir $(PkgDir)
|
||||
tar -a -cf $(MAINZIP) -C $(BinDir) $(PKGFILES)
|
||||
$(DBGSYMZIP): $(PDBTOZIP)
|
||||
tar -a -cf $(DBGSYMZIP) -C $(BinDir) $(DBGSYMS)
|
||||
|
||||
binary: envchk.tag libdir.tag ottydir$(TARGET_CPU).tag \
|
||||
outldir$(TARGET_CPU).tag oguidir$(TARGET_CPU).tag \
|
||||
oluadir$(TARGET_CPU).tag opdcdir$(TARGET_CPU).tag \
|
||||
opdccdir$(TARGET_CPU).tag opdcgdir$(TARGET_CPU).tag \
|
||||
$(LUASRC)\lua.h $(PDCDEP) \
|
||||
$(INCL)\nhlua.h $(OUTL)utility.tag \
|
||||
$(DAT)\data $(DAT)\rumors $(DAT)\oracles $(DAT)\engrave \
|
||||
$(DAT)\epitaph $(DAT)\bogusmon $(GAMEDIR)\NetHack.exe \
|
||||
$(GAMEDIR)\NetHackW.exe $(GAMEDIRDLLS) binary.tag
|
||||
@echo NetHack is up to date.
|
||||
|
||||
#===============================================================================
|
||||
# Housekeeping
|
||||
#===============================================================================
|
||||
@@ -2359,6 +2390,8 @@ spotless: clean
|
||||
if exist $(DAT)\data del $(DAT)\data
|
||||
if exist tilemappings.lst del tilemappings.lst
|
||||
if exist $(SndWavDir)\*.wav del $(SndWavDir)\*.wav
|
||||
if exist $(MAINZIP) del $(MAINZIP)
|
||||
if exist $(DBGSYMZIP) del $(DBGSYMZIP)
|
||||
if exist $(OBJTTY)\* rmdir $(OBJTTY) /s /Q
|
||||
if exist $(OBJGUI)\* rmdir $(OBJGUI) /s /Q
|
||||
if exist $(OBJUTIL)\* rmdir $(OBJUTIL) /s /Q
|
||||
@@ -2375,11 +2408,12 @@ spotless: clean
|
||||
if exist $(OBJPDCG_B)\* rmdir $(OBJPDCG_B) /s /Q
|
||||
|
||||
clean:
|
||||
if exist install.tag del install.tag
|
||||
if exist binary.tag del binary.tag
|
||||
if exist gamedir.tag del gamedir.tag
|
||||
if exist envchk.tag del envchk.tag
|
||||
if exist cpu.tag del cpu.tag
|
||||
if exist envchk.tag del envchk.tag
|
||||
if exist pkgdir.tag del pkgdir.tag
|
||||
if exist $(OUTL)utility.tag del $(OUTL)utility.tag
|
||||
if exist $(OTTY)sp_lev.tag del $(OTTY)sp_lev.tag
|
||||
if exist $(OGUI)sp_lev.tag del $(OGUI)sp_lev.tag
|
||||
|
||||
147
sys/windows/build-msys2.txt
Normal file
147
sys/windows/build-msys2.txt
Normal file
@@ -0,0 +1,147 @@
|
||||
Building NetHack using the Visual Studio IDE
|
||||
|
||||
Prerequisite Requirements:
|
||||
|
||||
MSYS2
|
||||
- https://www.msys2.org/
|
||||
- Download the installer, and start the UCRT64 shell.
|
||||
then
|
||||
pacman -S mingw-w64-ucrt-x86_64-gcc
|
||||
pacman -S git
|
||||
pacman -S vim (or your editor of choice)
|
||||
pacman -S man (otherwise "git help foo" will not work)
|
||||
|
||||
OR
|
||||
|
||||
[the follow is untested]
|
||||
MinGW-w64 - winlibs standalone build
|
||||
- https://github.com/brechtsanders/winlibs_mingw
|
||||
- Download one of the releases from
|
||||
https://github.com/brechtsanders/winlibs_mingw/releases
|
||||
and extract the contents into a folder (ideally in a folder
|
||||
without spaces in the path), and add the location of the
|
||||
subfolder containing gcc.exe to your PATH.
|
||||
|
||||
/---------------------------------------------\
|
||||
| Directories for a Windows NetHack build |
|
||||
\---------------------------------------------/
|
||||
|
||||
(NetHack-top)
|
||||
|
|
||||
+-----+------+-----+-------+-----------+-----------+-----~-----+------+
|
||||
| | | | | | | | |
|
||||
dat doc include lib src sys win submodules util
|
||||
| | | |
|
||||
+----------+ +------+ +----+ +----+
|
||||
| | | | | | | |
|
||||
| | | | | | | |
|
||||
lua-5.4.6 pdcursesmod share windows tty win32 lua pdcursesmod
|
||||
|
|
||||
vs
|
||||
|
|
||||
+----------+-------+--------+--------+-----------+-------+-----+------+
|
||||
| | | | | | | | |
|
||||
makedefs NetHack NetHackW PDCurses PDCursesGui tile2bmp tilemap tiles uudecode
|
||||
|
||||
/-----------------------------------------------------------\
|
||||
| Building from MSYS2 bash |
|
||||
\-----------------------------------------------------------/
|
||||
|
||||
Required components that are not bundled in the NetHack repository, but
|
||||
are required to build NetHack yourself.
|
||||
|
||||
Lua
|
||||
NetHack 3.7 for Windows requires 3rd party Lua source that is not part
|
||||
of the NetHack distribution or repository.
|
||||
|
||||
A windows cmd command procedure for fetching prerequisite
|
||||
sources is available, and can be run as follows from the top of
|
||||
the NetHack source tree to obtain lua:
|
||||
sh sys/windows/fetch.sh lua
|
||||
|
||||
Curses
|
||||
If you want to include curses interface support in NetHack 3.7 for
|
||||
3rd part pdcursesmod source code is required and is not part of the
|
||||
NetHack distribution or repository.
|
||||
|
||||
A windows cmd command procedure for fetching prerequisite
|
||||
sources is available, and can be run as follows from the top of
|
||||
the NetHack source tree to obtain pdcursesmod:
|
||||
sh sys/windows/fetch.sh lua
|
||||
|
||||
Building
|
||||
|
||||
Two different versions of NetHack will be built for Windows from the
|
||||
command line using the Makefile approach:
|
||||
A tty port utilizing the Win32 Console I/O subsystem Console,
|
||||
and a curses interface in an executabled called NetHack.exe.
|
||||
NetHack
|
||||
A Win32 native port built on the Windows API Graphical NetHack,
|
||||
and graphical curses in an executable called NetHackW.exe.
|
||||
|
||||
The Makefile configurations will build both; NetHack.exe and NetHackW.exe
|
||||
and will be able to use the same datafiles, save files and bones files.
|
||||
|
||||
Since the last official release of NetHack, compilers and computer
|
||||
architectures have evolved and you can now choose whether to build
|
||||
a 32-bit x86 version, or a 64-bit x64 version. The default Makefile
|
||||
is set up for a 32-bit x86 version, but that's only because it will
|
||||
run on the most number of existing Windows environments. Change it if you
|
||||
want. Be aware that NetHack's save files and bones files in the 3.7.0
|
||||
release have not yet evolved enough to allow them to interchange between
|
||||
the 32-bit version and the 64-bit version (or between different platforms).
|
||||
That may change in future.
|
||||
|
||||
I. Dispelling the Myths:
|
||||
|
||||
Compiling NetHack for Windows is not as easy as it sounds, nor as hard
|
||||
as it looks, however it will behoove you to read this entire section
|
||||
through before beginning the task.
|
||||
|
||||
We have provided Makefile.mingw32 in
|
||||
sys/windows/Makefile.mingw32, which you use from the bash Windows command
|
||||
shell included with MSYS2.
|
||||
|
||||
|
||||
II. To compile your copy of NetHack on a Windows machine using MSYS2:
|
||||
|
||||
Setting Up
|
||||
|
||||
1. Change your current directory the top of the nethack
|
||||
source tree if it isn't there already.
|
||||
|
||||
2. Execute the following command to place copies of the Makefiles in
|
||||
the src subfolder.
|
||||
cp sys/windows/Makefile.mingw32* src
|
||||
|
||||
3. Change your current directory to the src subfolder of the nethack
|
||||
source tree. The following command assumes you are still in the
|
||||
sys/windows folder from steps #1 and #2 above:
|
||||
cd src
|
||||
|
||||
Compiling
|
||||
|
||||
4. Now that everything is set up, you should be ready to start the
|
||||
process.
|
||||
|
||||
Your current directory should be the NetHack src directory.
|
||||
|
||||
Issue these following commands:
|
||||
make -f Makefile.mingw32 clean
|
||||
make -f Makefile.mingw32 depend
|
||||
make -f Makefile.mingw32
|
||||
|
||||
If all goes well, intermediate NetHack files will be placed in the
|
||||
binary subfolder of the NetHack tree, and the final NetHack package
|
||||
for windows will be in the package subfolder.
|
||||
|
||||
Notes:
|
||||
|
||||
1. To rebuild NetHack after changing something, change your current directory
|
||||
to src and issue the appropriate command for your compiler:
|
||||
|
||||
For Microsoft compiler:
|
||||
make -f Makefile.mingw32
|
||||
|
||||
|
||||
|
||||
149
sys/windows/build-nmake.txt
Normal file
149
sys/windows/build-nmake.txt
Normal file
@@ -0,0 +1,149 @@
|
||||
Building NetHack using the Visual Studio IDE
|
||||
|
||||
Prerequisite Requirements:
|
||||
|
||||
A copy of Microsoft Visual Studio Community Edition needs to
|
||||
be installed on your machine, and the Lua prerequisite source
|
||||
files are required as outlined in sys/windows/Install.windows.
|
||||
|
||||
The build Makefiles and procedures produce two executables:
|
||||
a. A TTY and curses version of NetHack in nethack.exe
|
||||
b. A Windows and curses graphical version in nethackw.exe.
|
||||
|
||||
You can use one of the following build environments:
|
||||
|
||||
/---------------------------------------------\
|
||||
| Directories for a Windows NetHack build |
|
||||
\---------------------------------------------/
|
||||
|
||||
(NetHack-top)
|
||||
|
|
||||
+-----+------+-----+-------+-----------+-----------+-----~-----+------+
|
||||
| | | | | | | | |
|
||||
dat doc include lib src sys win submodules util
|
||||
| | | |
|
||||
+----------+ +------+ +----+ +----+
|
||||
| | | | | | | |
|
||||
| | | | | | | |
|
||||
lua-5.4.6 pdcursesmod share windows tty win32 lua pdcursesmod
|
||||
|
|
||||
vs
|
||||
|
|
||||
+----------+-------+--------+--------+-----------+-------+-----+------+
|
||||
| | | | | | | | |
|
||||
makedefs NetHack NetHackW PDCurses PDCursesGui tile2bmp tilemap tiles uudecode
|
||||
|
||||
|
||||
/-----------------------------------------------------------\
|
||||
| Building From the Command Line Using nmake from one of the |
|
||||
| Visual Studio Community Editions |
|
||||
\-----------------------------------------------------------/
|
||||
|
||||
Required components that are not bundled in the NetHack repository, but
|
||||
are required to build NetHack yourself.
|
||||
|
||||
Lua
|
||||
NetHack 3.7 for Windows requires 3rd party Lua source that is not part
|
||||
of the NetHack distribution or repository.
|
||||
|
||||
A windows cmd command procedure for fetching prerequisite
|
||||
sources is available, and can be run as follows from the top of
|
||||
the NetHack source tree to obtain lua:
|
||||
sys\windows\fetch.cmd lua
|
||||
|
||||
Curses
|
||||
If you want to include curses interface support in NetHack 3.7 for
|
||||
3rd part pdcursesmod source code is required and is not part of the
|
||||
NetHack distribution or repository.
|
||||
|
||||
A windows cmd command procedure for fetching prerequisite
|
||||
sources is available, and can be run as follows from the top of
|
||||
the NetHack source tree to obtain pdcursesmod:
|
||||
sys\windows\fetch.cmd pdcursesmod
|
||||
|
||||
Building
|
||||
|
||||
Two different versions of NetHack will be built for Windows from the
|
||||
command line using the Makefile approach:
|
||||
A tty port utilizing the Win32 Console I/O subsystem Console,
|
||||
and a curses interface in an executabled called NetHack.exe.
|
||||
NetHack
|
||||
A Win32 native port built on the Windows API Graphical NetHack,
|
||||
and graphical curses in an executable called NetHackW.exe.
|
||||
|
||||
The Makefile configurations will build both; NetHack.exe and NetHackW.exe
|
||||
and will be able to use the same datafiles, save files and bones files.
|
||||
|
||||
Since the last official release of NetHack, compilers and computer
|
||||
architectures have evolved and you can now choose whether to build
|
||||
a 32-bit x86 version, or a 64-bit x64 version. The default Makefile
|
||||
is set up for a 32-bit x86 version, but that's only because it will
|
||||
run on the most number of existing Windows environments. Change it if you
|
||||
want. Be aware that NetHack's save files and bones files in the 3.7.0
|
||||
release have not yet evolved enough to allow them to interchange between
|
||||
the 32-bit version and the 64-bit version (or between different platforms).
|
||||
That may change in future.
|
||||
|
||||
I. Dispelling the Myths:
|
||||
|
||||
Compiling NetHack for Windows is not as easy as it sounds, nor as hard
|
||||
as it looks, however it will behoove you to read this entire section
|
||||
through before beginning the task.
|
||||
|
||||
We have provided a Visual Studio nmake Makefile.make in
|
||||
sys/windows/Makefile.nmake, which you use from the Windows command
|
||||
line.
|
||||
|
||||
|
||||
II. To compile your copy of NetHack on a Windows machine:
|
||||
|
||||
Setting Up
|
||||
|
||||
1. Change your current directory to the sys\windows subfolder of the nethack
|
||||
source tree, if you are at the top of the NetHack source tree.
|
||||
cd sys\windows.
|
||||
|
||||
2. Execute .\nhsetup.bat to place copies of the Makefiles in
|
||||
the src subfolder. The file sys\windows\Makefile.nmake will copied
|
||||
to a file src\Makefile.
|
||||
.\nhsetup.bat
|
||||
|
||||
3. Change your current directory to the src subfolder of the nethack
|
||||
source tree. The following command assumes you are still in the
|
||||
sys\windows folder from steps #1 and #2 above:
|
||||
cd ..\..\src
|
||||
|
||||
Compiling
|
||||
|
||||
4. Now that everything is set up, you should be ready to start the
|
||||
process.
|
||||
|
||||
Your current directory should be the NetHack src directory.
|
||||
|
||||
Issue these following command:
|
||||
nmake package
|
||||
|
||||
If all goes well, intermediate NetHack files will be placed in the
|
||||
binary subfolder of the NetHack tree, and the final NetHack package
|
||||
for windows will be in the package subfolder.
|
||||
|
||||
Notes:
|
||||
|
||||
1. To rebuild NetHack after changing something, change your current directory
|
||||
to src and issue the appropriate command for your compiler:
|
||||
|
||||
For Microsoft compiler:
|
||||
nmake package
|
||||
|
||||
2. Depending on the build and compiler and tools used above, the
|
||||
package produced by the build will be either contain:
|
||||
- a 32-bit (x86) .exe file,
|
||||
which should run on any recent Win32 environment.
|
||||
or
|
||||
- a 64-bit (x64) .exe file,
|
||||
which should run on any 64-bit Windows O/S.
|
||||
|
||||
**Note**: saved games and bones files are NOT compatible between the
|
||||
32-bit and the 64-bit versions at this time.
|
||||
|
||||
|
||||
53
sys/windows/build-vs.txt
Normal file
53
sys/windows/build-vs.txt
Normal file
@@ -0,0 +1,53 @@
|
||||
Building NetHack using the Visual Studio IDE
|
||||
|
||||
Prerequisite Requirements:
|
||||
|
||||
A copy of Microsoft Visual Studio Community Edition needs to
|
||||
be installed on your machine, and the Lua prerequisite source
|
||||
files are required as outlined in sys/windows/Install.windows.
|
||||
|
||||
The nmake build Makefiles and procedures produce two executable
|
||||
versions:
|
||||
|
||||
a. A TTY and curses version of NetHack in nethack.exe
|
||||
b. A Windows and curses graphical version in nethackw.exe.
|
||||
|
||||
/---------------------------------------------\
|
||||
| Directories for a Windows NetHack build |
|
||||
\---------------------------------------------/
|
||||
|
||||
(NetHack-top)
|
||||
|
|
||||
+-----+------+-----+-------+-----------+-----------+-----~-----+------+
|
||||
| | | | | | | | |
|
||||
dat doc include lib src sys win submodules util
|
||||
| | | |
|
||||
+----------+ +------+ +----+ +----+
|
||||
| | | | | | | |
|
||||
| | | | | | | |
|
||||
lua-5.4.6 pdcursesmod share windows tty win32 lua pdcursesmod
|
||||
|
|
||||
vs
|
||||
|
|
||||
+----------+-------+--------+--------+-----------+-------+-----+------+
|
||||
| | | | | | | | |
|
||||
makedefs NetHack NetHackW PDCurses PDCursesGui tile2bmp tilemap tiles uudecode
|
||||
|
||||
|
||||
/-----------------------------------------------------------\
|
||||
| Building And Running Using Visual Studio 2017, 2019, 2022 |
|
||||
\-----------------------------------------------------------/
|
||||
|
||||
When using Visual Studio Community Edition, load the provided solution
|
||||
file within the IDE, build the solution.
|
||||
|
||||
The Visual Studio NetHack solution file can be found here:
|
||||
sys\windows\vs\NetHack.sln
|
||||
|
||||
The steps are:
|
||||
1. Launch the IDE.
|
||||
2. Open the appropriate solution file in sys\windows\vs\NetHack.sln.
|
||||
3. Select the build configuration you wish to use (Release, Debug, etc.).
|
||||
4. From the build menu, select build solution.
|
||||
5. Type F5 to start debugging.
|
||||
|
||||
30
sys/windows/fetch.cmd
Normal file
30
sys/windows/fetch.cmd
Normal file
@@ -0,0 +1,30 @@
|
||||
@echo off
|
||||
if not exist lib\* mkdir lib
|
||||
|
||||
if [%1] == [lua] (
|
||||
set LUA_VERSION=5.4.6
|
||||
set LUASRC=../lib/lua
|
||||
set CURLLUASRC=http://www.lua.org/ftp/lua-%LUA_VERSION%.tar.gz
|
||||
set CURLLUADST=lua-%LUA_VERSION.tar.gz
|
||||
if NOT exist lib/lua.h (
|
||||
cd lib
|
||||
curl -L %CURLLUASRC% -o %CURLLUADST%
|
||||
tar -xvf %CURLLUADST%
|
||||
cd ..
|
||||
)
|
||||
echo Lua placed in lib/lua-%LUA_VERSION%.tar.gz
|
||||
)
|
||||
|
||||
if [%1] == [pdcursesmod] (
|
||||
set PDCVERSION=4.4.0
|
||||
set CURLPDCSRC=https://github.com/Bill-Gray/PDCursesMod/archive/refs/tags/v%PDCVERSION%.zip
|
||||
set CURLPDCDST=pdcursesmod.zip
|
||||
if NOT exist lib/pdcursesmod/curses.h (
|
||||
cd lib
|
||||
curl -L %CURLPDCSRC% -o %CURLPDCDST%
|
||||
tar -xvf %CURLPDCDST%
|
||||
mkdir pdcursesmod
|
||||
tar -C pdcursesmod --strip-components=1 -xvf %CURLPDCDST%
|
||||
cd ..
|
||||
)
|
||||
)
|
||||
36
sys/windows/fetch.sh
Normal file
36
sys/windows/fetch.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -d lib ]; then
|
||||
mkdir -p lib
|
||||
fi
|
||||
|
||||
if [ $1 == "lua" ]; then
|
||||
if [ -z "$LUA_VERSION" ]; then
|
||||
export LUA_VERSION=5.4.6
|
||||
export LUASRC=../lib/lua
|
||||
fi
|
||||
|
||||
export CURLLUASRC=http://www.lua.org/ftp/lua-5.4.6.tar.gz
|
||||
export CURLLUADST=lua-5.4.6.tar.gz
|
||||
|
||||
if [ ! -f lib/lua.h ] ;then
|
||||
cd lib
|
||||
curl -L $CURLLUASRC -o $CURLLUADST
|
||||
/c/Windows/System32/tar -xvf $CURLLUADST
|
||||
cd ..
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $1 == "pdcursesmod" ]; then
|
||||
export CURLPDCSRC=https://github.com/Bill-Gray/PDCursesMod/archive/refs/tags/v4.4.0.zip
|
||||
export CURLPDCDST=pdcursesmod.zip
|
||||
|
||||
if [ ! -f lib/pdcursesmod/curses.h ] ; then
|
||||
cd lib
|
||||
curl -L $CURLPDCSRC -o $CURLPDCDST
|
||||
/c/Windows/System32/tar -xvf $CURLPDCDST
|
||||
mkdir -p pdcursesmod
|
||||
/c/Windows/System32/tar -C pdcursesmod --strip-components=1 -xvf $CURLPDCDST
|
||||
cd ..
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user