Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

152.9. convertlit-1.8

clit, which unpacks and converts Microsoft Reader (.lit) ebooks to OEB

Version 1.8, release 1
Shelf documents — PDF, PostScript, DjVu, EPUB, CHM and DOCX viewers, libraries and tools, and ebook managers
Phase 41_system (System), 420 of 1047 in build order
Licence GPL-2.0-or-later
Homepage http://www.convertlit.com/
Build time 0.1 SBU
Installed size 149.0 KiB in 2 files
Recipe ports/core/documents/convertlit/kpkgbuild

About

ConvertLIT’s clit unpacks Microsoft Reader .lit ebooks into their OEB form, an .opf package with its HTML, images and metadata, which other ebook tools can read or convert further. It also opens DRM-protected files when given the private keys of a Reader activation in a keys.txt. The source is a zip of two directories, lib/, the LIT-reading library, and clit18/, the program, and the port compiles both by hand with the tree’s flags. ebook-tools depends on it: its lit2epub script runs clit.

Sources

Dependencies

Depends on: unzip, libtommath.

Required by (1): ebook-tools.

Patches

build.sh applies these; kpkg applies nothing by itself.

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/41_system/phase.env && kpkg install convertlit'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/documents/convertlit.

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/documents/convertlit
echo 'd70a85f5b945104340d56f48ec17bcf544e3bb3c35b1b3d58d230be699e557ba  convertlit-1.8.zip' | sha256sum -c -
echo 'd14601572e16ba3472c3373b5856eb30281b997b012763100d247bd15a6b3b7e  bounds.patch' | 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/convertlit
SRC=$SRC_ROOT/convertlit-1.8
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
cp convertlit-1.8.zip "$SRC"

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 recipe’s helpers _ver and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

unzip -q -o convertlit-$version.zip
patch -p1 -i "$PORT_SRC/bounds.patch"

cd lib
${CC:-cc} $CFLAGS -funsigned-char -Ilzx -I. -c litsections.c
${CC:-cc} $CFLAGS -funsigned-char -include string.h -Inewlzx -I. -c newlzx/lzxglue.c
${CC:-cc} $CFLAGS -funsigned-char -Ides -Isha -Inewlzx -I. -c \
	litatom.c litdrm.c litlib.c litembiggen.c littags.c litmetatags.c \
	litmanifest.c litdirectory.c litheaders.c litutil.c \
	sha/mssha1.c des/des.c newlzx/lzxd.c
cd ../clit$_ver
${CC:-cc} $CFLAGS $LDFLAGS -funsigned-char -include string.h -include ctype.h -include sys/stat.h -I../lib -I../lib/des -I. -o clit \
	clit.c hexdump.c drm5.c explode.c transmute.c display.c utils.c manifest.c \
	../lib/*.o -ltommath

install -Dm755 clit $PKG/usr/bin/clit

install -Dm644 "$SRC/clit$_ver/COPYING" "$PKG/usr/share/licenses/$name/COPYING"

The switches, and why each is set:

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/convertlit, 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 convertlit-1.8-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/convertlit, and runs the triggers its paths call for.

Contents

Installed programs: clit.

Installed directories: /usr/share/licenses/convertlit.

Notes

The recipe does not run upstream’s makefiles: they name gcc, set their own CFLAGS and link against the ../libtommath-0.30 tree. build.sh compiles the same files with $CC, $CFLAGS and $LDFLAGS instead, and links the program against the library’s objects directly rather than through upstream’s openclit.a archive. bounds.patch has its own sha256 = line in the recipe, like a source.