ID: 3d834163f4e74be50356943c18b6afff3064218c
39 lines
—
2K —
View raw
| SHELL = /bin/bash
# THIS PATH MUST BE ABSOLUTE.
# The path where debiman will save files.
# There is a bug in debiman, it won't accept a relative path
DEBIMAN_SERVING_DIR ?= ./
# This just prints out variables for displaying
vars:
@echo "Using envvar DEBIMAN_SERVING_DIR = ${DEBIMAN_SERVING_DIR}"
@echo "If you get errors, this path MUST be absolute."
# Note: the behaviour of debiman is to download all the manpages, then render them all.
# This cannot be changed. Since we're only interested in the raw manpages and not
# the HTML output, -only_render_pkgs is a hack that will make debiman render only one
# page (0ad) and quit.
download: vars
debiman -sync_codenames="buster,bullseye,bookworm" -sync_suites= -serving_dir="${DEBIMAN_SERVING_DIR}" -only_render_pkgs="0ad"
# Extract downloaded pages since they're compressed by default
extract: vars
find "${DEBIMAN_SERVING_DIR}" -type f,l -name "*.gz" -exec gunzip --decompress --force --keep "{}" \;
# Convert manpages from roff to plaintext
# Manpage files are named "page.section.lang".
# TODO ! -name "stress-ng.1.en" ! -name "md.4.en"
# this is a hack for skipping the rendering of those pages. The version of mandoc
# in Debian is outdated and gets stuck in a infinite loop. Remove this hack if
# using a more recent mandoc.
convert: vars
while IFS= read -r file; do \
echo "$${file}"; \
cp "$${file}" "$${file}.roff"; \
mandoc -T utf8 "$${file}" > "$${file}.roff.txt"; \
mandoc -T html -O fragment "$${file}" > "$${file}.roff.html"; \
done < <( find "${DEBIMAN_SERVING_DIR}" -type f -name "*.*.*" ! -name "*.gz" ! -name "*.roff" ! -name "*.txt" ! -name "*.html" ! -name "stress-ng.1.en" ! -name "md.4.en" )
.PHONY: vars download extract convert
|