Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,8 @@ verify-payload:
verify-raster-drivers:
tests/standalone-raster-drivers.sh

verify-packaged-drivers:
tests/packaged-drivers.sh

verify-cups-patch-chain:
tests/cups-patch-chain.sh
11 changes: 10 additions & 1 deletion docs/skills/fsdk-cups-patching.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: fsdk-cups-patching
description: Use when changing the freedesktop-sdk junction, CUPS build configuration, CUPS backends, or CUPS source patches for the OCI appliance.
description: Use when changing the freedesktop-sdk junction, CUPS or cups-filters build configuration, Ghostscript compression ownership, CUPS backends, filters, or print-stack source patches for the OCI appliance.
metadata:
context7-sources:
- /apache/buildstream
Expand All @@ -13,6 +13,7 @@ metadata:
- Changing the pinned freedesktop-sdk junction.
- Changing CUPS TLS configuration, backends, filters, or source patches.
- Diagnosing CUPS graph or source-staging failures in the OCI build.
- Changing FSDK-owned cups-filters or Ghostscript behavior required by a legacy driver.

## When NOT to Use

Expand All @@ -33,6 +34,10 @@ metadata:
9. Match FSDK's multiarch install layout for every repository-built library. Define `gcc-triplet`, `lib`, and `libdir` in the root project and pass `--libdir=%{libdir}` to Autotools; FSDK's `pkg-config` searches `/usr/lib/<gcc-triplet>/pkgconfig`, not `/usr/lib/pkgconfig`.
10. Do not `chown` high numeric runtime IDs inside the BuildStream sandbox; user-namespace mappings can reject them with `EINVAL`. After composition, reapply writable directory modes in the final OCI layer. Remove inherited `/run` service directories and let the numeric runtime user recreate them so ownership checks observe the actual user.
11. Avahi's `--no-drop-root` still resolves its compiled `AVAHI_USER`/`AVAHI_GROUP` and requires its runtime directory to have those numeric IDs. Configure FSDK's Avahi build with `--with-avahi-user=nonroot --with-avahi-group=nonroot`; never create a second passwd/group name with UID/GID `65532`. Remove D-Bus's `<user>` directive so it does not attempt a second privilege drop, and patch Avahi policy at `/etc/dbus-1/system.d/avahi-dbus.conf`.
12. Install repository-built CUPS filters into `/usr/lib/cups/filter`. The appliance exposes `/usr/lib/ghostscript-printer-app` as a symlink to `/usr/lib/cups`; creating a real `/usr/lib/ghostscript-printer-app/filter` directory in another artifact conflicts with that symlink during composition.
13. Stage component-specific source patches in separate junction directories. `patches/cups-filters/` is injected into FSDK's existing `components/cups-filters.bst`; never mix it with CUPS or libcupsfilters patches.
14. Keep Ghostscript on its bundled zlib. FSDK's zlib-ng compatibility library corrupts compiled Ghostscript ROMFS reads when a full-size IJS page lazily loads an ICC profile; the failure appears as `free(): invalid size` from `s_block_read_process`. A default Letter pxljr conversion is the regression probe.
15. Treat filter executables by format: use `ldd` only for ELF binaries, and resolve script shebangs plus every invoked command separately. Generated pyppd archives use `#!/usr/bin/env python3`, so each owning element declares the Python runtime even when another aggregate currently supplies it.

## Common Rationalizations

Expand All @@ -57,6 +62,10 @@ metadata:
- Pre-creating Avahi's runtime directory as root; Avahi verifies it belongs to its compiled service UID even with `--no-drop-root`.
- Giving `avahi` and `nonroot` the same UID/GID; numeric-to-name lookup becomes ambiguous and can hide a broken OCI identity.
- Editing `/usr/share/dbus-1/system.d/avahi-dbus.conf`; the FSDK runtime installs that policy under `/etc/dbus-1/system.d/`.
- Installing a driver artifact beneath `/usr/lib/ghostscript-printer-app/filter`; the canonical artifact path is `/usr/lib/cups/filter`, reached at runtime through the application symlink.
- Running `ldd` on shell or Python filters; `not a dynamic executable` is not an ELF closure result.
- Letting aggregate composition mask an undeclared pyppd Python runtime or shell-filter command dependency.
- Building Ghostscript against FSDK's zlib-ng compatibility library when the appliance ships an IJS driver.

## Verification

Expand Down
36 changes: 36 additions & 0 deletions docs/superpowers/plans/2026-09-16-fsdk-packaged-cups-drivers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# FSDK Packaged CUPS Drivers Implementation Plan

**Goal:** Restore c2esp, Dymo, fxlinuxprint, Oki, pxljr, rastertosag-gdi, SpliX, brlaser, and P-Touch with discoverable driver data and executable conversion paths.

**Architecture:** One pinned element per source package. Elements install filters under `/usr/lib/cups/filter` and either pyppd archives or `.drv` descriptions under `/usr/share/ppd`. FSDK remains the sole CUPS/libcupsfilters/libppd owner. Minimal IJS/JBIG helper artifacts are allowed only where FSDK exposes no usable artifact. Shared runtime composition and verification stay centralized.

## Task 1: Build immutable driver artifacts

- [x] Add c2esp at `90a09ca4927fca5e1ae08307cd3ca9c0f0ca5b5b`, apply and execute the existing libcupsfilters2 patch.
- [x] Add Dymo at `e69dceba792dc23d2894d57b0468009e52109625` and generate `dymo-ppds`.
- [x] Add fxlinuxprint at `3e640d5cf2881b01b6dab16e7d899290e61b0417` and generate `fxlinuxprint-ppds`.
- [x] Add Oki at `9f48d5a6c5938126a5aa91a902668aa877c3c22b`, replacing confinement paths with real OCI paths, and generate `oki-ppds`.
- [x] Add pxljr at `6b0dafe66965e5fa398733c04160bd6436d13254`, including the minimal IJS dependency and 3500/3550/3600 PPD archive.
- [x] Add rastertosag-gdi at `6f4028f36f015692a602077b7060438d0bf9f634` and generate its PPD archive.
- [x] Add SpliX at `505f24d43fdb86eaa41a44486e7ef88226bb2c0c`, including the minimal JBIG dependency, QPDL filters, and PPD archive.
- [x] Add brlaser at `23117fe9e0266396e4791cdae84d979928aed135` with its filter and `.drv` description.
- [x] Add P-Touch at `ccfa92351be3ce601f212048b174147a5496d8be` and generate only its Foomatic PPD archive.

## Task 2: Compose runtime and prove discovery

- [x] Add all driver artifacts to `core-stack.bst`; keep toolchains, source databases, and generators build-only.
- [x] Add an image-level `verify-packaged-drivers` command that checks filters, helper executables/libraries, PPD archives/descriptions, and complete ELF/interpreter closure.
- [x] Start the real appliance and require representative driver names from every family in the Printer Application driver list.

## Task 3: Exercise conversion families

- [x] Run c2esp's FSDK libcupsfilters2 path and require printer-language output.
- [x] Exercise representative raster filters for Dymo, pxljr, SpliX, brlaser, and P-Touch with valid deterministic raster/input fixtures.
- [x] Exercise shell/script families for Oki, fxlinuxprint, and rastertosag-gdi with inherited runtime paths and TMPDIR.
- [x] Require stable protocol signatures and repeatable output digests; a successful process with empty output fails.

## Task 4: Verify and publish

- [x] Run `just validate`, prior slice gates, `just verify-packaged-drivers`, workflow lint, shell syntax checks, and `git diff --check`.
- [x] Review the full diff from `feat/fsdk-raster-drivers`.
- [x] Resolve issue 05, commit the completed plan, push `feat/fsdk-packaged-drivers`, and open a stacked PR based on `feat/fsdk-raster-drivers`.
3 changes: 3 additions & 0 deletions elements/freedesktop-sdk.bst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ sources:
- kind: local
path: patches/libcupsfilters
directory: patches/ghostscript-printer-app/libcupsfilters
- kind: local
path: patches/cups-filters
directory: patches/ghostscript-printer-app/cups-filters
- kind: patch_queue
path: patches/freedesktop-sdk

Expand Down
24 changes: 24 additions & 0 deletions elements/printer-app/brlaser.bst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
kind: manual
description: Build the brlaser Brother laser raster filter.

sources:
- kind: git_repo
url: github:pdewacht/brlaser.git
track: v6
ref: v6-0-g23117fe9e0266396e4791cdae84d979928aed135

build-depends:
- freedesktop-sdk.bst:public-stacks/buildsystem-cmake.bst
- freedesktop-sdk.bst:public-stacks/buildsystem-make.bst

depends:
- freedesktop-sdk.bst:components/cups.bst
- freedesktop-sdk.bst:components/cups-filters.bst

config:
build-commands:
- cmake -S . -B build -DCMAKE_POLICY_VERSION_MINIMUM=3.5
- cmake --build build --target rastertobrlaser -j2
install-commands:
- install -D -m 0755 build/rastertobrlaser "%{install-root}/usr/lib/cups/filter/rastertobrlaser"
- install -D -m 0644 build/brlaser.drv "%{install-root}/usr/share/ppd/brlaser.drv"
37 changes: 37 additions & 0 deletions elements/printer-app/c2esp.bst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
kind: manual
description: Build the c2esp Kodak raster filters and driver descriptions.

sources:
- kind: git_repo
url: salsa:printing-team/c2esp.git
track: debian/27-11
ref: debian/27-11-0-g90a09ca4927fca5e1ae08307cd3ca9c0f0ca5b5b
- kind: local
path: patches/c2esp-libcupsfilters2-api.patch
directory: patches

build-depends:
- freedesktop-sdk.bst:public-stacks/buildsystem-autotools.bst
- freedesktop-sdk.bst:components/patch.bst

depends:
- printer-app/jbigkit.bst
- freedesktop-sdk.bst:components/cups.bst
- freedesktop-sdk.bst:components/libcupsfilters.bst
- freedesktop-sdk.bst:components/libppd.bst
- freedesktop-sdk.bst:components/cups-filters.bst
- freedesktop-sdk.bst:components/zlib.bst

config:
build-commands:
- patch -p1 < patches/c2esp-libcupsfilters2-api.patch
- autoreconf --install
- ./configure --prefix=/usr
- make -j2
install-commands:
- install -D -m 0755 src/c2esp "%{install-root}/usr/lib/cups/filter/c2esp"
- install -D -m 0755 src/c2espC "%{install-root}/usr/lib/cups/filter/c2espC"
- install -D -m 0755 src/command2esp "%{install-root}/usr/lib/cups/filter/command2esp"
- install -d "%{install-root}/usr/share/ppd"
- install -m 0644 src/*.drv "%{install-root}/usr/share/ppd/"
- sed -i 's:/usr/lib/cups/filter/::g' "%{install-root}"/usr/share/ppd/*.drv
9 changes: 9 additions & 0 deletions elements/printer-app/core-stack.bst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ depends:
- printer-app/cjet.bst
- printer-app/min12xxw.bst
- printer-app/pnm2ppa.bst
- printer-app/brlaser.bst
- printer-app/c2esp.bst
- printer-app/dymo-cups-drivers.bst
- printer-app/fxlinuxprint.bst
- printer-app/printer-driver-oki.bst
- printer-app/ptouch-driver.bst
- printer-app/pxljr.bst
- printer-app/rastertosag-gdi.bst
- printer-app/splix.bst
- freedesktop-sdk.bst:public-stacks/runtime-gnu.bst
- freedesktop-sdk.bst:components/avahi.bst
- freedesktop-sdk.bst:components/ca-certificates.bst
Expand Down
27 changes: 27 additions & 0 deletions elements/printer-app/dymo-cups-drivers.bst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
kind: manual
description: Build the DYMO CUPS raster filters and PPD archive.

sources:
- kind: git_repo
url: salsa:printing-team/dymo-cups-drivers.git
track: debian/1.4.0-12
ref: debian/1.4.0-12-0-ge69dceba792dc23d2894d57b0468009e52109625

build-depends:
- printer-app/pyppd.bst
- freedesktop-sdk.bst:public-stacks/buildsystem-autotools.bst

depends:
- freedesktop-sdk.bst:components/cups.bst
- freedesktop-sdk.bst:components/python3.bst

config:
build-commands:
- autoreconf --install
- ./configure --prefix=/usr
- make -j2
- pyppd -v -o dymo-ppds ppd
install-commands:
- install -D -m 0755 src/lw/raster2dymolw "%{install-root}/usr/lib/cups/filter/raster2dymolw"
- install -D -m 0755 src/lm/raster2dymolm "%{install-root}/usr/lib/cups/filter/raster2dymolm"
- install -D -m 0755 dymo-ppds "%{install-root}/usr/share/ppd/dymo-ppds"
31 changes: 31 additions & 0 deletions elements/printer-app/fxlinuxprint.bst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
kind: manual
description: Build the Fuji Xerox PDF printer CUPS filters and PPD archive.

sources:
- kind: git_repo
url: salsa:printing-team/fxlinuxprint.git
track: debian/1.1.0+ds-4
ref: debian/1.1.0+ds-4-0-g3e640d5cf2881b01b6dab16e7d899290e61b0417

build-depends:
- printer-app/pyppd.bst
- freedesktop-sdk.bst:public-stacks/buildsystem-autotools.bst

depends:
- freedesktop-sdk.bst:components/cups.bst
- freedesktop-sdk.bst:components/python3.bst
- freedesktop-sdk.bst:components/ghostscript.bst

config:
build-commands:
- autoreconf --install
- ./configure --prefix=/usr
- make -j2
- pyppd -v -o fxlinuxprint-ppds .
install-commands:
- install -D -m 0755 pstopdffx "%{install-root}/usr/lib/cups/filter/pstopdffx"
- install -D -m 0755 pdftopjlfx "%{install-root}/usr/lib/cups/filter/pdftopjlfx"
- install -D -m 0755 pdftopdffx "%{install-root}/usr/lib/cups/filter/pdftopdffx"
- install -D -m 0755 fxlinuxprint-ppds "%{install-root}/usr/share/ppd/fxlinuxprint-ppds"
- install -D -m 0644 mimefx.types "%{install-root}/usr/share/cups/mime/mimefx.types"
- install -D -m 0644 mimefx.convs "%{install-root}/usr/share/cups/mime/mimefx.convs"
28 changes: 28 additions & 0 deletions elements/printer-app/ijs.bst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
kind: manual
description: Build the standalone IJS library from the FSDK-pinned Ghostscript source.

sources:
- kind: git_repo
url: github:ArtifexSoftware/ghostpdl.git
track: ghostpdl-10.07.1
ref: ghostpdl-10.07.1-0-g9a39d68ca934f8e9343f46a2803e765122a3b4a9

build-depends:
- freedesktop-sdk.bst:public-stacks/buildsystem-autotools.bst

public:
bst:
split-rules:
devel:
- "%{includedir}"
- "%{includedir}/**"
- "%{libdir}/libijs.so"

config:
build-commands:
- cd ijs && autoreconf --force --install && ./configure --prefix=/usr --libdir="%{libdir}" --enable-shared --disable-static
- make -C ijs -j2
install-commands:
- make -C ijs DESTDIR="$PWD/full-install" install
- mkdir -p "%{install-root}%{libdir}" && cp -a "full-install%{libdir}"/libijs*.so* "%{install-root}%{libdir}/"
- mkdir -p "%{install-root}/usr/include" && cp -a full-install/usr/include/ijs "%{install-root}/usr/include/"
30 changes: 30 additions & 0 deletions elements/printer-app/jbigkit.bst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
kind: manual
description: Build the minimal JBIG85 shared library required by SpliX.

sources:
- kind: git_repo
url: https://www.cl.cam.ac.uk/~mgk25/git/jbigkit
track: v2.1
ref: v2.1-0-g60bd8bd6579c12e5e3a24782bd49af2046a9738a

build-depends:
- freedesktop-sdk.bst:public-stacks/buildsystem-make.bst

public:
bst:
split-rules:
devel:
- "%{includedir}/jbig85.h"
- "%{includedir}/jbig_ar.h"
- "%{libdir}/libjbig85.so"

config:
build-commands:
- cc $CFLAGS -fPIC -Ilibjbig -c libjbig/jbig85.c -o jbig85.o
- cc $CFLAGS -fPIC -Ilibjbig -c libjbig/jbig_ar.c -o jbig_ar.o
- cc $LDFLAGS -shared -Wl,-soname,libjbig85.so.0 -o libjbig85.so.0 jbig85.o jbig_ar.o
install-commands:
- install -D -m 0644 libjbig85.so.0 "%{install-root}%{libdir}/libjbig85.so.0"
- ln -s libjbig85.so.0 "%{install-root}%{libdir}/libjbig85.so"
- install -D -m 0644 libjbig/jbig85.h "%{install-root}/usr/include/jbig85.h"
- install -D -m 0644 libjbig/jbig_ar.h "%{install-root}/usr/include/jbig_ar.h"
40 changes: 40 additions & 0 deletions elements/printer-app/printer-driver-oki.bst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
kind: manual
description: Package the OKI shell filters and PPD archive.

sources:
- kind: git_repo
url: github:rbalint/printer-driver-oki.git
track: 1.0.2
ref: 1.0.2-0-g9f48d5a6c5938126a5aa91a902668aa877c3c22b

build-depends:
- printer-app/pyppd.bst

depends:
- freedesktop-sdk.bst:components/cups-filters.bst
- freedesktop-sdk.bst:components/cups-daemon-only.bst
- freedesktop-sdk.bst:components/grep.bst
- freedesktop-sdk.bst:components/sed.bst
- freedesktop-sdk.bst:components/ghostscript.bst
- freedesktop-sdk.bst:components/python3.bst
- freedesktop-sdk.bst:public-stacks/runtime-gnu.bst

config:
build-commands:
- |
sed -i \
-e '/^[[:space:]]*PATH=/d' \
-e '/^[[:space:]]*export PATH[[:space:]]*$/d' \
-e '/^[[:space:]]*GSCRIPT_LIB=/d' \
-e '/^[[:space:]]*export GSCRIPT_LIB[[:space:]]*$/d' \
-e 's|${TMPDIR:-/tmp}|${TMPDIR}|g' \
filters/*
- sed -i 's/^\(\*LanguageVersion:[[:space:]]*\).*/\1Portuguese/' MFP/OK4X1PSBR.ppd
- |
mkdir ppd
cp */*.ppd */*/*/*.ppd */*/*/*/*.ppd ppd/
pyppd -v -o oki-ppds ppd
install-commands:
- install -d -m 0755 "%{install-root}/usr/lib/cups/filter"
- install -m 0755 filters/* "%{install-root}/usr/lib/cups/filter/"
- install -D -m 0755 oki-ppds "%{install-root}/usr/share/ppd/oki-ppds"
42 changes: 42 additions & 0 deletions elements/printer-app/ptouch-driver.bst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
kind: manual
description: Build the P-Touch CUPS raster filter and Foomatic PPD archive.

sources:
- kind: git_repo
url: salsa:printing-team/ptouch-driver.git
track: debian/1.7-1
ref: debian/1.7-1-0-gccfa92351be3ce601f212048b174147a5496d8be

build-depends:
- printer-app/foomatic-db-engine.bst
- printer-app/pyppd.bst
- printer-app/perl-clone.bst
- printer-app/perl-xml-libxml.bst
- freedesktop-sdk.bst:public-stacks/buildsystem-autotools.bst
- freedesktop-sdk.bst:components/cups-filters.bst
- freedesktop-sdk.bst:components/foomatic-db.bst
- freedesktop-sdk.bst:components/gzip.bst
- freedesktop-sdk.bst:components/perl.bst
- freedesktop-sdk.bst:components/perl-xml-parser.bst

depends:
- freedesktop-sdk.bst:components/cups.bst
- freedesktop-sdk.bst:components/python3.bst
- freedesktop-sdk.bst:components/cups-filters.bst
- freedesktop-sdk.bst:components/ghostscript.bst

config:
build-commands:
- autoreconf --install
- ./configure --prefix=/usr
- make -j"%{max-jobs}" rastertoptch generated/stamp-h1
- |
cp -a /usr/share/foomatic "$PWD/foomatic-db"
cp -a generated/. foomatic-db/db/source/
printf '#\n' > foomatic-db/db/oldprinterids
FOOMATICDB="$PWD/foomatic-db" \
foomatic-compiledb -j "%{max-jobs}" -t ppd -d ppd ptouch-pt ptouch-ql
pyppd -v -o ptouch-ppds ppd
install-commands:
- install -D -m 0755 rastertoptch "%{install-root}/usr/lib/cups/filter/rastertoptch"
- install -D -m 0755 ptouch-ppds "%{install-root}/usr/share/ppd/ptouch-ppds"
Loading