69.7. discount-3.0.2.0
Markdown to HTML library and converter — libmarkdown and markdown
| Version | 3.0.2.0, release 1 |
| Shelf | doctools — Documentation toolchains, man pages, markup converters and TeX typesetting |
| Phase | 40_lang (Languages), 42 of 186 in build order |
| Licence | BSD-3-Clause |
| Homepage | https://www.pell.portland.or.us/~orc/Code/discount/ |
| Build time | 0.1 SBU |
| Installed size | 180.3 KiB in 26 files |
| Recipe | ports/core/doctools/discount/kpkgbuild |
About
Discount is a Markdown implementation in C: libmarkdown, a library that turns Markdown into HTML, and the markdown command built on it. okular’s Markdown generator, labplot and kdepim-addons link the library.
Sources
discount-3.0.2.0.tar.gz(140.9 KiB)
sha25699f6db36d3fff6c99acd21d4c6096176d4ac8785eab319d0faf77ad995b8b7c5
upstream: https://github.com/Orc/discount/archive/v3.0.2.0.tar.gz
archive copy: sources-1/doctools--discount-3.0.2.0.tar.gz
Dependencies
Depends on: nothing a recipe names.
Required by (3): kdepim-addons, labplot, okular.
Patches
build.sh applies these; kpkg applies nothing by itself.
install-data-mode.patch— Changes the mode ofINSTALL_DATAinconfigure.incfrom444to644. The headermkdio.h,libmarkdown.pcand the manual pages are installed with it, so they are installed writable by their owner (rw-r--r--) instead of read-only for everyone (r--r--r--).
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/40_lang/phase.env && kpkg install discount'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/doctools/discount.
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/discount
echo '99f6db36d3fff6c99acd21d4c6096176d4ac8785eab319d0faf77ad995b8b7c5 discount-3.0.2.0.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/discount
SRC=$SRC_ROOT/discount-3.0.2.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf discount-3.0.2.0.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:
patch -p1 -i "$PORT_SRC/install-data-mode.patch"
./configure.sh --prefix=/usr --libdir=/usr/lib --mandir=/usr/share/man \
--shared \
--pkg-config \
--container
make
make DESTDIR=$PKG install install.man
The switches, and why each is set:
--shared— Buildlibmarkdownas a shared library. The script’s default is a static one.--pkg-config— Installlibmarkdown.pc, through which the library’s consumers find it.--container— Do not runldconfigon the installed library. The install script it writes otherwise runs it against the library directory.
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/discount, 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 discount-3.0.2.0-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/discount, and runs the triggers its paths call for.
Contents
Installed programs: markdown.
Installed libraries: libmarkdown.so.
Installed directories: /usr/share/licenses/discount.
Short descriptions
markdown |
text to html conversion tool |
libmarkdown.pc |
C implementation of John Gruber's Markdown markup language |
Notes
configure.sh is Discount’s own configuration script, not one generated by autoconf. It takes --prefix, --libdir and --mandir as autoconf’s do, and switches of its own for the rest, which ./configure.sh --help lists.