308.3. qcad-3.33.1.0
2D CAD with DXF, script add-ons and a large part library (community edition, Qt 6)
| Version | 3.33.1.0, release 2 |
| Shelf | cad — Mechanical, architectural and 2D CAD, geometry kernels, meshing and FEM |
| Phase | 44_apps (Applications), 24 of 422 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://qcad.org/ |
| Build time | 165.4 SBU |
| Installed size | 137.3 MiB in 617 files |
| Recipe | ports/core/cad/qcad/kpkgbuild |
About
QCAD is a 2D CAD program for technical drawings, plans and parts, working in DXF. DWG import and export belong to the proprietary QCAD Professional and are not in this build. Most of its interface and tools are written in ECMAScript, run by QJSEngine from Qt 6’s QML module through two bindings layers released beside it, qtjsapi and qcadjsapi; the port builds the community edition with all three, which is why the recipe has three sources at one version.
Sources
qcad-3.33.1.0.tar.gz(55.5 MiB)
sha256cbb519f089bbf1e588b15e10e33d8894e16dc2cabab6efa7d54cb1ea422d8db6
upstream: https://github.com/qcad/qcad/archive/refs/tags/v3.33.1.0.tar.gz
archive copy: sources-1/cad--qcad-3.33.1.0.tar.gzqtjsapi-3.33.1.0.tar.gz(3.5 MiB)
sha2561e75a6d71a160f057b00a1e0d820b61a7b167654cde9c4a09927363d60e7f279
upstream: https://github.com/qcad/qtjsapi/archive/refs/tags/v3.33.1.0.tar.gz
archive copy: sources-1/cad--qtjsapi-3.33.1.0.tar.gzqcadjsapi-3.33.1.0.tar.gz(3.3 MiB)
sha256be280d868611c9c3f2d09573a4bf3bfddd83a32978eda60a3b2c4e81384223c1
upstream: https://github.com/qcad/qcadjsapi/archive/refs/tags/v3.33.1.0.tar.gz
archive copy: sources-1/cad--qcadjsapi-3.33.1.0.tar.gz
Dependencies
Depends on: cmake, ninja, bash, qt6-qtbase, qt6-qtsvg, qt6-qtdeclarative, qt6-qttools, qt6-qt5compat, qt6-qtpositioning, qt6-qtlocation, qt6-qtwayland, mesa, libglvnd.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
musl-fcloseall.patch— in the bundled openNURBS (src/3rdparty/opennurbs/opennurbs_defines.cpp),ON::CloseAllFiles()returnsEOFon a Linux C library that is not glibc, the branch upstream already takes on macOS, Android and WebAssembly.fcloseall()is a GNU extension that musl does not declare, so the unpatched call does not compile.no-execinfo.patch— insrc/core/RDebug.cpp, the<execinfo.h>include and the body ofRDebug::printBacktrace()are compiled only when__has_include(<execinfo.h>)holds. musl has no such header, so on KDOS the function prints nothing.
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 qcad'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/cad/qcad.
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/qcad
echo 'cbb519f089bbf1e588b15e10e33d8894e16dc2cabab6efa7d54cb1ea422d8db6 qcad-3.33.1.0.tar.gz' | sha256sum -c -
echo '1e75a6d71a160f057b00a1e0d820b61a7b167654cde9c4a09927363d60e7f279 qtjsapi-3.33.1.0.tar.gz' | sha256sum -c -
echo 'be280d868611c9c3f2d09573a4bf3bfddd83a32978eda60a3b2c4e81384223c1 qcadjsapi-3.33.1.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/qcad
SRC=$SRC_ROOT/qcad-3.33.1.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf qcad-3.33.1.0.tar.gz -C "$SRC" --strip-components=1
tar --no-same-permissions --warning=no-unknown-keyword -xf qtjsapi-3.33.1.0.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf qcadjsapi-3.33.1.0.tar.gz -C "$SRC_ROOT"
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:
ln -s "$SRC" "$SRC_ROOT/qcad"
ln -s "$SRC_ROOT/qtjsapi-$version" "$SRC_ROOT/qtjsapi"
patch -p1 -i "$PORT_SRC/musl-fcloseall.patch"
patch -p1 -i "$PORT_SRC/no-execinfo.patch"
cmake -S . -B build -G Ninja -Wno-dev -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SKIP_RPATH=ON \
-DBUILD_QT6=ON
ninja -C build
for p in qtjsapi qcadjsapi; do
cmake -S "$SRC_ROOT/$p-$version" -B "$SRC_ROOT/$p-build" -G Ninja -Wno-dev \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SKIP_RPATH=ON
ninja -C "$SRC_ROOT/$p-build"
done
_dest="$PKG/usr/lib/qcad"
install -d "$_dest/plugins"
install -m755 release/qcad-bin "$_dest/qcad-bin"
cp -P release/lib*.so* "$_dest/"
cp -P plugins/lib*.so* "$_dest/plugins/"
cp -r fonts patterns linetypes libraries themes examples "$_dest/"
chmod -R u=rwX,go=rX "$_dest"
rm -rf "$_dest/fonts/qt"
install -d "$PKG/usr/bin"
cat > "$PKG/usr/bin/qcad" <<'KDOS_SH'
#!/bin/sh
LD_LIBRARY_PATH=/usr/lib/qcad${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} \
exec /usr/lib/qcad/qcad-bin "$@"
KDOS_SH
chmod 755 "$PKG/usr/bin/qcad"
install -Dm644 qcad.1 "$PKG/usr/share/man/man1/qcad.1"
install -Dm644 scripts/org.qcad.QCAD.png \
"$PKG/usr/share/icons/hicolor/256x256/apps/org.qcad.QCAD.png"
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/org.QCAD.qcad-bin.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=QCAD
GenericName=2D CAD
Comment=Technical 2D drawings, plans and parts in DXF
Exec=qcad %F
Icon=org.qcad.QCAD
Terminal=false
StartupWMClass=org.QCAD.qcad-bin
Categories=Graphics;VectorGraphics;Engineering;Qt;
Keywords=cad;2d;drafting;drawing;dxf;dwg;plan;qcad;
DESKTOP
chmod 644 "$PKG/usr/share/applications/org.QCAD.qcad-bin.desktop"
The switches, and why each is set:
-DBUILD_QT6=ON— build against Qt 6. It is upstream’s default, named because the main tree’sCMakeInclude.txtselects Qt 5 when it is off, while both bindings layers find Qt 6 unconditionally.-DCMAKE_SKIP_RPATH=ON— write no RPATH into any binary.build.shcopies the program and its libraries straight out of the build directories, with no install step to rewrite them, so CMake’s build-tree RPATH would ship pointing into the work directory, which the package lint refuses. The libraries are found through the wrapper described below instead.
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/qcad, 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 qcad-3.33.1.0-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/qcad, and runs the triggers its paths call for.
Contents
Installed programs: qcad.
Installed directories: /usr/lib/qcad, /usr/share/licenses/qcad.
Short descriptions
qcad |
A feature-rich drafting application |
Notes
The two bindings layers are separate CMake projects that find the main tree by relative path, ../qcad, and write their libraries back into it: qtjsapi into release/ and qcadjsapi into plugins/. qcadjsapi also reads ../qcad/CMakeInclude.txt and the headers under ../qcad/src and ../qtjsapi. kpkg unpacks the three sources beside each other as qcad-<version>, qtjsapi-<version> and qcadjsapi-<version>, so build.sh first makes the symbolic links qcad and qtjsapi in $SRC_ROOT that those paths name. The order matters: qcadjsapi links the main tree’s libraries (qcadcore, qcadgui and the rest) and qtjsapi’s, so it is built after both.
Without the two layers QCAD starts with no menus, since its menus and tools are scripts.
The scripts are compiled into the qcadscripts plugin as Qt resources; the .qrc lists are regenerated at build time by src/scripts/update_qrc.sh, a bash script, which is why bash is in depends.
Everything is installed under /usr/lib/qcad as upstream lays out a run-in-place tree: qcad-bin, its libraries, plugins/, and the fonts, patterns, line types, part libraries, themes and examples it reads relative to itself. /usr/bin/qcad is a small wrapper that puts /usr/lib/qcad on LD_LIBRARY_PATH and runs qcad-bin. fonts/qt is removed: DejaVu and Bitstream Vera TrueType faces, Type 1 faces (Utopia, Charter, Courier, Luxi) and Qt’s prerendered QPF fonts, which QCAD’s --help text names as a QT_QPA_FONTDIR for running it in a server environment. Nothing in the program loads it by itself, and on the desktop Qt finds fonts through fontconfig. QCAD’s own CXF stroke fonts in fonts/ stay.
The desktop entry is build.sh’s own, named org.QCAD.qcad-bin.desktop after the window’s Wayland app id. QCAD sets no desktop file name, so Qt makes the app id from its organisation domain, QCAD.org, reversed, and the executable’s name, qcad-bin; KWin finds a Wayland window’s icon only in the entry whose file name is that app id. The icon keeps upstream’s name, org.qcad.QCAD.
The first-start dialog, which asks for the language, units and paper size, has a fixed-height layout: at the system font’s metrics its last line (“…later in the Preferences Dialog”) is cut off. The settings it offers are all in Edit > Application Preferences.