309.5. bcnc-0.9.16
GRBL CNC controller and G-code sender with an editor, probing, auto-levelling and CAM tools (Tk)
| Version | 0.9.16, release 2 |
| Shelf | fabrication — 3D-printing slicers and hosts, and CNC control |
| Phase | 44_apps (Applications), 126 of 422 in build order |
| Licence | GPL-2.0-only |
| Homepage | https://github.com/vlachoudis/bCNC |
| Build time | 0.3 SBU |
| Installed size | 6.4 MiB in 544 files |
| Recipe | ports/core/fabrication/bcnc/kpkgbuild |
About
bCNC is a controller and G-code sender for CNC machines running GRBL firmware, written in Python with a Tk interface: it streams G-code over a serial port and adds an editor, probing, auto-levelling and simple CAM tools. Tk draws through X11, so the window runs under Xwayland.
Sources
bcnc-0.9.16.tar.gz(1.3 MiB)
sha256a87929a050f8adf2fae6a441e95461c2233d97f74de967bbf3a3c12e77b2bcf5
upstream: https://files.pythonhosted.org/packages/source/b/bcnc/bcnc-0.9.16.tar.gz
archive copy: sources-2/fabrication--bcnc-0.9.16.tar.gzbcnc-vendor-0.9.16.tar.xz(170.7 KiB)
sha2569a953c1a2c2dc3282b0b66f074c6583c88324f50074a4eeddc7cac7b8513b1d3
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-2/fabrication--bcnc-vendor-0.9.16.tar.xz
Dependencies
Depends on: python3, python3-pip, python3-setuptools, python3-wheel, python3-tkinter, tk, numpy, python3-pillow, python3-pyserial, opencv.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
no-update-check.patch— Shipscheckinterval = 0inbCNC.ini, and moves the test for an interval of 0 ahead of the test for a first start inneed2Check(). Upstream’s update reminder asksapi.github.comfor the latest release, and on a first start it asks whatever the interval is; with the patch an interval of 0 means never.tk9-trace-add.patch— Use trace_add("write") instead of the trace("w") API Tk 9 removedwm-class.patch— Creates the Tk application with the class namebCNCinstead of upstream’s name padded with two spaces on each side, which no desktop entry can name; unpadded, the window’s class matchesStartupWMClass=bCNC.
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 bcnc'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/fabrication/bcnc.
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/fabrication/bcnc
echo 'a87929a050f8adf2fae6a441e95461c2233d97f74de967bbf3a3c12e77b2bcf5 bcnc-0.9.16.tar.gz' | sha256sum -c -
echo '9a953c1a2c2dc3282b0b66f074c6583c88324f50074a4eeddc7cac7b8513b1d3 bcnc-vendor-0.9.16.tar.xz' | 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/bcnc
SRC=$SRC_ROOT/bcnc-0.9.16
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf bcnc-0.9.16.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-update-check.patch"
patch -p1 -i "$PORT_SRC/wm-class.patch"
patch -p1 -i "$PORT_SRC/tk9-trace-add.patch"
mkdir -p vendor
tar -xf "$PORT_SRC/$name-vendor-$version.tar.xz" --strip-components=1 -C vendor
pip3 install --ignore-installed --no-deps --no-index --find-links=vendor --no-build-isolation \
--root="$PKG" --prefix=/usr svgelements shxparser
pip3 install --ignore-installed --no-deps --no-index --no-build-isolation --root="$PKG" --prefix=/usr .
_site=$(python3 -c 'import sysconfig; print(sysconfig.get_path("purelib"))')
find "$PKG$_site/bCNC/locales" -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} +
ln -s bCNC "$PKG/usr/bin/bcnc"
install -d "$PKG/usr/share/icons/hicolor/128x128/apps"
python3 -c 'import sys; from PIL import Image; Image.open(sys.argv[1]).convert("RGBA").resize((128, 128), Image.LANCZOS).save(sys.argv[2])' \
bCNC/bCNC.png "$PKG/usr/share/icons/hicolor/128x128/apps/bcnc.png"
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/bcnc.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=bCNC
GenericName=CNC Controller
Comment=Send, edit and probe G-code on a GRBL CNC machine
Exec=bCNC
Icon=bcnc
Terminal=false
StartupWMClass=bCNC
Categories=Science;Electronics;Engineering;
Keywords=cnc;grbl;gcode;g-code;mill;pcb;probe;autolevel;sender;
DESKTOP
chmod 644 "$PKG/usr/share/applications/bcnc.desktop"
The switches, and why each is set:
--no-deps— With--no-index,--find-links=vendorand--no-build-isolation, in the firstpip3 install: svgelements and shxparser are installed from the unpacked vendor bundle alone, with the tree’s own setuptools and wheel as build backend, resolving nothing. The secondpip3 installinstalls bCNC itself from.the same way, without--find-links, since every other module bCNC needs is a port.--ignore-installed— Installs into$PKGeven when the build root already holds a copy, so the package always carries the vendored modules and bCNC.
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/bcnc, 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 bcnc-0.9.16-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/bcnc, and runs the triggers its paths call for.
Contents
Installed programs: bCNC, bcnc.
Installed directories: /usr/lib/python3.14/site-packages/bCNC, /usr/lib/python3.14/site-packages/bcnc-0.9.16.dist-info, /usr/lib/python3.14/site-packages/shxparser, /usr/lib/python3.14/site-packages/shxparser-0.0.2.dist-info, /usr/lib/python3.14/site-packages/svgelements, /usr/lib/python3.14/site-packages/svgelements-1.9.6.dist-info, /usr/lib/python3.14/site-packages/test, /usr/lib/python3.14/site-packages/tests, /usr/share/licenses/bcnc.
Notes
svgelements and shxparser, which bCNC’s setup.py requires and nothing else in the tree uses, are vendored: they are named at their versions in pypackages in kpkgbuild, and ports/fetch packs their source distributions into bcnc-vendor-<version>.tar.xz, pinned by its sha256 (see Vendoring). numpy, Pillow, pyserial and OpenCV are ports in depends.
build.sh removes every language directory under bCNC/locales, so the interface is English; kpkg’s English-only rule removes only the .mo catalogs in them and would leave the .po sources (see Size and language policy).
bCNC’s only icon is 204 pixels square, which is no hicolor size, so build.sh scales it to 128 pixels with python3-pillow. /usr/bin/bcnc is a symbolic link to upstream’s bCNC command.