Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
PREFIX := /usr/local

SOURCES = $(shell find src -not -path 'src/theme*' -type f -name '*.md')
MANPAGES = $(subst src/,book/mandoc/,$(patsubst %.md,%.7,$(SOURCES)))
UTILS = book/void-docs book/void-docs.1

all: void-book void-docs mandoc

install: all
install -Dm0755 book/void-docs $(DESTDIR)$(PREFIX)/bin/void-docs
install -Dm0644 book/void-docs.1 $(DESTDIR)$(PREFIX)/share/man/man1/void-docs.1

install -Dm0644 book/typst/book.pdf $(DESTDIR)$(PREFIX)/share/doc/void/handbook.pdf

cp -r src/ $(DESTDIR)$(PREFIX)/share/doc/void/markdown
rm -fr $(DESTDIR)$(PREFIX)/share/doc/void/markdown/theme

cp -r book/html $(DESTDIR)$(PREFIX)/share/doc/void/html

cp -r book/mandoc $(DESTDIR)$(PREFIX)/share/doc/void/mandoc

void-docs: $(UTILS)

$(UTILS): book/%: res/%.in book
sed -e "s,@PREFIX@,$(PREFIX)," $< >$@

void-book: $(SOURCES) book/typst/handbook-cover.svg
mdbook build

book/typst/handbook-cover.svg: res/handbook-cover.svg book/typst
cp -a $< $@

mandoc: $(MANPAGES)

book/mandoc/%.7: src/%.md book/mandoc
@mkdir -p $(@D)
lowdown -T man -m "title: $(*F)" -m "date: $$(git log --pretty='%cs' -1 $< 2>/dev/null || date -d @$$SOURCE_DATE_EPOCH +%F)" \
-m "section: 7" -m "source: The Void Linux Handbook" -m "volume: The Void Linux Handbook" -s -o $@ $<

book:
mkdir -p book

book/typst: book
mkdir -p book/typst

book/mandoc: book
mkdir -p book/mandoc

clean:
rm -rf book

.PHONY: all install void-docs void-book mandoc clean
15 changes: 5 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,15 @@ the same protocol as the packages tree. For details, please read

## Building

The [res/build.sh](./res/build.sh) script builds HTML, roff and PDF versions of
the Void documentation and the `void-docs.1` man page. It requires the following
Void packages:
The `Makefile` builds HTML, roff and PDF versions of the Void documentation and
the `void-docs.1` man page. It requires the following Void packages:

- `mdBook`
- `findutils`
- `lowdown` (version 0.8.1 or greater)
- `texlive`
- `perl`
- `perl-File-Which`
- `perl-JSON`
- `librsvg-utils`
- `mdbook-typst`
- `mdbook-linkcheck`
- `python3-md2gemini`

In order to build and install these files, set the `PREFIX` and `DESTDIR`
environment variables to appropriate values and run `res/build.sh` followed by
`res/install.sh`.
variables to appropriate values and run `make` to build, and `make install` to install.
58 changes: 48 additions & 10 deletions book.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[book]
authors = ["The Void Linux Team"]
src = "src"
title = "Void Linux Handbook"
title = "The Void Linux Handbook"

[output.html]
theme = "src/theme"
Expand All @@ -15,9 +15,50 @@ edit-url-template = "https://github.com/void-linux/void-docs/edit/master/{path}"
"/config/gnupg.html" = "/config/openpgp.html#gnupg"
"/installation/guides/arm-devices/platforms.html" = "/installation/guides/arm-devices/raspberry-pi.html"

[output.latex]
[output.typst]
optional = true

[output.typst.output]
format = "pdf"

[output.typst.style]
paper = "us-letter"
text-font = "Libertinus Serif"
link-color = "black"
# XXX: needs fix for zeros showing up
# heading-numbering = "1.1"

[output.typst.advanced]
typst-markup-header = """
#let voidgreen = rgb("#478061")
#set page(paper: "us-letter")
#align(center + horizon)[
#image("handbook-cover.svg")
#title()
]
#pagebreak()
#set page(
header: [_The Void Linux Handbook_],
numbering: "1",
)
#set par(justify: true)
#set table(
stroke: (x, y) => if y != 0 { 0.5pt } else { voidgreen },
fill: (x, y) => if y == 0 { voidgreen },
)
#show table.cell.where(y: 0): it => {
set text(white)
strong(it)
}
#show raw.where(block: false): box.with(fill: luma(240), inset: (x: 3pt, y: 0pt), outset: (y: 3pt), radius: 2pt)
#show raw.where(block: true): box.with(fill: luma(240), inset: 8pt, radius: 3pt)
// XXX: needs fix for zeros showing up
#let skip_zeros(..args) = {
numbering("1.1", ..args.pos().filter((i) => i != 0))
}
#set heading(numbering: skip_zeros)
"""

[output.gemini]
optional = true

Expand All @@ -26,16 +67,13 @@ optional = true
follow-web-links = true
exclude = [
'kernel\.org',
'ntp\.org',
'\.onion',
'localhost',
'userbase\.kde\.org',
'sjtu\.edu\.cn',
'mirrors\.cnnic\.cn',
'void\.webconverger\.org',
'mirror\.vofr\.net',
'void\.chililinux\.com',
'voidlinux\.com\.br',
'reddit\.com',
'raspberrypi\.com',
'xnux\.eu',
'canonical\.com',
'freedesktop\.org',
'libressl\.org',
]
user-agent = "Mozilla/5.0"
16 changes: 8 additions & 8 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
# reset variable so it doesn't use the environment one
MISSING=

echo -n "Checking for mdbook-linkcheck ... "
printf "Checking for mdbook-linkcheck ... "
if ! command -v mdbook-linkcheck; then
MISSING="$MISSING mdbook-linkcheck"
echo "not found"
fi

echo -n "Checking for vmdfmt ... "
printf "Checking for vmdfmt ... "
if ! command -v vmdfmt; then
MISSING="$MISSING vmdfmt"
echo "not found"
fi

if [ "$MISSING" ]; then

echo -n "Checking for xbps-install ... "
printf "Checking for xbps-install ... "
if ! command -v xbps-install; then
echo "not found"
echo "Please manually install: $MISSING"
exit 1
fi

echo -n "Checking for sudo ... "
printf "Checking for sudo ... "
if command -v sudo; then
SU_CMD='sudo'
else
Expand All @@ -39,14 +39,14 @@ if [ "$MISSING" ]; then
fi
fi

echo "\nTrying to install ${MISSING## } ... "
printf "\nTrying to install %s ... " "${MISSING## }"
$SU_CMD xbps-install $MISSING
echo

# Check whether executables are now present.

for i in $MISSING; do
if ! command -v $i 2>&1 >/dev/null; then
if ! command -v "$i" >/dev/null 2>&1; then
UNAVAILABLE="$UNAVAILABLE $i"
fi
done
Expand All @@ -60,7 +60,7 @@ fi

vmdfmt -l -w src/

if command -v mdbook 2>&1 >/dev/null; then
if command -v mdbook >/dev/null 2>&1; then
echo "Building book and checking links with mdbook ..."
mdbook build
else
Expand Down
2 changes: 0 additions & 2 deletions res/README.md

This file was deleted.

92 changes: 0 additions & 92 deletions res/build.sh

This file was deleted.

Loading
Loading