add fetch

This commit is contained in:
nhmall
2024-03-31 09:09:31 -04:00
parent a3e9c7db2d
commit 8262eb2fe4
3 changed files with 151 additions and 13 deletions

View File

@@ -0,0 +1,74 @@
# NetHack 3.7 fetchprereq.nmake
#==============================================================================
#
# The version of the game this Makefile was designed for
NETHACK_VERSION="3.7.0"
# A brief version for use in macros
NHV=$(NETHACK_VERSION:.=)
NHV=$(NHV:"=)
# The version of Lua we want
LUA_VERSION=5.4.6
CURLLUASRC=https://www.lua.org/ftp/lua-$(LUA_VERSION).tar.gz
CURLLUADST=lua-$(LUA_VERSION).tar.gz
# The version of pdcursesmod that we want
PDCDIST=pdcursesmod
PDCURSES_VERSION = 4.4.0
PDCURL=https://github.com/Bill-Gray/PDCursesMod/archive/refs/tags/v
CURLPDCSRC=$(PDCURL)$(PDCURSES_VERSION).zip
CURLPDCDST=$(PDCDIST)
#
# relative directories from root of NetHack tree.
#
LIBSDIR=lib # libraries and external bits
SUBMSDIR=submodules # NetHack git submodules
ROOTDIR=..\..\..\.. # root of NetHack tree relative to project file
LIBDIR=$(ROOTDIR)\$(LIBSDIR)
SUBMDIR=$(ROOTDIR)\$(SUBMSDIR)
default: fetchall
fetchall: libdir fetch-Lua fetch-pdcurses ..\..\..\..\include\nhlua.h
fetch-lua: fetch-actual-Lua
fetch-Lua: fetch-actual-Lua
fetch-actual-Lua:
cd $(LIBDIR)
curl --insecure -R -O $(CURLLUASRC)
tar zxf lua-$(LUA_VERSION).tar.gz
if exist lua-$(LUA_VERSION).tar.gz del lua-$(LUA_VERSION).tar.gz
cd ..\sys\windows\vs\fetchprereq
@echo Lua has been fetched into $(LIBDIR)\lua-$(LUA_VERSION)
fetch-pdcurses:
cd $(LIBDIR)
curl --insecure -L -R $(PDCURL)$(PDCURSES_VERSION).zip -o $(PDCDIST).zip
if not exist $(PDCDIST)\*.* mkdir $(PDCDIST)
tar -C $(PDCDIST) --strip-components=1 -xvf $(CURLPDCDST).zip
if exist $(CURLPDCDST).zip del $(CURLPDCDST).zip
cd ..\sys\windows\vs\fetchprereq
@echo $(PDCDIST) has been fetched into $(LIBDIR)\$(PDCDIST)
..\..\..\..\include\nhlua.h:
@echo /* nhlua.h - generated by Makefile from fetchprereq.nmake */ > $@
@echo #include "lua.h" >> $@
@echo LUA_API int (lua_error) (lua_State *L) NORETURN; >> $@
@echo #include "lualib.h" >> $@
@echo #include "lauxlib.h" >> $@
@echo /*nhlua.h*/ >> $@
libdir:
@if not exist $(LIBDIR)\*.* echo creating directory $(LIB:\=/)
@if not exist $(LIBDIR)\*.* mkdir $(LIBDIR)
clean:
rebuild:

View File

@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<Import Project="..\config.props" />
<Import Project="..\dirs.props" />
<Import Project="..\default.props" />
<Import Project="..\NetHackProperties.props" />
<Import Project="..\console.props" />
<Import Project="..\common.props" />
<Import Project="..\files.props" />
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<ProjectGuid>{503AE687-C33A-45ED-93AA-83967E176D67}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0.22621.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="!Exists('$(LibDir)pdcurses') OR !Exists('$(LibDir)lua-5.4.6')">
<NMakeBuildCommandLine>pushd $(vsDir)fetchprereq %26%26 nmake -F fetchprereq.nmake %26%26 popd</NMakeBuildCommandLine>
<NMakeCleanCommandLine>pushd $(vsDir)fetchprereq %26%26 nmake -F fetchprereq.nmake clean %26%26 popd</NMakeCleanCommandLine>
<NMakeReBuildCommandLine>pushd $(vsDir)fetchprereq %26%26 nmake -F fetchprereq.nmake rebuild %26%26 popd</NMakeReBuildCommandLine>
<NMakePreprocessorDefinitions>_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PropertyGroup>
<LUA_VERSION>5.4.6</LUA_VERSION>
<RootDir>$(MSBuildProjectDirectory)\..\..\..\..\</RootDir>
<vsDir>$(RootDir)sys\windows\vs\</vsDir>
<BinDir>$(RootDir)binary\$(Configuration)\$(Platform)\</BinDir>
<ObjDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(TargetName)\</ObjDir>
<SymbolsDir>$(ProjectDir)symbols\$(Configuration)\$(Platform)\$(TargetName)\</SymbolsDir>
@@ -20,6 +20,7 @@
<UtilDir>$(RootDir)util\</UtilDir>
<SysShareDir>$(RootDir)sys\share\</SysShareDir>
<SysWindDir>$(RootDir)sys\windows\</SysWindDir>
<vsDir>$(SysWindDir)vs\</vsDir>
<WinShareDir>$(RootDir)win\share\</WinShareDir>
<WinTtyDir>$(RootDir)win\tty\</WinTtyDir>
<WinWin32Dir>$(RootDir)win\win32\</WinWin32Dir>
@@ -27,20 +28,14 @@
<IntDir>$(ObjDir)</IntDir>
<WinCursDir>$(RootDir)win\curses\</WinCursDir>
<SubmodulesDir>$(RootDir)submodules\</SubmodulesDir>
<LuaDir>$(SubmodulesDir)lua\</LuaDir>
<LuaDir>$(LibDir)lua-$(LUA_VERSION)\src\</LuaDir>
</PropertyGroup>
<PropertyGroup Condition="'$(PDCURSESMOD)'=='' AND Exists('$(SubmodulesDir)PDCursesMod')">
<PDCURSESMOD>$(SubmodulesDir)PDCursesMod\</PDCURSESMOD>
<PropertyGroup Condition="'$(PDCURSESMOD)'=='' AND Exists('$(LibDir)pdcursesmod\curses.h')">
<PDCURSESMOD>$(LibDir)pdcursesmod\</PDCURSESMOD>
<PDCURSES>$(PDCURSESMOD)</PDCURSES>
</PropertyGroup>
<PropertyGroup Condition="'$(PDCURSESMOD)'=='' AND Exists('$(LibDir)PDCursesMod')">
<PDCURSESMOD>$(LibDir)PDCursesMod\</PDCURSESMOD>
<PropertyGroup Condition="'$(PDCURSESMOD)'=='' AND Exists('$(SubmodulesDir)pdcursesmod\curses.h')">
<PDCURSESMOD>$(SubmodulesDir)pdcursesmod\</PDCURSESMOD>
<PDCURSES>$(PDCURSESMOD)</PDCURSES>
</PropertyGroup>
<PropertyGroup Condition="'$(PDCURSES)'=='' AND '$(PDCURSESMOD)'=='' AND Exists('$(SubmodulesDir)PDCurses')">
<PDCURSES>$(SubmodulesDir)PDCurses\</PDCURSES>
</PropertyGroup>
<PropertyGroup Condition="'$(PDCURSES)'=='' AND '$(PDCURSESMOD)'=='' AND Exists('$(LibDir)PDCurses')">
<PDCURSES>$(LibDir)PDCurses\</PDCURSES>
</PropertyGroup>
</Project>