Skip to content

Commit 0fe6cfe

Browse files
committed
Attempt to fix Windows build
- unindent some lines that it can't recognize - display xNetHack version, not "NetHack 3.7"; use a variable (renamed to XNETHACK_VERSION) so I don't have to remember to update this in 2 places - Rename a bunch of NETHACK_VERSION to XNETHACK_VERSION. Document that all these different Windows build files need to be updated for any new version and I hate it. - While touching those additional files, update stray 3.7.0 versions to 9.0.0. - fix the lua download by using https not http - comment out LUA_VERSION env variable in the workflow; let Makefile.nmake provide it - rename windows "make install" step to "make package" - fix NetHackW files; use "xNetHackW" only for the .exe file, leave the source and object files as "NetHackW". This reverts part of earlier commits to rename a bunch of things xNetHack -- the problem with doing that in depth is that it causes lots and lots of merge conflicts in build files. Only renaming the final executable mostly avoids this.
1 parent 5d47196 commit 0fe6cfe

File tree

13 files changed

+50
-51
lines changed

13 files changed

+50
-51
lines changed

.github/workflows/xnethack-cross-platform-build.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
LUASRC: ../submodules/lua
5151
ADD_CURSES: Y
5252
PDCURSES_TOP: ../submodules/pdcurses
53-
LUA_VERSION: 5.4.2
53+
#LUA_VERSION: 5.4.2
5454
TRAVIS_COMPILER: 1
5555
ZIP_NAME: xnethack.zip
5656
steps:
@@ -61,20 +61,15 @@ jobs:
6161
- name: setup
6262
run: |
6363
./sys/windows/nhsetup.bat
64-
- name: make install
64+
- name: make package
6565
run: |
6666
cd src
67-
nmake fetch-lua
68-
nmake install
69-
# Note: mingw build doesn't seem to build xNetHackW.exe and is disabled.
70-
# This would work to build the tty windows version, though.
71-
#cp ../sys/winnt/Makefile.gcc ./Makefile
72-
#mingw32-make LUA_VERSION=$LUA_VERSION install
67+
nmake package
7368
- uses: thedoctor0/zip-release@master
7469
if: startsWith(github.ref, 'refs/tags/')
7570
with:
7671
type: 'zip'
77-
path: binary/
72+
path: package/
7873
filename: xnethack_mswindows.zip
7974
- name: release
8075
uses: softprops/action-gh-release@v1

Files

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ getline.c termcap.c topl.c wintty.c
631631

632632
win/win32:
633633
(files for Windows versions - tested up to Windows 11)
634-
NetHackW.c xNetHackW.exe.manifest xNetHackW.rc
634+
NetHackW.c NetHackW.exe.manifest NetHackW.rc
635635
mhaskyn.c mhaskyn.h mhdlg.c
636636
mhdlg.h mhfont.c mhfont.h
637637
mhinput.c mhinput.h mhmain.c

doc/xnethack-new-version-runbook.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@ Assumed premises:
3838
`VERSION_COMPATIBILITY` in patchlevel.h. Reset `EDITLEVEL` to 0 if it isn't
3939
already. Update `NH_DEVEL_STATUS` to `NH_STATUS_RELEASED` if it isn't already
4040
(it tends to not get changed from that except by the vanilla devteam). Update
41-
`NETHACK_VERSION` in sys/windows/Makefile.nmake (blargh). Commit these
42-
changes.
41+
`XNETHACK_VERSION` in the following files (blargh):
42+
- sys/windows/Makefile.nmake
43+
- sys/windows/vs/NetHackProperties.props
44+
- sys/windows/vs/package/package.nmake
45+
- sys/windows/vs/FetchPrereq/fetchprereq.nmake
46+
Commit these changes.
4347
10. Tag the patchlevel commit, e.g. `xnh5.0`, via `git tag -a xnh5.0`. Write the
4448
tag message using previous release tags as an example (xnh6.0 is a good
4549
matter-of-fact one). Mention that Windows binaries are available to download

sys/windows/GNUmakefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,10 @@ endif
229229
#==============================================================================
230230

231231
# The version of the game this Makefile was designed for
232-
NETHACK_VERSION="3.7.0"
232+
XNETHACK_VERSION="9.0.0"
233233

234234
# A brief version for use in macros
235-
NHV1=$(subst .,,$(NETHACK_VERSION))
235+
NHV1=$(subst .,,$(XNETHACK_VERSION))
236236
NHV=$(subst ",,$(NHV1))
237237

238238
#
@@ -412,7 +412,7 @@ $(ULUADLL) $(LUAIMP): $(LUAOBJS) | $(OLUA)
412412
$(ld) $(LDFLAGS) -fPIC -shared -Wl,--export-all-symbols -Wl,--add-stdcall-alias \
413413
-Wl,--out-implib=$(LUAIMP) $^ -o$(ULUADLL)
414414

415-
$(LUASTATIC): $(LUAOBJS) | $(OLUA)
415+
$(LUASTATIC): $(LUAOBJS) | $(OLUA)
416416
ar rcs $@ $^
417417

418418
$(OLUA)/%.o: $(LUASRC)/%.c | $(OLUA)
@@ -485,7 +485,7 @@ HLTARGETS = $(HLHACKLIB) $(HLHACKLIBOBJS)
485485
$(HL)/hacklib.a: $(HLHACKLIBOBJS)
486486
ar rcs $@ $^
487487

488-
$(HL)/hacklib.o: $(HACKLIBSRC) | $(HL)
488+
$(HL)/hacklib.o: $(HACKLIBSRC) | $(HL)
489489

490490
$(HL)/%.o: $(SRC)/%.c | $(HL)
491491
$(cc) $(CFLAGSU) $< -o$@

sys/windows/Makefile.nmake

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ GIT_AVAILABLE=Y
159159
#==============================================================================
160160
#
161161
# The version of the game this Makefile was designed for
162-
NETHACK_VERSION="9.0.0"
162+
XNETHACK_VERSION="9.0.0"
163163

164164
# A brief version for use in macros
165-
NHV=$(NETHACK_VERSION:.=)
165+
NHV=$(XNETHACK_VERSION:.=)
166166
NHV=$(NHV:"=)
167167

168168
#==============================================================================
@@ -378,15 +378,15 @@ ADD_CURSES=Y
378378
INCLCURSES_H=-I$(R_PDCURSES_TOP)
379379
! ELSE
380380
# Cannot do it, sorry
381-
PDCINCL=
382-
INCLCURSES_H=
383-
ADD_CURSES = N
381+
PDCINCL=
382+
INCLCURSES_H=
383+
ADD_CURSES = N
384384
! ENDIF # If we found a copy of curses.h
385385
! ENDIF # ADD_CURSES == Y
386386
!ENDIF # WANT_CURSES
387387

388388
!IF "$(ADD_CURSES)" != "Y"
389-
!MESSAGE NetHack 3.7 will be built without support for the curses window-port.
389+
!MESSAGE xNetHack $(XNETHACK_VERSION) will be built without support for the curses window-port.
390390
!ENDIF
391391

392392
#These will be in the environment variables with one of the Visual Studio
@@ -1613,7 +1613,7 @@ $(PDCURSES_TOP)curses.h:
16131613
# git submodule update --remote $(SUBM)$(R_PDCDIST)
16141614
!ENDIF
16151615
!ELSE # GIT_AVAILABLE no
1616-
CURLLUASRC=http://www.lua.org/ftp/lua-5.4.6.tar.gz
1616+
CURLLUASRC=https://www.lua.org/ftp/lua-5.4.6.tar.gz
16171617
CURLLUADST=lua-5.4.6.tar.gz
16181618

16191619
#CURLPDCSRC=https://github.com/wmcbrine/PDCurses/archive/refs/tags/3.9.zip
@@ -1709,7 +1709,7 @@ $(GAMEDIR)xNetHack.exe : gamedir.tag $(OTTY)consoletty.o \
17091709
$(GAMEDIR)xNetHackW.exe : gamedir.tag $(OGUI)tile.o \
17101710
$(ALLOBJGUI) $(GAMEOBJGUI) $(GUIOBJ) $(GUISOUNDOBJS) \
17111711
$(CURSESWINGUIOBJS) $(OGUI)date.o \
1712-
$(OGUI)xNetHackW.res \
1712+
$(OGUI)NetHackW.res \
17131713
$(LUALIB) $(PDCWINGUILIB) $(PDCWINGUIOBJS) $(OGUIHACKLIB)
17141714
@if not exist $(GAMEDIR)*.* mkdir $(R_GAMEDIR)
17151715
@echo Linking $(@:\=/)
@@ -1724,7 +1724,7 @@ $(GAMEDIR)xNetHackW.exe : gamedir.tag $(OGUI)tile.o \
17241724
$(GUISOUNDOBJS) $(CURSESWINGUIOBJS) $(PDCWINGUIOBJS)
17251725
$(OGUI)tile.o
17261726
$(OGUI)date.o
1727-
$(OGUI)xNetHackW.res
1727+
$(OGUI)NetHackW.res
17281728
<< keep
17291729

17301730
#--------
@@ -1793,12 +1793,12 @@ $(INCL)nhlua.h:
17931793
tileutil: $(U)gif2txt.exe $(U)gif2tx32.exe $(U)txt2ppm.exe
17941794
@echo Optional tile development utilities are up to date.
17951795

1796-
$(OGUI)xNetHackW.res: $(SRC)tiles.bmp $(MSWIN)xNetHackW.rc $(MSWIN)NetHack.ico \
1796+
$(OGUI)NetHackW.res: $(SRC)tiles.bmp $(MSWIN)NetHackW.rc $(MSWIN)NetHack.ico \
17971797
$(MSWIN)mnsel.bmp $(MSWIN)mnselcnt.bmp $(MSWIN)mnunsel.bmp \
17981798
$(MSWIN)petmark.bmp $(MSWIN)pilemark.bmp $(MSWIN)NetHack.ico \
1799-
$(MSWIN)rip.bmp $(MSWIN)splash.bmp $(MSWIN)xNetHackW.exe.manifest $(WAV)
1799+
$(MSWIN)rip.bmp $(MSWIN)splash.bmp $(MSWIN)NetHackW.exe.manifest $(WAV)
18001800
@echo Building resource file $@ from $**
1801-
$(rc) -nologo -r -fo$@ -i$(MSWIN) -i$(SndWavDir) -dNDEBUG -dVIA_MAKE $(RCFLAGS) $(MSWIN)xNetHackW.rc
1801+
$(rc) -nologo -r -fo$@ -i$(MSWIN) -i$(SndWavDir) -dNDEBUG -dVIA_MAKE $(RCFLAGS) $(MSWIN)NetHackW.rc
18021802

18031803
$(OTTY)console.res: $(MSWSYS)console.rc $(MSWSYS)NetHack.ico $(WAV)
18041804
@echo Building resource file $@ from $**
@@ -2039,7 +2039,7 @@ fetch-Lua: fetch-actual-Lua
20392039
fetch-actual-Lua:
20402040
@if not exist $(LIBDIR)*.* mkdir $(R_LIBDIR)
20412041
cd $(LIBDIR)
2042-
curl -R -O http://www.lua.org/ftp/lua-$(LUAVER).tar.gz
2042+
curl -R -O https://www.lua.org/ftp/lua-$(LUAVER).tar.gz
20432043
tar zxf lua-$(LUAVER).tar.gz
20442044
if exist lua-$(LUAVER).tar.gz del lua-$(LUAVER).tar.gz
20452045
if exist lua-$(LUAVER).tar del lua-$(LUAVER).tar
@@ -2369,7 +2369,7 @@ $(OGUI)mhstatus.o: $(MSWIN)mhstatus.c $(MSWIN)$(@B).h $(MSWIN)mhmsg.h $(MSWIN)mh
23692369
$(OGUI)mhtext.o: $(MSWIN)mhtext.c $(MSWIN)$(@B).h $(MSWIN)mhmsg.h $(MSWIN)mhfont.h \
23702370
$(WINDHDR) $(HACK_H)
23712371
$(OGUI)mswproc.o: $(MSWIN)mswproc.c $(ALL_GUIHDR) $(MSWIN)resource.h $(WINDHDR) $(HACK_H)
2372-
$(OGUI)xNetHackW.o: $(MSWIN)NetHackW.c $(ALL_GUIHDR) $(MSWIN)resource.h $(WINDHDR) $(HACK_H)
2372+
$(OGUI)NetHackW.o: $(MSWIN)NetHackW.c $(ALL_GUIHDR) $(MSWIN)resource.h $(WINDHDR) $(HACK_H)
23732373

23742374
#===================================================================
23752375
# sys/share dependencies
@@ -2549,10 +2549,10 @@ $(SndWavDir)sa2_xplevelup.wav: $(SndWavDir)sa2_xplevelup.uu $(U)uudecode.exe
25492549
# packaging
25502550
#===============================================================================
25512551

2552-
PKGFILES = nethackrc.template Guidebook.txt license xNetHack.exe NetHack.txt \
2553-
NetHackW.exe opthelp nhdat370 record symbols sysconf.template
2554-
FILESTOZIP = $(BinDir)nethackrc.template $(BinDir)Guidebook.txt $(BinDir)license \
2555-
$(BinDir)xNetHack.exe $(BinDir)NetHack.txt $(BinDir)NetHackW.exe \
2552+
PKGFILES = xnethackrc.template Guidebook.txt license xNetHack.exe NetHack.txt \
2553+
xNetHackW.exe opthelp nhdat370 record symbols sysconf.template
2554+
FILESTOZIP = $(BinDir)xnethackrc.template $(BinDir)Guidebook.txt $(BinDir)license \
2555+
$(BinDir)xNetHack.exe $(BinDir)NetHack.txt $(BinDir)xNetHackW.exe \
25562556
$(BinDir)opthelp $(BinDir)nhdat370 $(BinDir)record \
25572557
$(BinDir)symbols $(BinDir)sysconf.template
25582558
DBGSYMS = NetHack.PDB NetHackW.PDB
@@ -2577,7 +2577,7 @@ binary: envchk.tag libdir.tag ottydir$(TARGET_CPU).tag \
25772577
$(INCL)nhlua.h $(OUTL)utility.tag \
25782578
$(DAT)data $(DAT)rumors $(DAT)oracles $(DAT)engrave \
25792579
$(DAT)epitaph $(DAT)bogusmon $(GAMEDIR)xNetHack.exe \
2580-
$(GAMEDIR)NetHackW.exe $(GAMEDIRDLLS) binary.tag
2580+
$(GAMEDIR)xNetHackW.exe $(GAMEDIRDLLS) binary.tag
25812581
@echo NetHack is up to date.
25822582

25832583
#===============================================================================
@@ -2715,7 +2715,7 @@ clean:
27152715
if exist $(SRC)tiles.bmp del $(SRC)tiles.bmp
27162716
if exist $(OTTY)console.res del $(OTTY)console.res
27172717
if exist $(OTTY)xNetHack.res del $(OTTY)xNetHack.res
2718-
if exist $(OGUI)xNetHackW.res del $(OGUI)xNetHackW.res
2718+
if exist $(OGUI)NetHackW.res del $(OGUI)NetHackW.res
27192719

27202720
#===================================================================
27212721
# OTHER DEPENDENCIES

sys/windows/vs/FetchPrereq/fetchprereq.nmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
#==============================================================================
33
#
44
# The version of the game this Makefile was designed for
5-
NETHACK_VERSION="3.7.0"
5+
XNETHACK_VERSION="9.0.0"
66

77
# A brief version for use in macros
8-
NHV=$(NETHACK_VERSION:.=)
8+
NHV=$(XNETHACK_VERSION:.=)
99
NHV=$(NHV:"=)
1010

1111
# The version of Lua we want
@@ -64,7 +64,7 @@ fetch-pdcurses:
6464
@echo #include "lauxlib.h" >> $@
6565
@echo /*nhlua.h*/ >> $@
6666

67-
libdir:
67+
libdir:
6868
@if not exist $(LIBDIR)\*.* echo creating directory $(LIB:\=/)
6969
@if not exist $(LIBDIR)\*.* mkdir $(LIBDIR)
7070

sys/windows/vs/NetHackProperties.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ImportGroup Label="PropertySheets" />
44
<PropertyGroup Label="UserMacros">
5-
<VERSION_MAJOR>3</VERSION_MAJOR>
6-
<VERSION_MINOR>7</VERSION_MINOR>
5+
<VERSION_MAJOR>9</VERSION_MAJOR>
6+
<VERSION_MINOR>0</VERSION_MINOR>
77
<PATCHLEVEL>0</PATCHLEVEL>
8-
<NETHACK_VERSION>$(VERSION_MAJOR).$(VERSION_MINOR).$(PATCHLEVEL)</NETHACK_VERSION>
8+
<XNETHACK_VERSION>$(VERSION_MAJOR).$(VERSION_MINOR).$(PATCHLEVEL)</XNETHACK_VERSION>
99
<LUA_MAJOR_VERSION>5</LUA_MAJOR_VERSION>
1010
<LUA_MINOR_VERSION>4</LUA_MINOR_VERSION>
1111
<LUA_PATCH_LEVEL>6></LUA_PATCH_LEVEL>

sys/windows/vs/NetHackW/NetHackW.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
<AdditionalDependencies>hacklib.lib;lualib.lib;dbghelp.lib;comctl32.lib;winmm.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
7878
</Link>
7979
<Manifest>
80-
<AdditionalManifestFiles>$(WinWin32Dir)xNethackW.exe.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
80+
<AdditionalManifestFiles>$(WinWin32Dir)NethackW.exe.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
8181
</Manifest>
8282
</ItemDefinitionGroup>
8383
<ItemGroup>
@@ -252,7 +252,7 @@
252252
<ClCompile Include="$(WinWin32Dir)NetHackW.c" />
253253
</ItemGroup>
254254
<ItemGroup>
255-
<ResourceCompile Include="$(WinWin32Dir)xNetHackW.rc" />
255+
<ResourceCompile Include="$(WinWin32Dir)NetHackW.rc" />
256256
</ItemGroup>
257257
<ItemGroup>
258258
<ClInclude Include="$(WinWin32Dir)mhaskyn.h" />

sys/windows/vs/package/package.nmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
#
44
# The version of the game this Makefile was designed for
55

6-
!IFNDEF NETHACK_VERSION
7-
NETHACK_VERSION="3.7.0"
8-
!MESSAGE NETHACK_VERSION set to $(NETHACK_VERSION).
6+
!IFNDEF XNETHACK_VERSION
7+
XNETHACK_VERSION="9.0.0"
8+
!MESSAGE XNETHACK_VERSION set to $(XNETHACK_VERSION).
99
!ELSE
10-
!MESSAGE NETHACK_VERSION set to $(NETHACK_VERSION) by caller.
10+
!MESSAGE XNETHACK_VERSION set to $(XNETHACK_VERSION) by caller.
1111
!ENDIF
1212

1313
# A brief variation for use in macros
14-
NHV=$(NETHACK_VERSION:.=)
14+
NHV=$(XNETHACK_VERSION:.=)
1515
NHV=$(NHV:"=)
1616

1717
#

sys/windows/vs/package/package.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
</ImportGroup>
5555
<PropertyGroup Label="UserMacros" />
5656
<PropertyGroup>
57-
<NMakeBuildCommandLine>pushd $(vsDir)package %26%26 nmake -F package.nmake BinDir=&quot;$(BinDir)\&quot; Platform=&quot;$(Platform)&quot; PlatformShortName=&quot;$(PlatformShortName)&quot; Configuration=&quot;$(Configuration)&quot; NETHACK_VERSION=&quot;$(NETHACK_VERSION)&quot; %26%26 popd</NMakeBuildCommandLine>
57+
<NMakeBuildCommandLine>pushd $(vsDir)package %26%26 nmake -F package.nmake BinDir=&quot;$(BinDir)\&quot; Platform=&quot;$(Platform)&quot; PlatformShortName=&quot;$(PlatformShortName)&quot; Configuration=&quot;$(Configuration)&quot; XNETHACK_VERSION=&quot;$(XNETHACK_VERSION)&quot; %26%26 popd</NMakeBuildCommandLine>
5858
<NMakeCleanCommandLine>pushd $(vsDir)package %26%26 nmake -F package.nmake clean %26%26 popd</NMakeCleanCommandLine>
5959
<NMakeReBuildCommandLine>pushd $(vsDir)package %26%26 nmake -F package.nmake rebuild %26%26 popd</NMakeReBuildCommandLine>
6060
</PropertyGroup>

0 commit comments

Comments
 (0)