Demo for downloading formatted docs

Written for MacOS, more useful for Windows (but I'm not writing that).
This commit is contained in:
nhkeni
2025-01-31 21:48:15 -05:00
parent 3ffbfc724c
commit cfe39900ca
3 changed files with 27 additions and 1 deletions

View File

@@ -397,6 +397,25 @@ fetch-lua-http:
tar zxf lua-$(LUA_VERSION).tar.gz && \
rm -f lua-$(LUA_VERSION).tar.gz )
#
# This is not part of the dependency build hierarchy.
# It requires an explicit "make fetch-docs".
fetch-docs:
@FDroot=https://www.nethack.org; \
FDvmajor=`awk '/VERSION_MAJOR/{print $$3}' < include/patchlevel.h`; \
FDvminor=`awk '/VERSION_MINOR/{print $$3}' < include/patchlevel.h`; \
RDIR="NetHack-$${FDvmajor}.$${FDvminor}"; \
echo "Fetching directory information for $${RDIR}"; \
RDOCFILES=`curl --no-progress-meter $${FDroot}/cgi-bin/lsautodocs?$$RDIR`; \
FDbase="$${FDroot}/autodocs/$${RDIR}"; \
set -- $${RDOCFILES}; \
echo "Fetching $$# files"; \
while [ $$# -gt 0 ]; do \
echo "Downloading: '$$1' from '$${FDbase}/$$1'"; \
curl --no-progress-meter -R $${FDbase}/$$1 -o doc/$$1; \
shift; \
done
# 'make update' can be used to install a revised version after making
# customizations or such. Unlike 'make install', it doesn't delete everything
# from the target directory to have a clean start.