63.1. asciidoctor-2.0.26
AsciiDoc processor in Ruby — HTML, DocBook and manual pages from .adoc
| Version | 2.0.26, release 1 |
| Shelf | doctools — Documentation toolchains, man pages, markup converters and TeX typesetting |
| Phase | 31_compilers (Compilers), 15 of 22 in build order |
| Licence | MIT |
| Homepage | https://asciidoctor.org/ |
| Build time | 0.1 SBU |
| Installed size | 1.0 MiB in 102 files |
| Recipe | ports/core/doctools/asciidoctor/kpkgbuild |
About
Asciidoctor converts AsciiDoc text into HTML, DocBook and manual pages. It is a Ruby program, installed as a gem. In KDOS its use is at build time: ports whose manual pages are written in AsciiDoc generate them with it, and the ports that name it in depends include perf, bpftrace, wireshark, weechat, newsboat, git-lfs, keepassxc and ccache-manual. A build that looks for asciidoctor on PATH uses it whenever it is there, so Manual pages has every port whose pages come from it name it in depends.
Sources
asciidoctor-2.0.26.tar.gz(1.6 MiB)
sha25625c22b934bc0ae2448f2d73d4b2eba0c59e0521cf5e893fb0b0ad54a461bf066
upstream: https://github.com/asciidoctor/asciidoctor/archive/refs/tags/v2.0.26.tar.gz
archive copy: sources-1/doctools--asciidoctor-2.0.26.tar.gz
Dependencies
Depends on: ruby.
Required by (15): bpftrace, ccache-manual, git-lfs, keepassxc, ndctl, newsboat, nheko, nng, perf, tesseract, timewarrior, warzone2100, weechat, wireshark, wsjtx.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/31_compilers/phase.env && kpkg install asciidoctor'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/doctools/asciidoctor.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/doctools/asciidoctor
echo '25c22b934bc0ae2448f2d73d4b2eba0c59e0521cf5e893fb0b0ad54a461bf066 asciidoctor-2.0.26.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/asciidoctor
SRC=$SRC_ROOT/asciidoctor-2.0.26
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf asciidoctor-2.0.26.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
GIT_DIR="$SRC/.no-git" gem build asciidoctor.gemspec
_gemdir=$(ruby -e 'print Gem.default_dir')
gem install \
--local \
--ignore-dependencies \
--no-user-install \
--no-document \
--install-dir "$PKG$_gemdir" \
--bindir "$PKG/usr/bin" \
"$name-$version.gem"
rm -rf "$PKG$_gemdir/cache"
install -Dm644 man/asciidoctor.1 -t "$PKG/usr/share/man/man1"
The switches, and why each is set:
GIT_DIR— set to a directory that does not exist whilegem buildruns. The gemspec lists the gem’s files withgit ls-filesand falls back to every file in the tree only when that prints nothing. Run from inside a Git checkout,git ls-filesanswers for that checkout rather than for the unpacked source; withGIT_DIRpointing nowhere it prints nothing wherever the build directory sits, and the gem’s file list comes from the unpacked tree.--local— install the.gemfile just built, and never contact a gem server.--ignore-dependencies— install without resolving any other gem; asciidoctor declares no runtime dependencies, so this skips a lookup that would find none.--no-user-install— install into the given directory, not a per-user gem directory under$HOME.--no-document— generate no rdoc or ri documentation for the gem.--install-dir— the gem repository to install into:$PKGfollowed by Ruby’s default gem directory, whichruby -e 'print Gem.default_dir'prints, so the installed gem lands where the system’srubylooks for gems.--bindir— where theasciidoctorcommand goes:$PKG/usr/bin. rubygems writes a small Ruby stub there that loads the gem.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/asciidoctor, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf asciidoctor-2.0.26-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/asciidoctor, and runs the triggers its paths call for.
Contents
Installed programs: asciidoctor.
Installed directories: /usr/lib/ruby/gems/4.0.0/gems/asciidoctor-2.0.26, /usr/share/licenses/asciidoctor.
Short descriptions
asciidoctor |
converts AsciiDoc source files to HTML, DocBook, and other formats |
Notes
The gem is built from the source tree and installed from that file, rather than by copying lib/ into place, so that it is a real installed gem: gem list shows it and the asciidoctor command is rubygems’ own stub. build.sh then deletes the gem repository’s cache/ directory, which would hold a second copy of the gem as a .gem archive, and installs the manual page from man/, which gem install leaves inside the gem.