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

308.2. librecad-2.2.1.5

2D CAD drafting with DXF and DWG import (Qt 5)

Version 2.2.1.5, release 2
Shelf cad — Mechanical, architectural and 2D CAD, geometry kernels, meshing and FEM
Phase 44_apps (Applications), 23 of 422 in build order
Licence GPL-2.0-only
Homepage https://librecad.org/
Build time 4.8 SBU
Installed size 66.7 MiB in 1411 files
Recipe ports/core/cad/librecad/kpkgbuild

About

LibreCAD is a 2D CAD program for drafting: plans, technical drawings and parts drawn with lines, arcs, dimensions, hatches and blocks on layers, saved natively as DXF and able to import DWG. It is a Qt 5 application, and the port also installs ttf2lff, the tool that converts a TrueType face into LibreCAD’s own LFF stroke-font format.

Sources

Dependencies

Depends on: cmake, ninja, boost, freetype2, qt5-qtbase, qt5-qtsvg, qt5-qttools, qt5-qtwayland.

Required by: no port names it.

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/44_apps/phase.env && kpkg install librecad'

What kpkg does

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

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/cad/librecad
echo '703f6e6701b7ee47769b6def271fa025ef32e31ee193e2ba69a2c47fff8da459  librecad-2.2.1.5.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/librecad
SRC=$SRC_ROOT/librecad-2.2.1.5
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf librecad-2.2.1.5.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/no-execinfo.patch"

mkdir -p build && cd build
cmake .. -G Ninja -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr
ninja
DESTDIR=$PKG ninja install
cd ..

install -d "$PKG/usr/lib/librecad"
mv "$PKG/usr/bin/resources/plugins" "$PKG/usr/lib/librecad/plugins"
rmdir "$PKG/usr/bin/resources"
install -d "$PKG/usr/share/librecad"
cp -r librecad/support/fonts librecad/support/patterns librecad/support/library \
	"$PKG/usr/share/librecad/"
chmod -R u=rwX,go=rX "$PKG/usr/share/librecad"

install -Dm644 desktop/librecad.1 "$PKG/usr/share/man/man1/librecad.1"
install -Dm644 librecad/res/main/librecad.png \
	"$PKG/usr/share/icons/hicolor/128x128/apps/librecad.png"
install -Dm644 desktop/org.librecad.librecad.appdata.xml \
	"$PKG/usr/share/metainfo/org.librecad.librecad.appdata.xml"

install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/librecad.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=LibreCAD
GenericName=2D CAD
Comment=Draft 2D drawings and plans in DXF
Exec=librecad %F
Icon=librecad
Terminal=false
StartupWMClass=librecad
MimeType=image/vnd.dxf;
Categories=Graphics;VectorGraphics;Engineering;Qt;
Keywords=cad;2d;drafting;drawing;dxf;dwg;plan;librecad;
DESKTOP
chmod 644 "$PKG/usr/share/applications/librecad.desktop"

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/librecad, 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 librecad-2.2.1.5-2.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/librecad, and runs the triggers its paths call for.

Contents

Installed programs: librecad, ttf2lff.

Installed directories: /usr/lib/librecad, /usr/share/librecad, /usr/share/licenses/librecad.

Short descriptions

librecad A professional CAD System.

Notes

Upstream’s install() rules put the plugins in bin/resources/plugins, beside the executable, and install none of the support data. build.sh moves the plugins to /usr/lib/librecad/plugins and copies the fonts, hatch patterns and part library from librecad/support/ to /usr/share/librecad. Both are directories LibreCAD searches relative to its executable (../lib/librecad/plugins and ../share/librecad/<kind>, in RS_System::getDirectoryList), so nothing is left under /usr/bin but the two programs.

The manual page, the icon and the AppStream file are installed from the source by hand, because the CMake build installs none of them, and build.sh writes the desktop entry.