├── .gitignore ├── NOTICE ├── gutenprint-printer-app.service ├── CODE_OF_CONDUCT.md ├── snap ├── local │ ├── run-gutenprint-printer-app-server │ └── run-gutenprint-printer-app └── snapcraft.yaml ├── .github └── workflows │ ├── ci.yml │ ├── auto-update.yml │ └── registry-actions.yml ├── scripts ├── run-dbus.sh └── start-server.sh ├── patches └── cups-dnssd-backend-socket-only.patch ├── gutenprint-printer-app.1 ├── Makefile ├── gutenprint-printer-app.c ├── LICENSE ├── README.md ├── testpage.ps └── rockcraft.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | *.snap 2 | *.rock 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Gutenprint Printer Application 2 | 3 | Copyright © 2020-2021 by Till Kamppeter. 4 | Copyright © 2020 by Michael R Sweet. 5 | Copyright © 2007-2019 by Apple Inc. 6 | Copyright © 1997-2007 by Easy Software Products. 7 | -------------------------------------------------------------------------------- /gutenprint-printer-app.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Gutenprint Printer Application 3 | 4 | [Service] 5 | ExecStart=gutenprint-printer-app server 6 | ExecStop=gutenprint-printer-app shutdown 7 | Type=simple 8 | 9 | [Install] 10 | WantedBy=multi-user.target 11 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | Code of Conduct 2 | =============== 3 | 4 | My goal is to provide quality open source software that everyone can use. 5 | While I may not be able to address every request or accept every contribution 6 | to this project, I will do my best to develop and maintain it for the common 7 | good. As part of the open source community, I expect everyone to: 8 | 9 | - Be friendly and patient. 10 | - Be respectful, even if we disagree. 11 | - Be honest. 12 | - Be accepting of all people. 13 | - Fully explain your concerns, issues, or ideas. 14 | -------------------------------------------------------------------------------- /snap/local/run-gutenprint-printer-app-server: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #set -e -x 4 | 5 | # Create directories and define environment variables 6 | mkdir -p $SNAP_COMMON/usb 7 | mkdir -p $SNAP_COMMON/cups 8 | export BACKEND_DIR=$SNAP/usr/lib/gutenprint-printer-app/backend 9 | export USB_QUIRK_DIR=$SNAP_COMMON 10 | export CUPS_SERVERROOT=$SNAP_COMMON/cups 11 | 12 | # Initialize config files of the CUPS backends 13 | cp $BACKEND_DIR/*.usb-quirks $USB_QUIRK_DIR/usb 2>/dev/null || : 14 | if [ ! -f $CUPS_SERVERROOT/snmp.conf ]; then 15 | cp $BACKEND_DIR/snmp.conf $CUPS_SERVERROOT 2>/dev/null || : 16 | fi 17 | 18 | exec $SNAP/scripts/run-gutenprint-printer-app -o log-file=$SNAP_COMMON/gutenprint-printer-app.log server "$@" 19 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI Pipeline for gutenprint-printer-app 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - master 8 | pull_request: 9 | branches: 10 | - main 11 | - master 12 | workflow_dispatch: 13 | 14 | jobs: 15 | build-rock: 16 | runs-on: ubuntu-22.04 17 | steps: 18 | - name: Checkout repository 19 | uses: actions/checkout@v4 20 | 21 | - name: Pack with Rockcraft 22 | uses: canonical/craft-actions/rockcraft-pack@main 23 | id: rockcraft 24 | 25 | build-snap: 26 | runs-on: ubuntu-latest 27 | steps: 28 | - name: Checkout repository 29 | uses: actions/checkout@v4 30 | 31 | - name: Build Snap Package 32 | uses: snapcore/action-build@v1 33 | id: snapcraft -------------------------------------------------------------------------------- /snap/local/run-gutenprint-printer-app: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | #set -e -x 4 | 5 | mkdir -p $SNAP_COMMON/ppd 6 | mkdir -p $SNAP_COMMON/spool 7 | mkdir -p $SNAP_COMMON/usb 8 | mkdir -p $SNAP_COMMON/cups/ssl 9 | mkdir -p $SNAP_COMMON/tmp 10 | chmod 1777 $SNAP_COMMON/tmp >/dev/null 2>&1 || : 11 | 12 | export TMPDIR=$SNAP_COMMON/tmp 13 | export FILTER_DIR=$SNAP/usr/lib/gutenprint-printer-app/filter 14 | export BACKEND_DIR=$SNAP/usr/lib/gutenprint-printer-app/backend 15 | export USB_QUIRK_DIR=$SNAP_COMMON 16 | export TESTPAGE_DIR=$SNAP/usr/share/gutenprint-printer-app 17 | export PPD_PATHS=$SNAP/usr/share/ppd/:$SNAP_COMMON/ppd/ 18 | export STATE_DIR=$SNAP_COMMON 19 | export STATE_FILE=$SNAP_COMMON/gutenprint-printer-app.state 20 | export SPOOL_DIR=$SNAP_COMMON/spool 21 | export CUPS_SERVERROOT=$SNAP_COMMON/cups 22 | export CUPS_SERVERBIN=$SNAP/usr/lib/gutenprint-printer-app 23 | 24 | exec $SNAP/usr/bin/gutenprint-printer-app "$@" 25 | -------------------------------------------------------------------------------- /scripts/run-dbus.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -eux 3 | 4 | echo "Creating system users" 5 | 6 | # Create system users with system accounts and no home directories, using nologin shell 7 | useradd --system --no-create-home --shell /usr/sbin/nologin systemd-resolve || true 8 | useradd --system --no-create-home --shell /usr/sbin/nologin systemd-network || true 9 | 10 | echo "Creating directories" 11 | 12 | # Create the /run/dbus directory if it doesn't exist, set permissions, and ownership 13 | mkdir -p /run/dbus 14 | chmod 755 /run/dbus 15 | chown root:root /run/dbus 16 | 17 | echo "Starting dbus" 18 | 19 | # Start the dbus daemon in the foreground 20 | # dbus-daemon --system --nofork --nopidfile & 21 | 22 | # Check the status of the dbus service 23 | service dbus start 24 | service dbus status || true 25 | 26 | echo "Starting avahi-daemon" 27 | 28 | # Start the avahi-daemon in the background without dropping root privileges 29 | avahi-daemon --daemonize --no-drop-root 30 | 31 | # Keep the script running to avoid container exit 32 | tail -f /dev/null -------------------------------------------------------------------------------- /scripts/start-server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -eux 3 | 4 | # Precheck: Ensure PORT is a number or undefined 5 | if [ -n "${PORT:-}" ]; then 6 | if ! echo "$PORT" | grep -Eq '^[0-9]+$'; then 7 | echo "Error: PORT must be a valid number" >&2 8 | exit 1 9 | fi 10 | fi 11 | 12 | # Ensure the /etc/cups/ssl directory exists with proper permissions 13 | CUPS_SERVERROOT="/etc/cups/ssl" 14 | if [ ! -d "$CUPS_SERVERROOT" ]; then 15 | mkdir -p "$CUPS_SERVERROOT" 16 | fi 17 | chmod 755 "$CUPS_SERVERROOT" 18 | 19 | # Ensure /var/lib/gutenprint-printer-app directory exists 20 | STATE_DIR="/var/lib/gutenprint-printer-app" 21 | 22 | if [ ! -d "$STATE_DIR" ]; then 23 | mkdir -p "$STATE_DIR" 24 | fi 25 | chmod 755 "$STATE_DIR" 26 | 27 | # Ensure gutenprint-printer-app.state file exists 28 | STATE_FILE="$STATE_DIR/gutenprint-printer-app.state" 29 | if [ ! -f "$STATE_FILE" ]; then 30 | touch "$STATE_FILE" 31 | fi 32 | chmod 755 "$STATE_FILE" 33 | 34 | # Start the gutenprint-printer-app server 35 | gutenprint-printer-app -o log-file=/gutenprint-printer-app.log ${PORT:+-o server-port=$PORT} server 36 | -------------------------------------------------------------------------------- /patches/cups-dnssd-backend-socket-only.patch: -------------------------------------------------------------------------------- 1 | diff --git a/backend/dnssd.c b/backend/dnssd.c 2 | index e57029178..77c7724b3 100644 3 | --- a/backend/dnssd.c 4 | +++ b/backend/dnssd.c 5 | @@ -297,8 +297,8 @@ main(int argc, /* I - Number of command-line args */ 6 | return (0); 7 | } 8 | 9 | - browsers = 6; 10 | - avahi_service_browser_new(client, AVAHI_IF_UNSPEC, 11 | + browsers = /*6*/1; 12 | + /*avahi_service_browser_new(client, AVAHI_IF_UNSPEC, 13 | AVAHI_PROTO_UNSPEC, 14 | "_fax-ipp._tcp", NULL, 0, 15 | browse_callback, devices); 16 | @@ -313,17 +313,17 @@ main(int argc, /* I - Number of command-line args */ 17 | avahi_service_browser_new(client, AVAHI_IF_UNSPEC, 18 | AVAHI_PROTO_UNSPEC, 19 | "_ipps._tcp", NULL, 0, 20 | - browse_callback, devices); 21 | + browse_callback, devices);*/ 22 | avahi_service_browser_new(client, AVAHI_IF_UNSPEC, 23 | AVAHI_PROTO_UNSPEC, 24 | "_pdl-datastream._tcp", 25 | NULL, 0, 26 | browse_callback, 27 | devices); 28 | - avahi_service_browser_new(client, AVAHI_IF_UNSPEC, 29 | + /*avahi_service_browser_new(client, AVAHI_IF_UNSPEC, 30 | AVAHI_PROTO_UNSPEC, 31 | "_printer._tcp", NULL, 0, 32 | - browse_callback, devices); 33 | + browse_callback, devices);*/ 34 | #endif /* HAVE_AVAHI */ 35 | 36 | /* 37 | -------------------------------------------------------------------------------- /.github/workflows/auto-update.yml: -------------------------------------------------------------------------------- 1 | name: Push new tag update to stable branch 2 | 3 | on: 4 | schedule: 5 | - cron: '9 7 * * *' 6 | workflow_dispatch: 7 | inputs: 8 | workflow_choice: 9 | description: "Choose YAML to update" 10 | required: true 11 | default: "both" 12 | type: choice 13 | options: 14 | - snapcraft 15 | - rockcraft 16 | - both 17 | 18 | jobs: 19 | update-yamls: 20 | runs-on: ubuntu-latest 21 | steps: 22 | - name: Checkout this repo 23 | uses: actions/checkout@v3 24 | 25 | - name: Run desktop-snaps action (Snapcraft) 26 | if: ${{ github.event_name == 'schedule' || github.event.inputs.workflow_choice == 'snapcraft' || github.event.inputs.workflow_choice == 'both' }} 27 | uses: ubuntu/desktop-snaps@stable 28 | with: 29 | token: ${{ secrets.GITHUB_TOKEN }} 30 | repo: ${{ github.repository }} 31 | version-schema: '^(\d{8})' 32 | 33 | - name: Run desktop-snaps action (Rockcraft) 34 | if: ${{ github.event_name == 'schedule' || github.event.inputs.workflow_choice == 'rockcraft' || github.event.inputs.workflow_choice == 'both' }} 35 | uses: ubuntu/desktop-snaps@stable 36 | with: 37 | token: ${{ secrets.GITHUB_TOKEN }} 38 | repo: ${{ github.repository }} 39 | rock-version-schema: '^(\d{8})' 40 | yaml-path: 'rockcraft.yaml' 41 | readme-path: 'README.md' 42 | -------------------------------------------------------------------------------- /gutenprint-printer-app.1: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Gutenprint Printer Application man page 3 | .\" 4 | .\" Copyright © 2020-2021 by Till Kamppeter 5 | .\" Copyright © 2020 by Michael R Sweet 6 | .\" 7 | .\" Licensed under Apache License v2.0. See the file "LICENSE" for more 8 | .\" information. 9 | .\" 10 | .TH gutenprint-printer-app 1 "gutenprint-printer-app" "2021-09-04" "OpenPrinting" 11 | .SH NAME 12 | gutenprint-printer-app \- Gutenprint Printer Application 13 | .SH SYNOPSIS 14 | .B gutenprint-printer-app 15 | [ 16 | .I SUB-COMMAND 17 | ] [ OPTIONS ] [ FILES ] 18 | .SH DESCRIPTION 19 | .B gutenprint-printer-app 20 | is a Printer Application that can be run standalone or as a dedicated IPP Everywhere network service. 21 | .B gutenprint-printer-app 22 | supports printing PDF files, PostScript files, JPEG images, PNG images, and Apple/PWG raster files to USB and network printers supported by Gutenprint. 23 | 24 | This Printer Application created by OpenPrinting encapsulates the CUPS driver of Gutenprint, consisting of the dynamic PPD file generator "gutenprint.5.3", the CUPS filter "ratertogutenprint.5.3" and the CUPS backend "gutenprint53+usb" (backend only used for dyesub printers on USB). 25 | 26 | Gutenprint is actively maintained and the developers plan to create a native Printer Application, not retro-fitting the CUPS driver, but creating a Printer Application directly with PAPPL and libgutenprint. Therefore this Printer Application is only an interim solution and will be discontinued as soon as the Gutenprint developers issue their native Printer Application. 27 | 28 | .SH SUB-COMMANDS 29 | If no sub-command is specified, "submit" is assumed. 30 | 31 | The following sub-commands are recognized by 32 | .B gutenprint-printer-app: 33 | .TP 5 34 | add 35 | Add a printer queue. 36 | .TP 5 37 | cancel 38 | Cancel one or more print jobs. 39 | .TP 5 40 | default 41 | Get/Set the default printer queue. 42 | .TP 5 43 | delete 44 | Delete a printer queue. 45 | .TP 5 46 | devices 47 | List connected printers. 48 | .TP 5 49 | drivers 50 | List the supported drivers. 51 | .TP 5 52 | jobs 53 | List pending print jobs. 54 | .TP 5 55 | modify 56 | Modify a printer queue. 57 | .TP 5 58 | options 59 | List supported options. 60 | .TP 5 61 | printers 62 | List the printer queues. 63 | .TP 5 64 | server 65 | Start a server. 66 | .TP 5 67 | shutdown 68 | Shutdown a running server. 69 | .TP 5 70 | status 71 | Show the status of a printer or all printers. 72 | .TP 5 73 | submit 74 | Submit a file for printing. 75 | .SH OPTIONS 76 | The following options are recognized by 77 | .B gutenprint-printer-app: 78 | .TP 5 79 | -a 80 | Cancel all jobs. 81 | .TP 5 82 | -d PRINTER 83 | Specify printer. 84 | .TP 5 85 | -h HOST 86 | Specify hostname. 87 | .TP 5 88 | -j JOB-ID 89 | Specify job ID. 90 | .TP 5 91 | -m DRIVER-NAME 92 | Specify driver. 93 | .TP 5 94 | -n COPIES 95 | Specify number of copies. 96 | .TP 5 97 | -o NAME=VALUE 98 | Specify option. 99 | .TP 5 100 | -t TITLE 101 | Specify job title. 102 | .TP 5 103 | -u URI 104 | Specify ipp: or ipps: printer/server. 105 | .TP 5 106 | -v DEVICE-URI 107 | Specify socket: or usb: device. 108 | .SH SEE ALSO 109 | https://github.com/OpenPrinting/gutenprint-printer-app 110 | .SH COPYRIGHT 111 | Copyright \[co] 2020-2021 by Till Kamppeter. 112 | Copyright \[co] 2020 by Michael R Sweet. 113 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for the Gutenprint Printer Application 3 | # 4 | # Copyright © 2020-2021 by Till Kamppeter 5 | # Copyright © 2020 by Michael R Sweet 6 | # 7 | # Licensed under Apache License v2.0. See the file "LICENSE" for more 8 | # information. 9 | # 10 | 11 | # Version and 12 | VERSION = 1.0 13 | prefix = $(DESTDIR)/usr 14 | localstatedir = $(DESTDIR)/var 15 | includedir = $(prefix)/include 16 | bindir = $(prefix)/bin 17 | libdir = $(prefix)/lib 18 | mandir = $(prefix)/share/man 19 | ppddir = $(prefix)/share/ppd 20 | statedir = $(localstatedir)/lib/gutenprint-printer-app 21 | spooldir = $(localstatedir)/spool/gutenprint-printer-app 22 | serverbin = $(prefix)/lib/gutenprint-printer-app 23 | resourcedir = $(prefix)/share/gutenprint-printer-app 24 | cupsserverbin = `cups-config --serverbin` 25 | unitdir := $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd` 26 | 27 | 28 | # Compiler/linker options... 29 | OPTIM = -Os -g 30 | CFLAGS += `pkg-config --cflags pappl` `cups-config --cflags` `pkg-config --cflags libppd` `pkg-config --cflags libcupsfilters` `pkg-config --cflags libpappl-retrofit` $(OPTIM) 31 | ifdef VERSION 32 | CFLAGS += -DSYSTEM_VERSION_STR="\"$(VERSION)\"" 33 | ifndef MAJOR 34 | MAJOR = `echo $(VERSION) | perl -p -e 's/^(\d+).*$$/\1/'` 35 | endif 36 | ifndef MINOR 37 | MINOR = `echo $(VERSION) | perl -p -e 's/^\d+\D+(\d+).*$$/\1/'` 38 | endif 39 | ifndef PATCH 40 | PATCH = `echo $(VERSION) | perl -p -e 's/^\d+\D+\d+\D+(\d+).*$$/\1/'` 41 | endif 42 | ifndef PACKAGE 43 | PACKAGE = `echo $(VERSION) | perl -p -e 's/^\d+\D+\d+\D+\d+\D+(\d+).*$$/\1/'` 44 | endif 45 | endif 46 | ifdef MAJOR 47 | CFLAGS += -DSYSTEM_VERSION_ARR_0=$(MAJOR) 48 | endif 49 | ifdef MINOR 50 | CFLAGS += -DSYSTEM_VERSION_ARR_1=$(MINOR) 51 | endif 52 | ifdef PATCH 53 | CFLAGS += -DSYSTEM_VERSION_ARR_2=$(PATCH) 54 | endif 55 | ifdef PACKAGE 56 | CFLAGS += -DSYSTEM_VERSION_ARR_3=$(PACKAGE) 57 | endif 58 | LDFLAGS += $(OPTIM) `cups-config --ldflags` 59 | LIBS += `pkg-config --libs pappl` `cups-config --image --libs` `pkg-config --libs libppd` `pkg-config --libs libcupsfilters` `pkg-config --libs libpappl-retrofit` 60 | 61 | 62 | # Targets... 63 | OBJS = gutenprint-printer-app.o 64 | TARGETS = gutenprint-printer-app 65 | 66 | 67 | # General build rules... 68 | .SUFFIXES: .c .o 69 | .c.o: 70 | $(CC) $(CFLAGS) -c -o $@ $< 71 | 72 | 73 | # Targets... 74 | all: $(TARGETS) 75 | 76 | clean: 77 | rm -f $(TARGETS) $(OBJS) 78 | 79 | install: $(TARGETS) 80 | mkdir -p $(bindir) 81 | cp $(TARGETS) $(bindir) 82 | mkdir -p $(mandir)/man1 83 | cp gutenprint-printer-app.1 $(mandir)/man1 84 | mkdir -p $(ppddir) 85 | mkdir -p $(statedir)/ppd 86 | mkdir -p $(spooldir) 87 | mkdir -p $(resourcedir) 88 | cp testpage.ps $(resourcedir) 89 | if test "x$(cupsserverbin)" != x && [ -d $(cupsserverbin) ]; then \ 90 | mkdir -p $(libdir); \ 91 | touch $(serverbin) 2> /dev/null || :; \ 92 | if rm $(serverbin) 2> /dev/null; then \ 93 | ln -s $(cupsserverbin) $(serverbin); \ 94 | fi; \ 95 | else \ 96 | mkdir -p $(serverbin)/filter; \ 97 | mkdir -p $(serverbin)/backend; \ 98 | fi 99 | if test "x$(unitdir)" != x; then \ 100 | mkdir -p $(unitdir); \ 101 | cp gutenprint-printer-app.service $(unitdir); \ 102 | fi 103 | 104 | gutenprint-printer-app: $(OBJS) 105 | $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) 106 | 107 | $(OBJS): Makefile 108 | -------------------------------------------------------------------------------- /.github/workflows/registry-actions.yml: -------------------------------------------------------------------------------- 1 | name: Pack and Publish OCI Image to Docker Registry and GitHub Packages 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - master 8 | workflow_dispatch: 9 | inputs: 10 | workflow_choice: 11 | description: "Choose Release Channel" 12 | required: true 13 | default: "edge" 14 | type: choice 15 | options: 16 | - edge 17 | - stable 18 | - both 19 | workflow_run: 20 | workflows: ["Push new tag update to stable branch"] 21 | types: 22 | - completed 23 | 24 | jobs: 25 | build-rock: 26 | runs-on: ubuntu-22.04 27 | steps: 28 | - name: Checkout repository 29 | uses: actions/checkout@v4 30 | 31 | - name: Pack with Rockcraft 32 | uses: canonical/craft-actions/rockcraft-pack@main 33 | id: rockcraft 34 | 35 | - name: Upload Rock Artifact 36 | uses: actions/upload-artifact@v4 37 | with: 38 | name: cups-rock 39 | path: ${{ steps.rockcraft.outputs.rock }} 40 | 41 | publish-rock: 42 | needs: build-rock 43 | if: github.ref_name == 'main' || github.ref_name == 'master' 44 | runs-on: ubuntu-latest 45 | steps: 46 | - name: Checkout repository 47 | uses: actions/checkout@v4 48 | 49 | - name: Download Rock Artifact 50 | uses: actions/download-artifact@v4 51 | with: 52 | name: cups-rock 53 | 54 | - name: Install Dependencies 55 | run: | 56 | sudo snap install rockcraft --classic 57 | sudo snap install docker 58 | sudo snap install yq 59 | 60 | - name: Ensure Docker Daemon is Running 61 | run: | 62 | sudo systemctl start docker 63 | sudo systemctl enable docker 64 | sudo systemctl is-active --quiet docker || sudo systemctl start docker 65 | 66 | # - name: Log in to Docker Hub 67 | # uses: docker/login-action@v3.2.0 68 | # with: 69 | # username: ${{ secrets.DOCKER_USERNAME }} 70 | # password: ${{ secrets.DOCKER_PASSWORD }} 71 | 72 | - name: Log in to GitHub Packages 73 | uses: docker/login-action@v3.2.0 74 | with: 75 | registry: ghcr.io 76 | username: ${{ github.repository_owner }} 77 | password: ${{ secrets.GITHUB_TOKEN }} 78 | 79 | - name: Build and Push Docker Image (Edge & Latest Channel) 80 | if: github.event.inputs.workflow_choice == 'edge' || github.event.inputs.workflow_choice == 'both' || github.event_name == 'push' || github.event_name == 'workflow_run' 81 | env: 82 | USERNAME: ${{ secrets.DOCKER_USERNAME }} 83 | ORG: ${{ github.repository_owner }} 84 | run: | 85 | IMAGE="$(yq '.name' rockcraft.yaml)" 86 | VERSION="$(yq '.version' rockcraft.yaml)" 87 | ROCK="$(ls *.rock | tail -n 1)" 88 | ORG_NAME=$(echo "${ORG}" | tr '[:upper:]' '[:lower:]') 89 | sudo rockcraft.skopeo --insecure-policy copy oci-archive:"${ROCK}" docker-daemon:"${ORG_NAME}/${IMAGE}:${VERSION}-edge" 90 | # Push to Docker Hub 91 | # docker tag ${ORG_NAME}/${IMAGE}:${VERSION}-edge ${USERNAME}:${VERSION}-edge 92 | # docker push ${USERNAME}/${IMAGE}:${VERSION}-edge 93 | # docker tag ${USERNAME}/${IMAGE}:${VERSION}-edge ${USERNAME}/${IMAGE}:latest 94 | # docker push ${USERNAME}/${IMAGE}:latest 95 | # Push to GitHub Packages 96 | GITHUB_IMAGE="ghcr.io/${ORG_NAME}/${IMAGE}" 97 | docker tag ${ORG_NAME}/${IMAGE}:${VERSION}-edge ${GITHUB_IMAGE}:${VERSION}-edge 98 | docker push ${GITHUB_IMAGE}:${VERSION}-edge 99 | docker tag ${GITHUB_IMAGE}:${VERSION}-edge ${GITHUB_IMAGE}:latest 100 | docker push ${GITHUB_IMAGE}:latest 101 | 102 | - name: Build and Push Docker Image (Stable Channel) 103 | if: github.event.inputs.workflow_choice == 'stable' || github.event.inputs.workflow_choice == 'both' 104 | env: 105 | USERNAME: ${{ secrets.DOCKER_USERNAME }} 106 | ORG: ${{ github.repository_owner }} 107 | run: | 108 | IMAGE="$(yq '.name' rockcraft.yaml)" 109 | VERSION="$(yq '.version' rockcraft.yaml)" 110 | ROCK="$(ls *.rock | tail -n 1)" 111 | ORG_NAME=$(echo "${ORG}" | tr '[:upper:]' '[:lower:]') 112 | sudo rockcraft.skopeo --insecure-policy copy oci-archive:"${ROCK}" docker-daemon:"${ORG_NAME}/${IMAGE}:${VERSION}-stable" 113 | # Push to Docker Hub 114 | # docker tag ${ORG_NAME}/${IMAGE}:${VERSION}-stable ${USERNAME}:${VERSION}-stable 115 | # docker push ${USERNAME}/${IMAGE}:${VERSION}-stable 116 | # Push to GitHub Packages 117 | GITHUB_IMAGE="ghcr.io/${ORG_NAME}/${IMAGE}" 118 | docker tag ${ORG_NAME}/${IMAGE}:${VERSION}-stable ${GITHUB_IMAGE}:${VERSION}-stable 119 | docker push ${GITHUB_IMAGE}:${VERSION}-stable 120 | -------------------------------------------------------------------------------- /gutenprint-printer-app.c: -------------------------------------------------------------------------------- 1 | // 2 | // Gutenprint Printer Application based on PAPPL and libpappl-retrofit 3 | // 4 | // Copyright © 2020-2021 by Till Kamppeter. 5 | // Copyright © 2020 by Michael R Sweet. 6 | // 7 | // Licensed under Apache License v2.0. See the file "LICENSE" for more 8 | // information. 9 | // 10 | 11 | // 12 | // Include necessary headers... 13 | // 14 | 15 | #include 16 | 17 | 18 | // 19 | // Constants... 20 | // 21 | 22 | // Name and version 23 | 24 | #define SYSTEM_NAME "Gutenprint Printer Application" 25 | #define SYSTEM_PACKAGE_NAME "gutenprint-printer-app" 26 | #ifndef SYSTEM_VERSION_STR 27 | # define SYSTEM_VERSION_STR "1.0" 28 | #endif 29 | #ifndef SYSTEM_VERSION_ARR_0 30 | # define SYSTEM_VERSION_ARR_0 1 31 | #endif 32 | #ifndef SYSTEM_VERSION_ARR_1 33 | # define SYSTEM_VERSION_ARR_1 0 34 | #endif 35 | #ifndef SYSTEM_VERSION_ARR_2 36 | # define SYSTEM_VERSION_ARR_2 0 37 | #endif 38 | #ifndef SYSTEM_VERSION_ARR_3 39 | # define SYSTEM_VERSION_ARR_3 0 40 | #endif 41 | #define SYSTEM_WEB_IF_FOOTER "Copyright © 2021 by Till Kamppeter. Provided under the terms of the Apache License 2.0." 42 | 43 | // Test page 44 | 45 | #define TESTPAGE "testpage.pdf" 46 | 47 | 48 | // 49 | // 'gutenprint_autoadd()' - Auto-add printers. 50 | // 51 | 52 | const char * // O - Driver name or `NULL` for none 53 | gutenprint_autoadd(const char *device_info, // I - Device name (unused) 54 | const char *device_uri, // I - Device URI (unused) 55 | const char *device_id, // I - IEEE-1284 device ID 56 | void *data) // I - Global data 57 | { 58 | pr_printer_app_global_data_t *global_data = 59 | (pr_printer_app_global_data_t *)data; 60 | const char *ret = NULL; // Return value 61 | 62 | 63 | (void)device_info; 64 | (void)device_uri; 65 | 66 | if (device_id == NULL || global_data == NULL) 67 | return (NULL); 68 | 69 | // Find the best-matching PPD file to expicitly support our printer model 70 | if (!((ret = prBestMatchingPPD(device_id, global_data)) != 0 || 71 | // No dedicated support for this model, look at the COMMAND 72 | // SET (CMD) key in the device ID for the list of printer 73 | // languages and select a generic driver if we find a 74 | // supported language 75 | (prSupportsPCL5c(device_id) && 76 | (ret = prBestMatchingPPD("MFG:Generic;MDL:PCL Color Laser;", 77 | global_data)) != 0) || 78 | (prSupportsPCLXL(device_id) && 79 | (ret = prBestMatchingPPD("MFG:Generic;MDL:PCL 6/PCL XL Printer;", 80 | global_data)) != 0) || 81 | (prSupportsPCL5(device_id) && 82 | (ret = prBestMatchingPPD("MFG:Generic;MDL:PCL 5e Printer;", 83 | global_data)) != 0))) 84 | // Printer does not support our PDLs, it is not supported by this 85 | // Printer Application 86 | ret = NULL; 87 | 88 | return (ret); 89 | } 90 | 91 | 92 | // 93 | // 'main()' - Main entry for the gutenprint-printer-app. 94 | // 95 | 96 | int 97 | main(int argc, // I - Number of command-line arguments 98 | char *argv[]) // I - Command-line arguments 99 | { 100 | cups_array_t *spooling_conversions, 101 | *stream_formats, 102 | *driver_selection_regex_list; 103 | const char *driver_display_regex; 104 | 105 | // Array of spooling conversions, most desirables first 106 | // 107 | // Here we prefer not converting into another format 108 | // Keeping vector formats (like PS -> PDF) is usually more desirable 109 | // but as many printers have buggy PS interpreters we prefer converting 110 | // PDF to Raster and not to PS 111 | spooling_conversions = cupsArrayNew(NULL, NULL); 112 | cupsArrayAdd(spooling_conversions, (void *)&PR_CONVERT_PDF_TO_RASTER); 113 | cupsArrayAdd(spooling_conversions, (void *)&PR_CONVERT_PS_TO_RASTER); 114 | 115 | // Array of stream formats, most desirables first 116 | // 117 | // PDF comes last because it is generally not streamable. 118 | // PostScript comes second as it is Ghostscript's streamable 119 | // input format. 120 | stream_formats = cupsArrayNew(NULL, NULL); 121 | cupsArrayAdd(stream_formats, (void *)&PR_STREAM_CUPS_RASTER); 122 | 123 | if (PAPPL_MAX_VENDOR >= 256) 124 | // If we create a Snap (or other sandboxed package) which includes 125 | // its own PAPPL, we can modify the limit for vendor-specific 126 | // options. If the limit got actually raised we allow the use of 127 | // the expert PPDs. NOTE: In this case we should build Gutenprint 128 | // with only the expert PPDs as this regex does not exclude the 129 | // simplified PPDs. 130 | driver_display_regex = " +- +CUPS\\+Gutenprint +[^ ]+()$"; 131 | else 132 | // With PAPPL in stock configuration (from system, distro package, 133 | // ...) use simplified PPDs, as PAPPL cannot cope with the huge 134 | // amount of options of the expert PPDs (only 32 vendor-specific 135 | // options allowed 136 | driver_display_regex = " +- +CUPS\\+Gutenprint +[^ ]+ +Simplified()$"; 137 | 138 | // Configuration record of the Printer Application 139 | pr_printer_app_config_t printer_app_config = 140 | { 141 | SYSTEM_NAME, // Display name for Printer Application 142 | SYSTEM_PACKAGE_NAME, // Package/executable name 143 | SYSTEM_VERSION_STR, // Version as a string 144 | { 145 | SYSTEM_VERSION_ARR_0, // Version 1st number 146 | SYSTEM_VERSION_ARR_1, // 2nd 147 | SYSTEM_VERSION_ARR_2, // 3rd 148 | SYSTEM_VERSION_ARR_3 // 4th 149 | }, 150 | SYSTEM_WEB_IF_FOOTER, // Footer for web interface (in HTML) 151 | // pappl-retrofit special features to be used 152 | PR_COPTIONS_NO_GENERIC_DRIVER | 153 | PR_COPTIONS_USE_ONLY_MATCHING_NICKNAMES | 154 | PR_COPTIONS_NO_PAPPL_BACKENDS | 155 | PR_COPTIONS_CUPS_BACKENDS, 156 | gutenprint_autoadd, // Auto-add (driver assignment) callback 157 | prIdentify, // Printer identify callback 158 | prTestPage, // Test page print callback 159 | NULL, // No extra setup steps for the system 160 | prSetupDeviceSettingsPage, // Set up "Device Settings" printer web 161 | // interface page 162 | spooling_conversions, // Array of data format conversion rules for 163 | // printing in spooling mode 164 | stream_formats, // Arrray for stream formats to be generated 165 | // when printing in streaming mode 166 | "", // CUPS backends to be ignored 167 | "snmp,dnssd,usb,gutenprint53+usb", 168 | // CUPS backends to be used exclusively 169 | // If empty all but the ignored backends are used 170 | TESTPAGE, // Test page (printable file), used by the 171 | // standard test print callback prTestPage() 172 | driver_display_regex, // Regular expression to separate the 173 | // extra information after make/model in 174 | // the PPD's *NickName. Also extracts a 175 | // contained driver name (by using 176 | // parentheses) 177 | NULL 178 | // Regular expression for the driver 179 | // auto-selection to prioritize a driver 180 | // when there is more than one for a 181 | // given printer. If a regular 182 | // expression matches on the driver 183 | // name, the driver gets priority. If 184 | // there is more than one matching 185 | // driver, the driver name on which the 186 | // earlier regular expression in the 187 | // list matches, gets the priority. 188 | }; 189 | 190 | return (prRetroFitPrinterApp(&printer_app_config, argc, argv)); 191 | } 192 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Gutenprint Printer Application 2 | 3 | ## INTRODUCTION 4 | 5 | This repository contains a Printer Application for printing with the 6 | Gutenprint printer driver. This allows high-quality printing on a wide 7 | range of inkjet, lasre, and dye-sublimation printers, especially 8 | inkjets from Epson and Canon, PCL laser printers (both monochrome and 9 | color), and dye-sublimation photo printers. This driver is especially 10 | recommended for photos and fine-art printing. It is also an 11 | alternative to the [Ghostscript Printer 12 | Application](https://github.com/OpenPrinting/ghostscript-printer-app) 13 | for PCL 4/5c/e laser printers. 14 | 15 | It uses [PAPPL](https://www.msweet.org/pappl) to support IPP printing 16 | from multiple operating systems. In addition, it uses the resources of 17 | [cups-filters 2.x](https://github.com/OpenPrinting/cups-filters) 18 | (filter functions in libcupsfilters, libppd) and 19 | [pappl-retrofit](https://github.com/OpenPrinting/pappl-retrofit) 20 | (encapsulating classic CUPS drivers in Printer Applications). The code 21 | of pappl-retrofit is derived from the 22 | [hp-printer-app](https://github.com/michaelrsweet/hp-printer-app). 23 | 24 | The printer driver itself and the software to communicate with the 25 | printer hardware is taken from the [Gutenprint 26 | project](http://gimp-print.sourceforge.net/), also the Information 27 | about supported printer models and their capabilities. 28 | 29 | Your contributions are welcome. Please post [issues and pull 30 | requests](https://github.com/OpenPrinting/gutenprint-printer-app). 31 | 32 | **Note: Gutenprint is an actively maintained project, therefore it 33 | would also be the correct way if Gutenprint gets turned into a Printer 34 | Application by its maintainers, or at least this be offered as an 35 | alternative to the classic CUPS driver. Especially they should create 36 | a native Printer Application, meaning that it does not use PPDs, CUPS 37 | filters, and CUPS backends internally. As soon as the Gutenprint 38 | project provides a native Printer Application, this Printer 39 | Application retro-fitting the CUPS driver will get discontinued.** 40 | 41 | Please check whether your printer is a driverless IPP printer 42 | (AirPrint, Mopria, IPP Everywhere, Wi-Fi Direct Print, prints from 43 | phones) as in this case you do not need any Printer Application at 44 | all. Most modern printers, even the cheapest models, are driverless 45 | IPP printers. Even USB-only printers can be driverless IPP, and you 46 | can generally use driverless IPP via USB, try 47 | [ipp-usb](https://github.com/OpenPrinting/ipp-usb) for these cases 48 | first. 49 | 50 | 51 | ### Properties 52 | 53 | - A Printer Application providing the Gutenprint CUPS Raster printer 54 | driver and all printer's PPDs of Gutenprint. This allows easy 55 | printing in high quality, including photos on photo paper. The 56 | specialized CUPSbackend for dye sublimation printers with 57 | proprietary USB communication protocols is also included. 58 | 59 | - The Printer Application checks the supported number of 60 | vendor-specific options/attributes of the installed PAPPL library, 61 | `PAPPL_MAX_VENDOR` and uses the expert PPDs only if 256 or more 62 | vendor-specific options are supported, otherwise the simplified PPDs 63 | are used. By default, the number is 32 and in the Snap we modify it 64 | to be 256, meaning that the Gutenprint Printer Application Snap in 65 | the Snap Store uses expert PPDs, while a quick build with `make`, 66 | using an installed standard PAPPL library uses the simplified PPD 67 | files. 68 | 69 | - Available printer devices are discovered (and used) with CUPS' 70 | backends and with Gutenprint's dye-sublimation printer backend in 71 | addition and not with PAPPL's own backends. This way dye-sublimation 72 | printers are discovered with the correct backend for their totally 73 | proprietary communication protocol. Also quirk workarounds for USB 74 | printers with compatibility problems are used (and are editable) and 75 | Gutenprint output can get send to the printer via IPP, IPPS 76 | (encrypted!), and LPD in addition to socket (usually port 9100). The 77 | SNMP backend can get configured (community, address scope). 78 | 79 | - If you have an unusual system configuration or a personal firewall 80 | your printer will perhaps not get discovered. In this situation the 81 | fully manual "Network Printer" entry in combination with the 82 | hostname/IP field can be helpful. 83 | 84 | - PWG Raster, Apple Raster or image input data does not get converted 85 | to PostScript or PDF, it is only converted/scaled to the required 86 | color space and resolution and then fed into the Gutenprint CUPS 87 | Raster driver. 88 | 89 | - PDF and PostScript input data is rendered into raster data using 90 | Ghostscript. 91 | 92 | - The information about which printer models are supported and which 93 | are their capabilities is based on the PPD files which get 94 | auto-generated by Gutenprint when using it with CUPS. The PPD 95 | generator is included in the Snap. 96 | 97 | - Standard job IPP attributes are mapped to the driver's option 98 | settings best fitting to them so that users can print from any type 99 | of client (like for example a phone or IoT device) which only 100 | supports standard IPP attributes and cannot retrive the PPD 101 | options. Trays, media sizes, media types, and duplex can get mapped 102 | easily, but when it comes to color and quality it gets more complex, 103 | as relevant options differ a lot in the PPD files. Here we use an 104 | algorithm which automatically (who wants hand-edit ~3000 PPD files 105 | for the assignments) finds the right set of option settings for each 106 | combination of `print-color-mode` (`color`/`monochrome`), 107 | `print-quality` (`draft`/`normal`/`high`), and 108 | `print-content-optimize` 109 | (`auto`/`photo`/`graphics`/`text`/`text-and-graphics`) in the PPD of 110 | the current printer. So you have easy access to the full quality or 111 | speed of your printer without needing to deal with printer-specific 112 | option settings (the original options are still accessible via web 113 | admin interface). 114 | 115 | ### To Do 116 | 117 | - PDF test page, for example generated with the bannertopdf filter, or 118 | perhaps even a Raster test page. 119 | 120 | - Human-readable strings for vendor options (Needs support by PAPPL: 121 | [Issue #58: Localization 122 | support](https://github.com/michaelrsweet/pappl/issues/58)) 123 | 124 | - Internationalization/Localization (Needs support by PAPPL: [Issue 125 | #58: Localization 126 | support](https://github.com/michaelrsweet/pappl/issues/58)) 127 | 128 | - SNMP Ink level check via ps_status() function (Needs support by PAPPL: 129 | [Issue #83: CUPS does IPP and SNMP ink level polls via backends, 130 | PAPPL should have functions for 131 | this](https://github.com/michaelrsweet/pappl/issues/83)) 132 | 133 | 134 | ## THE SNAP 135 | 136 | ### Installing and building 137 | 138 | To just run and use this Printer Application, simply install it from 139 | the Snap Store: 140 | 141 | ``` 142 | sudo snap install --edge gutenprint-printer-app 143 | ``` 144 | 145 | Then follow the instructions below for setting it up. 146 | 147 | To build the Snap by yourself, in the main directory of this 148 | repository run 149 | 150 | ``` 151 | snapcraft snap 152 | ``` 153 | 154 | This will download all needed packages and build the Gutenprint 155 | Printer Application. Note that PAPPL and cups-filters (upcoming 2.0) 156 | are pulled directly from their GIT repositories, as there are no 157 | appropriate releases yet. This can also lead to the fact that this 158 | Printer Application will suddenly not build any more. 159 | 160 | To install the resulting Snap run 161 | 162 | ``` 163 | sudo snap install --dangerous gutenprint-printer-app_1.0_amd64.snap 164 | ``` 165 | 166 | 167 | ### Setting up 168 | 169 | The Printer Application will automatically be started as a server daemon. 170 | 171 | Enter the web interface 172 | 173 | ``` 174 | http://localhost:8000/ 175 | ``` 176 | 177 | Use the web interface to add a printer. Supply a name, select the 178 | discovered printer, then select make and model. Also set the installed 179 | accessories, loaded media and the option defaults. Accessory 180 | configuration and option defaults can also offen get polled from the 181 | printer. 182 | 183 | Then print PDF, PostScript, JPEG, Apple Raster, or PWG Raster files 184 | with 185 | 186 | ``` 187 | gutenprint-printer-app FILE 188 | ``` 189 | 190 | or print with CUPS, CUPS (and also cups-browsed) discover and treat 191 | the printers set up with this Printer Application as driverless IPP 192 | printers (IPP Everywhere and AirPrint). 193 | 194 | See 195 | 196 | ``` 197 | gutenprint-printer-app --help 198 | ``` 199 | 200 | for more options. 201 | 202 | Use the "-o log-level=debug" argument for verbose logging in your 203 | terminal window. 204 | 205 | You can add files to `/var/snap/gutenprint-printer-app/common/usb/` 206 | for additional USB quirk rules. Edit the existing files only for quick 207 | tests, as they get replaced at every update of the Snap (to introduce 208 | new rules). 209 | 210 | You can edit the 211 | `/var/snap/gutenprint-printer-app/common/cups/snmp.conf` file for 212 | configuring SNMP network printer discovery. 213 | 214 | ## THE ROCK (OCI CONTAINER IMAGE) 215 | 216 | ### Install from Docker Hub 217 | #### Prerequisites 218 | 219 | 1. **Docker Installed**: Ensure Docker is installed on your system. You can download it from the [official Docker website](https://www.docker.com/get-started). 220 | ```sh 221 | sudo snap install docker 222 | ``` 223 | 224 | #### Step-by-Step Guide 225 | 226 | You can pull the `gutenprint-printer-app` Docker image from either the GitHub Container Registry or Docker Hub. 227 | 228 | **From GitHub Container Registry**
229 | To pull the image from the GitHub Container Registry, run the following command: 230 | ```sh 231 | sudo docker pull ghcr.io/openprinting/gutenprint-printer-app:latest 232 | ``` 233 | 234 | To run the container after pulling the image from the GitHub Container Registry, use: 235 | ```sh 236 | sudo docker run -d \ 237 | --name gutenprint-printer-app \ 238 | --network host \ 239 | -e PORT= \ 240 | ghcr.io/openprinting/gutenprint-printer-app:latest 241 | ``` 242 | 243 | **From Docker Hub**
244 | Alternatively, you can pull the image from Docker Hub, by running: 245 | ```sh 246 | sudo docker pull openprinting/gutenprint-printer-app 247 | ``` 248 | 249 | To run the container after pulling the image from Docker Hub, use: 250 | ```sh 251 | sudo docker run -d \ 252 | --name gutenprint-printer-app \ 253 | --network host \ 254 | -e PORT= \ 255 | openprinting/gutenprint-printer-app:latest 256 | ``` 257 | 258 | - `PORT` is an optional environment variable used to start the printer-app on a specified port. If not provided, it will start on the default port 8000 or, if port 8000 is busy, on 8001 and so on. 259 | - **The container must be started in `--network host` mode** to allow the Printer-Application instance inside the container to access and discover printers available in the local network where the host system is in. 260 | - Alternatively using the internal network of the Docker instance (`-p :8000` instead of `--network host -e PORT=`) only gives access to local printers running on the host system itself. 261 | 262 | ### Setting Up and Running gutenprint-printer-app locally 263 | 264 | #### Prerequisites 265 | 266 | **Docker Installed**: Ensure Docker is installed on your system. You can download it from the [official Docker website](https://www.docker.com/get-started) or from the Snap Store: 267 | ```sh 268 | sudo snap install docker 269 | ``` 270 | 271 | **Rockcraft**: Rockcraft should be installed. You can install Rockcraft using the following command: 272 | ```sh 273 | sudo snap install rockcraft --classic 274 | ``` 275 | 276 | **Skopeo**: Skopeo should be installed to compile `*.rock` files into Docker images. It comes bundled with Rockcraft, so no separate installation is required. 277 | 278 | #### Step-by-Step Guide 279 | 280 | **Build gutenprint-printer-app rock** 281 | 282 | The first step is to build the Rock from the `rockcraft.yaml`. This image will contain all the configurations and dependencies required to run gutenprint-printer-app. 283 | 284 | Open your terminal and navigate to the directory containing your `rockcraft.yaml`, then run the following command: 285 | 286 | ```sh 287 | rockcraft pack -v 288 | ``` 289 | 290 | **Compile to Docker Image** 291 | 292 | Once the rock is built, you need to compile docker image from it. 293 | 294 | ```sh 295 | sudo rockcraft.skopeo --insecure-policy copy oci-archive: docker-daemon:gutenprint-printer-app:latest 296 | ``` 297 | 298 | **Run the gutenprint-printer-app Docker Container** 299 | 300 | ```sh 301 | sudo docker run -d \ 302 | --name gutenprint-printer-app \ 303 | --network host \ 304 | -e PORT= \ 305 | gutenprint-printer-app:latest 306 | ``` 307 | - `PORT` is an optional environment variable used to start the printer-app on a specified port. If not provided, it will start on the default port 8000 or, if port 8000 is busy, on 8001 and so on. 308 | - **The container must be started in `--network host` mode** to allow the Printer-Application instance inside the container to access and discover printers available in the local network where the host system is in. 309 | - Alternatively using the internal network of the Docker instance (`-p :8000` instead of `--network host -e PORT=`) only gives access to local printers running on the host system itself. 310 | 311 | #### Setting up 312 | 313 | Enter the web interface 314 | 315 | ```sh 316 | http://localhost:/ 317 | ``` 318 | 319 | Use the web interface to add a printer. Supply a name, select the 320 | discovered printer, then select make and model. Also set the installed 321 | accessories, loaded media and the option defaults. If the printer is a 322 | PostScript printer, accessory configuration and option defaults can 323 | also often get polled from the printer. 324 | 325 | 326 | ## Included Components 327 | - pappl v1.4.9 328 | - qpdf v11.10.1 329 | - ghostscript ghostpdl-10.05.1rc1_test002 330 | - cups v2.4.12 331 | - libcupsfilters 2.1.1 332 | - libppd 2.1.1 333 | - gutenprint debian/5.3.4.20220624T01008808d602-4 334 | 335 | 336 | ## BUILDING WITHOUT PACKAGING OR INSTALLATION 337 | 338 | You can also do a "quick-and-dirty" build without snapping and without 339 | needing to install [PAPPL](https://www.msweet.org/pappl), 340 | [cups-filters 2.x](https://github.com/OpenPrinting/cups-filters), and 341 | [pappl-retrofit](https://github.com/OpenPrinting/pappl-retrofit) into 342 | your system. You need a directory with the latest GIT snapshot of 343 | PAPPL, the latest GIT snapshot of cups-filters, and the latest GIT 344 | snapshot of pappl-retrofit (master branches of each). They all need to 345 | be compiled (`./autogen.sh; ./configure; make`), installing not 346 | needed. Also install the header files of all needed libraries 347 | (installing "libcups2-dev" should do it). 348 | 349 | In the directory with gutenprint-printer-app.c run the command line 350 | 351 | ``` 352 | gcc -o gutenprint-printer-app gutenprint-printer-app.c $PAPPL_SRC/pappl/libpappl.a $CUPS_FILTERS_SRC/.libs/libppd.a $CUPS_FILTERS_SRC/.libs/libcupsfilters.a $PAPPL_RETROFIT_SRC/.libs/libpappl-retrofit.a -ldl -lpthread -lppd -lcups -lavahi-common -lavahi-client -lgnutls -ljpeg -lpng16 -ltiff -lz -lm -lusb-1.0 -lpam -lqpdf -lstdc++ -I. -I$PAPPL_SRC/pappl -I$CUPS_FILTERS_SRC/ppd -I$CUPS_FILTERS_SRC/cupsfilters -I$PAPPL_RETROFIT_SRC/pappl/retrofit -L$CUPS_FILTERS_SRC/.libs/ -L$PAPPL_RETROFIT_SRC/.libs/ 353 | ``` 354 | 355 | There is also a Makefile, but this needs PAPPL, cups-filters 2.x, and 356 | pappl-retrofit to be installed into your system. 357 | 358 | Run 359 | 360 | ``` 361 | ./gutenprint-printer-app --help 362 | ``` 363 | 364 | When running the non-snapped version, by default, PPD files are 365 | searched for in 366 | 367 | ``` 368 | /usr/share/ppd/ 369 | /usr/lib/cups/driver/ 370 | /var/lib/gutenprint-printer-app/ppd/ 371 | ``` 372 | 373 | You can set the `PPD_PATHS` environment variable to search other 374 | places instead: 375 | 376 | ``` 377 | PPD_PATHS=/path/to/my/ppds:/my/second/place ./gutenprint-printer-app server 378 | ``` 379 | 380 | Simply put a colon-separated list of any amount of paths into the 381 | variable. Creating a wrapper script is recommended. 382 | 383 | Note that with a standard PAPPL installation only the simplified PPD 384 | files of Gutenprint are considered, other PPD files are ignored. If 385 | you want to use the expert PPDs of Gutenprint instead, you need to do 386 | a simple modification on the PAPPL source code, setting 387 | `PAPPL_MAX_VENDOR` in the pappl/printer.h to 256 instead of 32. 388 | 389 | Printers are discovered via CUPS' backends plus Gutenprint's backend 390 | for dye-sublimation printers using a proprietary USB communication 391 | protocols. Printers are accepted if the model is explicitly supported, 392 | but for some printers with common languages (especially PCL 4/5c/e) 393 | there is also generic support. 394 | 395 | USB Quirk rules in `/usr/share/cups/usb` and the `/etc/cups/snmp.conf` 396 | file can get edited if needed. 397 | 398 | Make sure you have Gutenprint and CUPS (at least its backends) 399 | installed. 400 | 401 | You also need Ghostscript to print PDF or PostScript jobs. 402 | 403 | For access to the test page `testpage.ps` use the TESTPAGE_DIR 404 | environment variable: 405 | 406 | ``` 407 | TESTPAGE_DIR=`pwd` PPD_PATHS=/path/to/my/ppds:/my/second/place ./gutenprint-printer-app server 408 | ``` 409 | 410 | or for your own creation of a test page (PostScript, PDF, PNG, JPEG, 411 | Apple Raster, PWG Raster): 412 | 413 | ``` 414 | TESTPAGE=/path/to/my/testpage/my_testpage.ps PPD_PATHS=/path/to/my/ppds:/my/second/place ./gutenprint-printer-app server 415 | ``` 416 | 417 | 418 | ## LEGAL STUFF 419 | 420 | The Gutenprint Printer Application is Copyright © 2020 by Till Kamppeter. 421 | 422 | It is derived from the HP PCL Printer Application, a first working model of 423 | a raster Printer Application using PAPPL. It is available here: 424 | 425 | https://github.com/michaelrsweet/hp-printer-app 426 | 427 | The HP PCL Printer Application is Copyright © 2019-2020 by Michael R Sweet. 428 | 429 | This software is licensed under the Apache License Version 2.0 with an exception 430 | to allow linking against GPL2/LGPL2 software (like older versions of CUPS). See 431 | the files "LICENSE" and "NOTICE" for more information. -------------------------------------------------------------------------------- /testpage.ps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 | %%%% If you can read this, something whent wrong. %%%% 4 | %%%% this is most probably a bug. Report it here: %%%% 5 | %%%% https://github.com/OpenPrinting/gutenprint-printer-app/issues %%%% 6 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7 | %%BoundingBox: 0 0 612 792 8 | %%Pages: 1 9 | %%LanguageLevel: 1 10 | %%DocumentData: Clean7Bit 11 | %%DocumentSuppliedResources: procset testprint/2.3 12 | %%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman 13 | %%Creator: Michael Sweet, Apple Inc. 14 | %%CreationDate: D:20070606214000+0500 15 | %%Title: Test Page 16 | %%EndComments 17 | %%BeginProlog 18 | %%BeginResource procset testprint 2.3 0 19 | % 20 | % Test Page of the OpenPrinting CUPS Printer Driver Retrofit Library 21 | % (derived from the PostScript Test Page for CUPS) 22 | % 23 | % Copyright (c) 2020 by Till Kamppeter 24 | % Copyright (c) 2007-2011 Apple Inc. 25 | % Copyright (c) 1993-2007 Easy Software Products 26 | % 27 | % Licensed under Apache License v2.0. See the file "LICENSE" for more 28 | % information. 29 | % 30 | /SEXTANT { % Draw a color wheel sextant... 31 | % (name) white radius r g b SEXTANT - 32 | % Loop through 100 shades... 33 | 0 0.010101 0.98 { 34 | % Set the color... 35 | dup 0.75 le { % Get "white" value 36 | % Start from black 37 | dup 0.75 div % val2 = val / 0.75 38 | 39 | 0 index 5 index mul % R = R * val2 40 | 1 index 5 index mul % G = G * val2 41 | 2 index 5 index mul % B = B * val2 42 | 43 | 4 -1 roll pop % Discard val2 44 | } { 45 | % Fade to white 46 | dup neg 1 add 4 mul % val2 = (1 - val) * 4 47 | 48 | 0 index 5 index mul % R = R * val2 49 | 1 index neg 1 add add % + (1 - val2) 50 | 1 index 5 index mul % G = G * val2 51 | 2 index neg 1 add add % + (1 - val2) 52 | 2 index 5 index mul % B = B * val2 53 | 3 index neg 1 add add % + (1 - val2) 54 | 55 | 4 -1 roll pop % Discard val2 56 | } ifelse 57 | setrgbcolor % Set the color... 58 | 59 | % Draw the polygon... 60 | newpath % Start a new path... 61 | dup 5 index mul % r1 = radius * val 62 | 0 0 3 -1 roll 0 60 arc % Draw the inner arc 63 | 64 | dup 0.010101 add 5 index mul% r2 = (radius + 0.010101) * val 65 | 0 0 3 -1 roll 60 0 arcn % Draw the outer arc 66 | 67 | closepath % Close the path 68 | fill % Fill it... 69 | 70 | pop % Pop value... 71 | } for 72 | 73 | % Draw a line around the polygons... 74 | pop pop pop dup % Pop R, G, B, start 75 | 0 setgray % Black 76 | newpath 77 | 0 0 moveto % Center 78 | 0 0 3 -1 roll 0 60 arc % Arc around octant 79 | closepath % Back to center 80 | stroke % Stroke it... 81 | 82 | % Draw the label... 83 | dup % Save radius 84 | dup 30 cos mul % X = radius * cos(30) 85 | exch 30 sin mul % Y = radius * sin(30) 86 | moveto % Position label 87 | 88 | gsave 89 | 30 rotate % Rotate label 90 | dup 0.05 mul % Offset to the right 91 | exch -0.05 mul % and down... 92 | rmoveto % Offset label 93 | show % Show label 94 | grestore 95 | } bind def 96 | /CENTER { % Draw centered text 97 | % (name) CENTER - 98 | dup stringwidth pop % Get the width of the string 99 | 0.5 mul neg 0 rmoveto % Shift left 1/2 of the distance 100 | show % Show the string 101 | } bind def 102 | /RIGHT { % Draw right-justified text 103 | % (name) RIGHT - 104 | dup stringwidth pop % Get the width of the string 105 | neg 0 rmoveto % Shift left the entire distance 106 | show % Show the string 107 | } bind def 108 | /NUMBER { % Draw a number 109 | % power n NUMBER - 110 | 1 index 1 eq { % power == 1? 111 | round cvi exch pop % Convert "n" to integer 112 | } { 113 | 1 index mul round exch div % Truncate extra decimal places 114 | } ifelse 115 | 100 string cvs show % Convert to a string and show it... 116 | } bind def 117 | %%EndResource 118 | %%EndProlog 119 | %%Page: 1 1 120 | gsave 121 | 122 | % Determine the imageable area and device resolution... 123 | initclip newpath clippath pathbbox % Get bounding rectangle 124 | 72 div /pageTop exch def % Get top margin in inches 125 | 72 div /pageRight exch def % Get right margin in inches 126 | 72 div /pageBottom exch def % Get bottom margin in inches 127 | 72 div /pageLeft exch def % Get left margin in inches 128 | 129 | 4 setlinewidth % Draw wide lines 130 | 0 setgray closepath stroke % Draw a clipping rectangle 131 | 132 | /pageWidth pageRight pageLeft sub def % pageWidth = pageRight - pageLeft 133 | /pageHeight pageTop pageBottom sub def% pageHeight = pageTop - pageBottom 134 | 135 | 72 72 dtransform % Get device resolution per inch 136 | /yResolution exch abs def % yResolution = abs(yres) 137 | /xResolution exch abs def % xResolution = abs(xres) 138 | 139 | % Figure out the sizes of things... 140 | /wheelSize % size of wheels 141 | pageWidth pageHeight lt 142 | { pageWidth 9 mul } 143 | { pageHeight 7 mul } 144 | ifelse def 145 | 146 | % Create fonts... 147 | /bigFont /Helvetica-Bold findfont % bigFont = Helvetica-Bold 148 | pageHeight 3 mul scalefont def % size = pageHeight * 3 (nominally 33) 149 | 150 | /mediumFont /Helvetica findfont % mediumFont = Helvetica 151 | pageHeight 1.5 mul scalefont def % size = pageHeight * 1.5 (nominally 16.5) 152 | 153 | /mediumBoldFont /Helvetica-Bold findfont % mediumBoldFont = Helvetica-Bold 154 | pageHeight 1.5 mul scalefont def % size = pageHeight * 1.5 (nominally 16.5) 155 | 156 | /smallFont /Times-Roman findfont % smallFont = Times-Roman 157 | pageHeight scalefont def % size = pageHeight (nominally 11) 158 | 159 | % Draw rulers along the edges... 160 | /CENTIMETER 72 2.54 div def 161 | /MILLIMETER 72 25.4 div def 162 | 163 | /Times-Roman findfont % Font for ruler numbers 164 | 11 scalefont setfont % 11 points 165 | 166 | gsave % Left side inches 167 | pageLeft 72 mul 0 translate % Offset left edge 168 | 169 | 1 setlinewidth % Draw normal lines 170 | 72 72 pageTop 72 mul { % Height inches 171 | dup dup 172 | 0 exch moveto 24 0 rlineto stroke % Draw tic mark 173 | 24 exch pageHeight sub moveto % Draw number 174 | 72 div cvi 10 string cvs RIGHT 175 | } for 176 | 177 | 0.5 setlinewidth % Draw thin lines 178 | 18 18 pageTop 72 mul { % 1/4 inches 179 | 0 exch moveto 15 0 rlineto stroke % Draw tic mark 180 | } for 181 | 182 | 9 9 pageTop 72 mul { % 1/8 inches 183 | 0 exch moveto 6 0 rlineto stroke % Draw tic mark 184 | } for 185 | grestore 186 | 187 | gsave % Bottom inches 188 | 0 pageBottom 72 mul translate % Offset bottom edge 189 | 190 | 1 setlinewidth % Draw normal lines 191 | 72 72 pageRight 72 mul { % Width inches 192 | dup dup 193 | 0 moveto 0 24 rlineto stroke % Draw tic mark 194 | 3 add 27 pageHeight sub moveto % Draw number 195 | 72 div cvi 10 string cvs show 196 | } for 197 | 198 | 0.5 setlinewidth % Draw thin lines 199 | 18 18 pageRight 72 mul { % 1/4 inches 200 | 0 moveto 0 15 rlineto stroke % Draw tic mark 201 | } for 202 | 203 | 9 9 pageRight 72 mul { % 1/8 inches 204 | 0 moveto 0 6 rlineto stroke % Draw tic mark 205 | } for 206 | grestore 207 | 208 | gsave % Right side centimeters 209 | pageRight 72 mul 0 translate % Offset right edge 210 | 211 | 1 setlinewidth % Draw normal lines 212 | CENTIMETER CENTIMETER 213 | pageTop 72 mul { % Height centimeters 214 | 0 exch moveto -24 0 rlineto stroke% Draw tic mark 215 | } for 216 | 1 1 pageTop 2.54 mul { % Height labels 217 | dup 218 | -24 exch CENTIMETER mul 219 | pageHeight sub moveto % Draw number 220 | cvi 10 string cvs show 221 | } for 222 | 223 | 0.5 setlinewidth % Draw thin lines 224 | 0 0.5 CENTIMETER mul 225 | pageTop 72 mul { % 1/2 centimeters 226 | 0 exch moveto -15 0 rlineto stroke% Draw tic mark 227 | } for 228 | 0 MILLIMETER pageTop 72 mul { % Millimeters 229 | 0 exch moveto -6 0 rlineto stroke % Draw tic mark 230 | } for 231 | grestore 232 | 233 | gsave % Top centimeters 234 | 0 pageTop 72 mul translate % Offset top edge 235 | 236 | 1 setlinewidth % Draw normal lines 237 | CENTIMETER CENTIMETER 238 | pageRight 72 mul { % Width centimeters 239 | 0 moveto 0 -24 rlineto stroke % Draw tic mark 240 | } for 241 | 1 1 pageRight 2.54 mul { % Width labels 242 | dup 243 | CENTIMETER mul 3 add -24 moveto % Draw number 244 | cvi 10 string cvs show 245 | } for 246 | 247 | 0.5 setlinewidth % Draw thin lines 248 | 0 0.5 CENTIMETER mul 249 | pageRight 72 mul { % 1/2 centimeters 250 | 0 moveto 0 -15 rlineto stroke % Draw tic mark 251 | } for 252 | 0 MILLIMETER pageRight 72 mul { % Millimeters 253 | 0 moveto 0 -6 rlineto stroke % Draw tic mark 254 | } for 255 | grestore 256 | 257 | % Offset page to account for lower-left margin... 258 | pageLeft 72 mul 259 | pageBottom 72 mul 260 | translate 261 | 262 | % Set text font and color... 263 | mediumFont setfont % Font 264 | 0 setgray % Color 265 | 1 setlinewidth % Draw normal lines 266 | 267 | % Draw the color wheel... 268 | gsave 269 | % Position the wheel on the left side... 270 | pageWidth 18 mul % x = pageWidth * 1/4 * 72 271 | pageHeight 54 mul % y = pageHeight * 3/4 * 72 272 | translate 273 | 274 | % Size the wheel... 275 | wheelSize 276 | 277 | % Draw the colors... 278 | dup (C) 3 -1 roll 0 1 1 SEXTANT 60 rotate 279 | dup (M) 3 -1 roll 1 0 1 SEXTANT 60 rotate 280 | dup (Y) 3 -1 roll 1 1 0 SEXTANT 60 rotate 281 | dup (R) 3 -1 roll 1 0 0 SEXTANT 60 rotate 282 | dup (G) 3 -1 roll 0 1 0 SEXTANT 60 rotate 283 | dup (B) 3 -1 roll 0 0 1 SEXTANT 60 rotate 284 | 285 | pop 286 | grestore 287 | 288 | % Label the color wheel... 289 | pageWidth 18 mul % x = pageWidth * 1/4 * 72 290 | pageHeight 43 mul % y = pageHeight * 19/32 * 72 291 | moveto % Position the text 292 | (Color Wheel) CENTER % Show the text centered 293 | 294 | % Draw the gray ramp... 295 | gsave 296 | % Position the gray ramp in the center... 297 | pageWidth 36 mul % x = pageWidth * 1/2 * 72 298 | pageHeight 54 mul % y = pageHeight * 3/4 * 72 299 | wheelSize sub % - wheelSize 300 | translate 301 | 302 | % Loop through 100 shades... 303 | 0 0.010101 0.98 { 304 | % Set the color... 305 | dup setgray % Set the grayscale... 306 | 307 | % Draw the polygon... 308 | newpath % Start a new path... 309 | 310 | wheelSize -0.2 mul % X = -wheelSize / 5 311 | 1 index 2 mul wheelSize mul % Y = val * 2 * wheelSize 312 | moveto % Move there... 313 | 314 | wheelSize 0.4 mul 0 rlineto % Right side... 315 | 316 | wheelSize 0.2 mul % X = wheelSize / 5 317 | 1 index 0.010101 add 2 mul wheelSize mul 318 | % Y = (val + 0.010101) * 2 * wheelSize 319 | lineto % Move there... 320 | 321 | wheelSize -0.4 mul 0 rlineto % Left side... 322 | 323 | closepath % Close the path 324 | fill % Fill it... 325 | 326 | pop % Pop value... 327 | } for 328 | 329 | 0 setgray % Black 330 | 331 | newpath % Start a new path 332 | wheelSize -0.2 mul 0 moveto % Bottom left 333 | wheelSize 0.4 mul 0 rlineto % Bottom right 334 | 0 wheelSize 2 mul rlineto % Upper right 335 | wheelSize -0.4 mul 0 rlineto % Upper left 336 | closepath % Close the path 337 | stroke % Stroke it... 338 | 339 | 0 wheelSize -0.2 mul moveto % Center bottom for label 340 | (K) CENTER % Center K at bottom 341 | 342 | 0 wheelSize 2.05 mul moveto % Center top for label 343 | (W) CENTER % Center W at top 344 | grestore 345 | 346 | % Label the gray ramp... 347 | pageWidth 36 mul % x = pageWidth * 1/2 * 72 348 | pageHeight 43 mul % y = pageHeight * 19/32 * 72 349 | moveto % Position the text 350 | (Gray Ramp) CENTER % Show the text centered 351 | 352 | 353 | % Draw radial lines... 354 | gsave 355 | 0 setlinewidth % 1 pixel lines 356 | 357 | % Position the lines on the left side... 358 | pageWidth 54 mul % x = pageWidth * 3/4 * 72 359 | pageHeight 54 mul % y = pageHeight * 3/4 * 72 360 | translate 361 | 362 | % Size the wheel... 363 | wheelSize 364 | 365 | % Loop at 1 degree increments 366 | 0 1 359 { 367 | pop % Discard angle - not used 368 | 0 0 moveto % Start line at the center 369 | dup 0 lineto % Draw to the radius 370 | 1 rotate % Rotate 1 degree 371 | } for 372 | 373 | pop % Discard radius - not needed anymore 374 | stroke % Draw lines... 375 | 376 | grestore 377 | 378 | % Label the lines... 379 | pageWidth 54 mul % x = pageWidth * 3/4 * 72 380 | pageHeight 43 mul % y = pageHeight * 19/32 * 72 381 | moveto % Position the text 382 | (1 Degree Radial Lines) CENTER % Show the text centered 383 | 384 | % Imageable area... 385 | pageHeight 15 mul % Height of imageable area 386 | 387 | pageWidth 4.5 mul % x = pageWidth * 1/16 * 72 388 | pageHeight 35.5 mul % y = pageHeight * 1/2 * 72 389 | 2 index sub % y -= height 390 | pageWidth 28 mul % width = pageWidth * 1/4 * 72 391 | 3 index % height 392 | 0.5 setgray rectfill % Draw a shadow 393 | 394 | pageWidth 4 mul % x = pageWidth * 1/16 * 72 395 | pageHeight 36 mul % y = pageHeight * 1/2 * 72 396 | 2 index sub % y -= height 397 | pageWidth 28 mul % width = pageWidth * 3/8 * 72 398 | 3 index % height 399 | 4 copy 1 setgray rectfill % Clear the box to white 400 | 0 setgray rectstroke % Draw a black box around it... 401 | 402 | pop % Discard height 403 | 404 | % Label the imageable area... 405 | pageWidth 4 mul % x = pageWidth * 1/16 * 72 406 | pageHeight 37 mul % y = pageHeight * 1/2 * 72 407 | moveto % Position the text 408 | mediumFont setfont % Font 409 | (Imageable Area) show % Show the text 410 | 411 | smallFont setfont % Font 412 | pageWidth 14 mul % x = pageWidth * 3/16 * 72 413 | pageHeight 36 mul % y = pageWidth * 1/2 * 72 414 | pageHeight -2 mul add % y -= 2 * smallFont height 415 | 416 | % Page Size inches 417 | 2 copy moveto % Move to x & y 418 | (Page Size: ) RIGHT % Label 419 | 100 pageWidth NUMBER % pageWidth 420 | (x) show % "x" 421 | 100 pageHeight NUMBER % pageHeight 422 | (in) show % "in" 423 | 424 | % Page Size millimeters 425 | pageHeight sub % Move down... 426 | 427 | 2 copy moveto % Move to x & y 428 | 10 pageWidth 25.4 mul NUMBER % pageWidth 429 | (x) show % "x" 430 | 10 pageHeight 25.4 mul NUMBER % pageHeight 431 | (mm) show % "mm" 432 | 433 | % Lower-left inches 434 | pageHeight 2 mul sub % Move down... 435 | 436 | 2 copy moveto % Move to x & y 437 | (Lower-Left: ) RIGHT % Label 438 | 100 pageLeft NUMBER % pageLeft 439 | (x) show % "x" 440 | 100 pageBottom NUMBER % pageBottom 441 | (in) show % "in" 442 | 443 | % Lower-left millimeters 444 | pageHeight sub % Move down... 445 | 446 | 2 copy moveto % Move to x & y 447 | 10 pageLeft 25.4 mul NUMBER % pageLeft 448 | (x) show % "x" 449 | 10 pageBottom 25.4 mul NUMBER % pageBottom 450 | (mm) show % "mm" 451 | 452 | % Upper-right inches 453 | pageHeight 2 mul sub % Move down... 454 | 455 | 2 copy moveto % Move to x & y 456 | (Upper-Right: ) RIGHT % Label 457 | 100 pageRight NUMBER % pageRight 458 | (x) show % "x" 459 | 100 pageTop NUMBER % pageTop 460 | (in) show % "in" 461 | 462 | % Upper-right millimeters 463 | pageHeight sub % Move down... 464 | 465 | 2 copy moveto % Move to x & y 466 | 10 pageRight 25.4 mul NUMBER % pageRight 467 | (x) show % "x" 468 | 10 pageTop 25.4 mul NUMBER % pageTop 469 | (mm) show % "mm" 470 | 471 | % Resolution dots-per-inch 472 | pageHeight 2 mul sub % Move down... 473 | 474 | 2 copy moveto % Move to x & y 475 | (Resolution: ) RIGHT % Label 476 | 1 xResolution NUMBER % xResolution 477 | (x) show % "x" 478 | 1 yResolution NUMBER % yResolution 479 | (dpi) show % "dpi" 480 | 481 | % Resolution dots-per-meter 482 | pageHeight sub % Move down... 483 | 484 | moveto % Move to x & y 485 | 1 xResolution 39.27 mul NUMBER % xResolution 486 | (x) show % "x" 487 | 1 yResolution 39.27 mul NUMBER % yResolution 488 | (dpm) show % "dpm" 489 | 490 | % Interpreter Information... 491 | pageHeight 15 mul % Height of interpreter information 492 | 493 | pageWidth 40.5 mul % x = pageWidth * 9/16 * 72 494 | pageHeight 35.5 mul % y = pageHeight * 1/2 * 72 495 | 2 index sub % y -= height 496 | pageWidth 28 mul % width = pageWidth * 1/4 * 72 497 | 3 index % height 498 | 0.5 setgray rectfill % Draw a shadow 499 | 500 | pageWidth 40 mul % x = pageWidth * 9/16 * 72 501 | pageHeight 36 mul % y = pageHeight * 1/2 * 72 502 | 2 index sub % y -= height 503 | pageWidth 28 mul % width = pageWidth * 3/8 * 72 504 | 3 index % height 505 | 4 copy 1 setgray rectfill % Clear the box to white 506 | 0 setgray rectstroke % Draw a black box around it... 507 | 508 | pop % Discard height 509 | 510 | % Label the interpreter info... 511 | pageWidth 40 mul % x = pageWidth * 9/16 * 72 512 | pageHeight 37 mul % y = pageHeight * 1/2 * 72 513 | moveto % Position the text 514 | mediumFont setfont % Font 515 | (Interpreter Information) show % Show the text 516 | 517 | smallFont setfont % Font 518 | pageWidth 49 mul % x = pageWidth * 11/16 * 72 519 | pageHeight 36 mul % y = pageWidth * 1/2 * 72 520 | pageHeight 2 mul sub % y -= 2 * smallFont height 521 | 522 | % Language level 523 | 2 copy moveto % Move to x & y 524 | (PostScript: ) RIGHT % Label 525 | (Level ) show % "Level " 526 | 1 languagelevel NUMBER % Language level 527 | 528 | % Version 529 | pageHeight 2 mul sub % Move down... 530 | 2 copy moveto % Move to x & y 531 | (Version: ) RIGHT % Label 532 | version show % Version 533 | ( \() show % " (" 534 | 1 revision NUMBER % Revision 535 | (\)) show % ")" 536 | 537 | % Product 538 | pageHeight 2 mul sub % Move down... 539 | 2 copy moveto % Move to x & y 540 | (Product: ) RIGHT % Label 541 | product show % Product name 542 | 543 | % Serial Number 544 | pageHeight 2 mul sub % Move down... 545 | moveto % Move to x & y 546 | (Serial #: ) RIGHT % Label 547 | 1 serialnumber NUMBER % S/N 548 | 549 | % Draw the label at the top... 550 | pageWidth 36 mul % Center of page 551 | pageHeight 66 mul % Top of page (11/12ths) 552 | moveto % Position text 553 | bigFont setfont % Font 554 | (Printer Test Page) CENTER % Show text centered 555 | 556 | % Draw bottom message text... 557 | pageWidth 36 mul % Center of page 558 | pageHeight 14 mul % Bottom of page 559 | moveto % Position text 560 | mediumBoldFont setfont % Font 561 | (Printed with the OpenPrinting Gutenprint Printer Application) CENTER 562 | 563 | % Draw the copyright notice at the bottom... 564 | pageWidth 4 mul % Left side of page 565 | pageHeight 5 mul % Move down... 566 | 2 copy moveto % Position text 567 | smallFont setfont % Font 568 | (Copyright 2020-2021 by Till Kamppeter) show 569 | pageHeight 2 add sub % Move down... 570 | 2 copy moveto % Position text 571 | (Copyright (c) 2007-2011 Apple Inc.) show 572 | pageHeight 2 add sub % Move down... 573 | moveto % Position text 574 | (Copyright (c) 1993-2007 Easy Software Products) show 575 | 576 | % Show the page... 577 | grestore 578 | showpage 579 | %%EOF 580 | -------------------------------------------------------------------------------- /rockcraft.yaml: -------------------------------------------------------------------------------- 1 | name: gutenprint-printer-app 2 | base: ubuntu@22.04 3 | version: '5.3.4-11' 4 | summary: Gutenprint Printer Application 5 | description: | 6 | The Gutenprint Printer Application is a PAPPL (Printer Application 7 | Framework) based Printer Application to support printers using the 8 | Gutenprint printer driver. 9 | 10 | adopt-info: gutenprint 11 | 12 | # Only build on the architectures supported 13 | platforms: 14 | arm64: 15 | amd64: 16 | armhf: 17 | 18 | services: 19 | dbus: 20 | command: /scripts/run-dbus.sh 21 | override: replace 22 | on-failure: restart 23 | startup: enabled 24 | 25 | gutenprint-printer-app: 26 | command: /scripts/start-server.sh 27 | override: replace 28 | on-failure: restart 29 | startup: enabled 30 | after: [dbus] 31 | 32 | parts: 33 | pappl: 34 | source: https://github.com/michaelrsweet/pappl 35 | source-type: git 36 | source-tag: 'v1.4.9' 37 | source-depth: 1 38 | # ext:updatesnap 39 | # version-format: 40 | # lower-than: '2' 41 | # no-9x-revisions: true 42 | plugin: autotools 43 | override-build: | 44 | set -eux 45 | # Raise the supported number of vendor-specific options/attributes in 46 | # PAPPL to 256, as the original 32 is too small for Gutenprint's 47 | # expert PPDs 48 | perl -p -i -e 's/(define\s+PAPPL_MAX_VENDOR\s+)32/\1 256/' pappl/printer.h 49 | # De-activate log-rotating. It does not work with the forked processes 50 | # of the filters 51 | perl -p -i -e 's/(system->logmaxsize\s+=).*/\1 0;/' pappl/system.c 52 | # As we do not use PAPPL's own backends but the CUPS backends using the 53 | # "cups" device scheme of pappl-retrofit, we let the manual "Network 54 | # Printer" device on the "Add Printer" page of the web interface use a 55 | # "cups:socket://..." URI instead of simply "socket://..." 56 | perl -p -i -e 's/(httpAssembleURI\(.*?)"socket"(.*?\))/\1"cups:socket"\2/' pappl/system-webif.c 57 | # PAPPL's build system does not insert the LDFLAGS when linking. 58 | # Patching Makedefs.in to fix this 59 | perl -p -i -e 's/^(\s*DSOFLAGS\s*=\s*\S*\s+)/\1\$\(LDFLAGS\) /' Makedefs.in 60 | craftctl default 61 | autotools-configure-parameters: 62 | - --prefix=/usr 63 | - --enable-libjpeg 64 | - --enable-libpng 65 | - --enable-libusb 66 | - --with-dnssd=avahi 67 | build-packages: 68 | - libavahi-client-dev 69 | - libgnutls28-dev 70 | - libjpeg-dev 71 | - libpam0g-dev 72 | - libpng-dev 73 | - libusb-1.0-0-dev 74 | - zlib1g-dev 75 | - perl-base 76 | stage-packages: 77 | # We stage libavahi-client3 already in the "cups" part, to stage 78 | # everything Avahi-related there, to avoid any file clashes. 79 | #- libavahi-client3 80 | - libpng16-16 81 | - libusb-1.0-0 82 | prime: 83 | - -etc/fonts 84 | - -var 85 | - lib/*/lib*.so* 86 | - usr/lib/lib*.so* 87 | - usr/lib/*/lib*.so* 88 | - -usr/include 89 | - -usr/lib/pkgconfig 90 | - -usr/share/fonts 91 | - -usr/share/man 92 | - -usr/share/doc 93 | - -usr/share/doc-base 94 | - -usr/share/lintian 95 | after: [cups] 96 | 97 | pappl-retrofit: 98 | source: https://github.com/openprinting/pappl-retrofit 99 | source-type: git 100 | # source-tag: '1.0b2' 101 | source-depth: 1 102 | # ext:updatesnap 103 | # version-format: 104 | # ignore: true 105 | # format: '%V' 106 | plugin: autotools 107 | autotools-configure-parameters: 108 | - --prefix=/usr 109 | # To find the libraries built in this Snap 110 | build-environment: 111 | - LD_LIBRARY_PATH: "${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$CRAFT_STAGE/usr/lib" 112 | build-packages: 113 | - autoconf 114 | - automake 115 | - libtool 116 | - autotools-dev 117 | - pkg-config 118 | - perl-base 119 | stage-packages: 120 | - libusb-1.0-0 121 | organize: 122 | usr/share/legacy-printer-app/testpage.pdf: usr/share/gutenprint-printer-app/testpage.pdf 123 | prime: 124 | - lib/*/lib*.so* 125 | - usr/lib/lib*.so* 126 | - usr/lib/*/lib*.so* 127 | - usr/share/gutenprint-printer-app/testpage.pdf 128 | - -var 129 | - -usr/var 130 | - -usr/bin/legacy-printer-app 131 | - -usr/include 132 | - -usr/lib/pkgconfig 133 | - -usr/lib/legacy-printer-app 134 | - -usr/share/legacy-printer-app 135 | - -usr/share/fonts 136 | - -usr/share/man 137 | - -usr/share/doc 138 | - -usr/share/doc-base 139 | - -usr/share/lintian 140 | after: [cups, pappl, libcupsfilters, libppd] 141 | 142 | qpdf: 143 | source: https://github.com/qpdf/qpdf/ 144 | source-type: git 145 | source-tag: 'v11.10.1' 146 | source-depth: 1 147 | # ext:updatesnap 148 | # version-format: 149 | # lower-than: '12' 150 | # no-9x-revisions: true 151 | plugin: cmake 152 | cmake-parameters: 153 | - -DCMAKE_INSTALL_PREFIX=/ 154 | - -DCMAKE_BUILD_RPATH_USE_ORIGIN=1 155 | - -DUSE_IMPLICIT_CRYPTO=0 156 | - -DREQUIRE_CRYPTO_GNUTLS=1 157 | - -DSHOW_FAILED_TEST_OUTPUT=1 158 | - -DCMAKE_BUILD_TYPE=RelWithDebInfo 159 | - -DQTEST_COLOR=0 160 | build-packages: 161 | - cmake 162 | - g++ 163 | - libjpeg-dev 164 | - zlib1g-dev 165 | - libgnutls28-dev 166 | stage-packages: 167 | - libjpeg-turbo8 168 | stage: 169 | # The *.la file which gets installed by "make install" contains a 170 | # wrong prefix, breaking parts of this Snap which use this library 171 | - -usr/lib/lib*.la 172 | prime: 173 | - lib/*/lib*.so* 174 | - usr/lib/lib*.so* 175 | - usr/lib/*/lib*.so* 176 | - -etc/fonts 177 | - -var 178 | - -usr/include 179 | - -share/man 180 | - -share/doc 181 | - -share/lintian 182 | - -usr/share/fonts 183 | - -usr/share/man 184 | - -usr/share/doc 185 | - -usr/share/doc-base 186 | - -usr/share/lintian 187 | - -usr/lib/libqpdf.a 188 | - -usr/lib/libqpdf.la 189 | - -usr/lib/pkgconfig 190 | 191 | ghostscript: 192 | #source: https://git.ghostscript.com/ghostpdl.git 193 | source: https://github.com/ArtifexSoftware/ghostpdl.git 194 | source-type: git 195 | source-tag: 'ghostpdl-10.05.1rc1_test002' 196 | source-depth: 1 197 | # ext:updatesnap 198 | # version-format: 199 | # format: "ghostpdl-%M.%m.%R" 200 | # lower-than: '11' 201 | # no-9x-revisions: true 202 | plugin: autotools 203 | # We only need Raster and PostScript output 204 | autotools-configure-parameters: 205 | - --prefix=/usr 206 | - --without-x 207 | - --disable-gtk 208 | - --with-drivers=cups,pwgraster,ps2write 209 | - --enable-freetype 210 | - --without-tesseract 211 | - --without-gpdl 212 | - --without-xps 213 | - --without-pcl 214 | stage-packages: 215 | - libpaper1 216 | - libfontconfig1 217 | - libfreetype6 218 | - libpng16-16 219 | prime: 220 | - usr/bin/gs 221 | - lib/*/lib*.so* 222 | - usr/lib/*/lib*.so* 223 | - usr/share/ghostscript 224 | - -etc/fonts 225 | - -var 226 | - -usr/include 227 | - -usr/lib/pkgconfig 228 | - -usr/share/fonts 229 | - -usr/share/man 230 | - -usr/share/doc 231 | - -usr/share/doc-base 232 | - -usr/share/lintian 233 | after: [cups] 234 | 235 | cups: 236 | source: https://github.com/OpenPrinting/cups 237 | source-type: git 238 | source-tag: 'v2.4.12' 239 | source-depth: 1 240 | # ext:updatesnap 241 | # version-format: 242 | # lower-than: '3' 243 | # no-9x-revisions: true 244 | plugin: autotools 245 | # We only need libcups (with headers, ...) and the backends 246 | override-build: | 247 | set -eux 248 | patch -p1 < $CRAFT_PROJECT_DIR/patches/cups-dnssd-backend-socket-only.patch 249 | # We use "--with-tls=gnutls" here, as current CUPS defaults to SSL here 250 | # and this is buggy, causing a segfault when serving out a HTTPS web 251 | # interface page. 252 | ./configure --sysconfdir=/var/snap/gutenprint-printer-app/common/ --with-tls=gnutls 253 | cd cups 254 | make 255 | cd .. 256 | cd backend 257 | # Have USB quirk files in user-modifiable space for debugging 258 | perl -p -i -e 's/"CUPS_DATADIR"/"USB_QUIRK_DIR"/' usb-libusb.c 259 | make snmp dnssd socket ipp ipps lpd usb 260 | cd .. 261 | mkdir -p $CRAFT_PART_INSTALL/usr/lib 262 | cp cups/libcups*.a $CRAFT_PART_INSTALL/usr/lib/ 263 | cp -P cups/libcups.so* $CRAFT_PART_INSTALL/usr/lib/ 264 | mkdir -p $CRAFT_PART_INSTALL/usr/include/cups 265 | cp cups/*.h $CRAFT_PART_INSTALL/usr/include/cups/ 266 | mkdir -p $CRAFT_PART_INSTALL/usr/bin 267 | cp cups-config $CRAFT_PART_INSTALL/usr/bin/ 268 | mkdir -p $CRAFT_PART_INSTALL/usr/lib/gutenprint-printer-app/backend/ 269 | (cd backend; \ 270 | cp snmp dnssd socket ipp ipps lpd usb org.cups.usb-quirks $CRAFT_PART_INSTALL/usr/lib/gutenprint-printer-app/backend/ \ 271 | ) 272 | cp conf/snmp.conf $CRAFT_PART_INSTALL/usr/lib/gutenprint-printer-app/backend/ 273 | build-packages: 274 | - patch 275 | - gettext 276 | - autoconf 277 | - automake 278 | - libtool 279 | - autotools-dev 280 | - pkg-config 281 | - libavahi-client-dev 282 | - libavahi-common-dev 283 | - libavahi-compat-libdnssd-dev 284 | - libdbus-1-dev 285 | - libfontconfig1-dev 286 | - libfreetype6-dev 287 | - libgnutls28-dev 288 | - libjpeg-dev 289 | - libkrb5-dev 290 | - libpam0g-dev 291 | - libpaper-dev 292 | - libpng-dev 293 | - libusb-1.0-0-dev 294 | - perl-base 295 | stage-packages: 296 | - libusb-1.0-0 297 | # We stage everything Avahi-related here and do not stage 298 | # anything of this in the pappl part to avoid any file clashes. 299 | - libavahi-common3 300 | - libavahi-client3 301 | prime: 302 | - -etc/fonts 303 | - -var 304 | - -usr/include 305 | - -usr/lib/pkgconfig 306 | - -usr/share/cups 307 | - -usr/share/fonts 308 | - -usr/share/man 309 | - -usr/share/doc 310 | - -usr/share/doc-base 311 | - -usr/share/lintian 312 | - lib/*/lib*.so* 313 | - usr/lib/lib*.so* 314 | - usr/lib/*/lib*.so* 315 | - usr/lib/gutenprint-printer-app/backend/* 316 | 317 | libcupsfilters: 318 | source: https://github.com/OpenPrinting/libcupsfilters 319 | source-type: git 320 | source-tag: '2.1.1' 321 | source-depth: 1 322 | # ext:updatesnap 323 | # version-format: 324 | # lower-than: '3' 325 | # no-9x-revisions: true 326 | plugin: autotools 327 | # We only need libcupsfilters itself. so we simply do not prime the 328 | # auxiliary files (/usr/share) 329 | autotools-configure-parameters: 330 | - --prefix=/usr 331 | - --disable-avahi 332 | - --disable-mutool 333 | build-packages: 334 | - gettext 335 | - autoconf 336 | - automake 337 | - autotools-dev 338 | - pkg-config 339 | - g++ 340 | - sharutils 341 | - liblcms2-dev 342 | - libpoppler-cpp-dev 343 | - libpng-dev 344 | - libjpeg-dev 345 | - libtiff5-dev 346 | - zlib1g-dev 347 | - libfontconfig1-dev 348 | - libdbus-1-dev 349 | - libexif-dev 350 | stage-packages: 351 | - libpoppler-cpp0v5 352 | - libjbig0 353 | - liblcms2-2 354 | - libnspr4 355 | - libnss3 356 | - libopenjp2-7 357 | - libpoppler118 358 | # We stage libtiff5 and libwebp7 here and do not stage them in the 359 | # "gutenprint-printer-app" part to avoid any file clashes. 360 | - libtiff5 361 | - libwebp7 362 | - libexif12 363 | stage: 364 | - -usr/lib/lib*.la 365 | # The *.la file which gets installed by "make install" contains a 366 | # wrong prefix, breaking parts of this Snap which use this library 367 | prime: 368 | - -etc 369 | - -var 370 | - -usr/include 371 | - -usr/lib/pkgconfig 372 | - usr/share/cups 373 | - -usr/share/fonts 374 | - -usr/share/man 375 | - -usr/share/doc 376 | - -usr/share/doc-base 377 | - -usr/share/lintian 378 | - lib/*/lib*.so* 379 | - usr/lib/lib*.so* 380 | - usr/lib/*/lib*.so* 381 | - usr/lib/*/nss 382 | # Reported unused by snapcraft linter 383 | - -usr/lib/*/libssl3.* 384 | after: [cups, qpdf, ghostscript] 385 | 386 | libppd: 387 | source: https://github.com/OpenPrinting/libppd 388 | source-type: git 389 | source-tag: '2.1.1' 390 | source-depth: 1 391 | # ext:updatesnap 392 | # version-format: 393 | # lower-than: '3' 394 | # no-9x-revisions: true 395 | plugin: autotools 396 | # We only need libppd itself 397 | autotools-configure-parameters: 398 | - --prefix=/usr 399 | - --disable-mutool 400 | - --disable-pdftocairo 401 | - --disable-acroread 402 | - --with-pdftops-path=/snap/gutenprint-printer-app/current/usr/bin/pdftops 403 | # To find the libraries built in this Snap 404 | build-environment: 405 | - LD_LIBRARY_PATH: "${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$CRAFT_STAGE/usr/lib" 406 | build-packages: 407 | - gettext 408 | - autoconf 409 | - automake 410 | - autotools-dev 411 | - pkg-config 412 | - g++ 413 | - sharutils 414 | - poppler-utils 415 | prime: 416 | - -etc 417 | - -var 418 | - -usr/include 419 | - -usr/lib/pkgconfig 420 | - -usr/share/ppdc 421 | - -usr/share/fonts 422 | - -usr/share/man 423 | - -usr/share/doc 424 | - -usr/share/doc-base 425 | - -usr/share/lintian 426 | - lib/*/lib*.so* 427 | - usr/lib/lib*.so* 428 | - usr/lib/*/lib*.so* 429 | - usr/lib/*/nss 430 | after: [cups, ghostscript, libcupsfilters] 431 | 432 | gutenprint: 433 | # github source 434 | # source: https://github.com/echiu64/gutenprint.git 435 | source: https://salsa.debian.org/printing-team/gutenprint.git 436 | source-type: git 437 | source-tag: 'debian/5.3.4.20220624T01008808d602-4' 438 | # github source tag 439 | # source-tag: 'gutenprint-5_3_3' 440 | source-depth: 1 441 | # ext:updatesnap 442 | # version-format: 443 | # format: 'debian/%V' 444 | # lower-than: '6' 445 | # no-9x-revisions: true 446 | plugin: autotools 447 | # We only need the library, the XML resources, and the CUPS driver 448 | # (PPD generator, filter, backend) 449 | autotools-configure-parameters: 450 | - --prefix=/usr 451 | - --datarootdir=/snap/gutenprint-printer-app/current/usr/share 452 | - --enable-shared 453 | - --disable-rpath 454 | - --with-modules=static 455 | - --without-gimp2 456 | - --disable-libgutenprintui2 457 | - --with-cups 458 | - --enable-cups-level3-ppds 459 | - --enable-translated-cups-ppds 460 | - --enable-simplified-cups-ppds 461 | - --enable-cups-1_2-enhancements 462 | - --disable-cups-ppds 463 | - --enable-escputil 464 | - --disable-samples 465 | - --disable-test 466 | - --disable-testpattern 467 | - --enable-nls 468 | - --without-doc 469 | build-packages: 470 | - byacc 471 | - libreadline-dev 472 | - libusb-1.0-0-dev 473 | - zlib1g-dev 474 | - flex 475 | - gettext 476 | - chrpath 477 | - libtool-bin 478 | - curl 479 | organize: 480 | snap/gutenprint-printer-app/current/usr/share: usr/share 481 | usr/lib/cups/filter/rastertogutenprint.5.3: usr/lib/gutenprint-printer-app/filter/rastertogutenprint.5.3 482 | usr/lib/cups/filter/commandtoepson: usr/lib/gutenprint-printer-app/filter/commandtoepson 483 | usr/lib/cups/filter/commandtocanon: usr/lib/gutenprint-printer-app/filter/commandtocanon 484 | usr/lib/cups/backend/gutenprint53+usb: usr/lib/gutenprint-printer-app/backend/gutenprint53+usb 485 | usr/share/cups/usb/net.sf.gimp-print.usb-quirks: usr/lib/gutenprint-printer-app/backend/net.sf.gimp-print.usb-quirks 486 | usr/lib/cups/driver/gutenprint.5.3: usr/share/ppd/gutenprint.5.3 487 | prime: 488 | - usr/bin/cups-calibrate 489 | - usr/bin/escputil 490 | - usr/sbin/*genppd* 491 | - usr/lib/lib*.so* 492 | - usr/lib/gutenprint-printer-app 493 | - usr/share/ppd/gutenprint.5.3 494 | - usr/share/gutenprint 495 | - usr/share/locale 496 | - usr/share/cups/calibrate.ppm 497 | - -snap 498 | - -etc/fonts 499 | - -var 500 | - -usr/include 501 | - -share/man 502 | - -share/doc 503 | - -share/lintian 504 | - -usr/share/fonts 505 | - -usr/share/man 506 | - -usr/share/doc 507 | - -usr/share/doc-base 508 | - -usr/share/lintian 509 | - -usr/share/gutenprint/doc 510 | - -usr/lib/gutenprint 511 | - -usr/lib/libgutenprint.a 512 | - -usr/lib/libgutenprint.la 513 | - -usr/lib/pkgconfig 514 | - -usr/lib/cups 515 | after: [cups] 516 | 517 | gutenprint-printer-app: 518 | plugin: make 519 | source: . 520 | make-parameters: 521 | - LDFLAGS="$LDFLAGS -ljpeg" 522 | - VERSION="$VERSION" 523 | # To find the libraries built in this Snap 524 | build-environment: 525 | - LD_LIBRARY_PATH: "${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$CRAFT_STAGE/usr/lib" 526 | # To improve convenience for developers (and everyone who wants to 527 | # build from source), we do a "make clean" before "make" here, 528 | # because if we had done "make" off-Snap, directly in the source 529 | # tree. and afterwards build the Snap with snapcraft, the build 530 | # sucks in our local binary of gutenprint-printer-app instead of 531 | # compiling its own one in the Snap harness with the appropriate 532 | # libraries, ending up with the Snap containing an executable 533 | # which does not work inside the Snap. The "make clean" removes 534 | # any accidentally grabbed binary. 535 | # 536 | # We need to directly call the "make" and "make install" commands 537 | # here as we cannot inject an environment variable into the default 538 | # build process ("craftctl default") and we also cannot call 539 | # "craftctl get version" in the lines of "make-parameters:" or 540 | # "build-environment:". This way we get the version number of our 541 | # Snap (which is extracted from the Gutenprint upstream source) 542 | # into the gutenprint-printer-app executable. 543 | override-build: | 544 | set -eux 545 | make clean 546 | VERSION="`craftctl get version`" 547 | make -j"8" LDFLAGS="$LDFLAGS -ljpeg" VERSION="$VERSION" 548 | make -j"8" install LDFLAGS="$LDFLAGS -ljpeg" VERSION="$VERSION" DESTDIR="$CRAFT_PART_INSTALL" 549 | #craftctl default 550 | build-packages: 551 | - libusb-1.0-0-dev 552 | stage-packages: 553 | - libusb-1.0-0 554 | - libjbig0 555 | - liblcms2-2 556 | # We stage libtiff5 and libwebp7 already in the "libcupsfilters" part, so 557 | # we do not stage them here again, to avoid any file clashes. 558 | #- libtiff5 559 | #- libwebp7 560 | stage: 561 | - -usr/lib/gutenprint-printer-app 562 | prime: 563 | - usr/bin/gutenprint-printer-app 564 | - lib/*/lib*.so* 565 | - usr/lib/*/lib*.so* 566 | - usr/share/gutenprint-printer-app 567 | - -var 568 | - -usr/share/man 569 | # Reported unused by snapcraft linter 570 | - -usr/lib/*/libgssapi.* 571 | after: [pappl-retrofit, pappl, libcupsfilters, libppd, gutenprint] 572 | 573 | avahi-daemon: 574 | plugin: nil 575 | overlay-packages: 576 | - avahi-daemon 577 | - avahi-utils 578 | - libnss-mdns 579 | - mdns-scan 580 | - dbus 581 | 582 | utils: 583 | plugin: nil 584 | overlay-packages: 585 | - python3 586 | 587 | scripts: 588 | plugin: dump 589 | source: scripts/ 590 | organize: 591 | run-dbus.sh: /scripts/run-dbus.sh 592 | start-server.sh: /scripts/start-server.sh 593 | override-prime: | 594 | set -eux 595 | craftctl default 596 | # Ensure the run-dbus.sh script has executable permissions 597 | if [ -f "$CRAFT_PRIME/scripts/run-dbus.sh" ]; then 598 | chmod +x "$CRAFT_PRIME/scripts/run-dbus.sh" 599 | fi 600 | # Ensure the start-server.sh script has executable permissions 601 | if [ -f "$CRAFT_PRIME/scripts/start-server.sh" ]; then 602 | chmod +x "$CRAFT_PRIME/scripts/start-server.sh" 603 | fi 604 | -------------------------------------------------------------------------------- /snap/snapcraft.yaml: -------------------------------------------------------------------------------- 1 | name: gutenprint-printer-app 2 | base: core22 3 | version: '5.3.4-9' 4 | grade: stable 5 | summary: Gutenprint Printer Application 6 | description: | 7 | The Gutenprint Printer Application is a PAPPL (Printer Application 8 | Framework) based Printer Application to support printers using the 9 | Gutenprint printer driver. 10 | 11 | confinement: strict 12 | adopt-info: gutenprint 13 | 14 | # Only build on the architectures supported 15 | architectures: 16 | - build-on: amd64 17 | - build-on: arm64 18 | - build-on: armhf 19 | - build-on: riscv64 20 | 21 | apps: 22 | gutenprint-printer-app-server: 23 | command: scripts/run-gutenprint-printer-app-server 24 | daemon: simple 25 | # Use a systemd timeout longer than 1 min as PAPPL has a 1-minute 26 | # shutdown timeout if there are pending jobs for which the printer 27 | # is not responding. This way we avoid the Printer Application 28 | # getting killed and shut down uncleanly. 29 | stop-timeout: 70s 30 | plugs: [avahi-control, home, network, network-bind, raw-usb] 31 | gutenprint-printer-app: 32 | command: scripts/run-gutenprint-printer-app 33 | plugs: [avahi-control, home, network, network-bind, raw-usb] 34 | 35 | parts: 36 | pappl: 37 | source: https://github.com/michaelrsweet/pappl 38 | source-type: git 39 | source-tag: 'v1.4.9' 40 | source-depth: 1 41 | # ext:updatesnap 42 | # version-format: 43 | # lower-than: '2' 44 | # no-9x-revisions: true 45 | plugin: autotools 46 | override-build: | 47 | set -eux 48 | # Raise the supported number of vendor-specific options/attributes in 49 | # PAPPL to 256, as the original 32 is too small for Gutenprint's 50 | # expert PPDs 51 | perl -p -i -e 's/(define\s+PAPPL_MAX_VENDOR\s+)32/\1 256/' pappl/printer.h 52 | # De-activate log-rotating. It does not work with the forked processes 53 | # of the filters 54 | perl -p -i -e 's/(system->logmaxsize\s+=).*/\1 0;/' pappl/system.c 55 | # As we do not use PAPPL's own backends but the CUPS backends using the 56 | # "cups" device scheme of pappl-retrofit, we let the manual "Network 57 | # Printer" device on the "Add Printer" page of the web interface use a 58 | # "cups:socket://..." URI instead of simply "socket://..." 59 | perl -p -i -e 's/(httpAssembleURI\(.*?)"socket"(.*?\))/\1"cups:socket"\2/' pappl/system-webif.c 60 | # PAPPL's build system does not insert the LDFLAGS when linking. 61 | # Patching Makedefs.in to fix this 62 | perl -p -i -e 's/^(\s*DSOFLAGS\s*=\s*\S*\s+)/\1\$\(LDFLAGS\) /' Makedefs.in 63 | craftctl default 64 | autotools-configure-parameters: 65 | - --prefix=/usr 66 | - --with-papplstatedir=/var/snap/gutenprint-printer-app/common 67 | - --with-papplsockdir=/var/snap/gutenprint-printer-app/common/tmp 68 | - --enable-libjpeg 69 | - --enable-libpng 70 | - --enable-libusb 71 | - --with-dnssd=avahi 72 | build-packages: 73 | - libavahi-client-dev 74 | - libgnutls28-dev 75 | - libjpeg-dev 76 | - libpam0g-dev 77 | - libpng-dev 78 | - libusb-1.0-0-dev 79 | - zlib1g-dev 80 | - perl-base 81 | stage-packages: 82 | # We stage libavahi-client3 already in the "cups" part, to stage 83 | # everything Avahi-related there, to avoid any file clashes. 84 | #- libavahi-client3 85 | - libpng16-16 86 | - libusb-1.0-0 87 | prime: 88 | - -etc/fonts 89 | - -var 90 | - lib/*/lib*.so* 91 | - usr/lib/lib*.so* 92 | - usr/lib/*/lib*.so* 93 | - -usr/include 94 | - -usr/lib/pkgconfig 95 | - -usr/share/fonts 96 | - -usr/share/man 97 | - -usr/share/doc 98 | - -usr/share/doc-base 99 | - -usr/share/lintian 100 | - -snap 101 | after: [cups] 102 | 103 | pappl-retrofit: 104 | source: https://github.com/openprinting/pappl-retrofit 105 | source-type: git 106 | # source-tag: '1.0b2' 107 | source-depth: 1 108 | # ext:updatesnap 109 | # version-format: 110 | # ignore: true 111 | # format: '%V' 112 | plugin: autotools 113 | autotools-configure-parameters: 114 | - --prefix=/usr 115 | # To find the libraries built in this Snap 116 | build-environment: 117 | - LD_LIBRARY_PATH: "${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$CRAFT_STAGE/usr/lib" 118 | build-packages: 119 | - autoconf 120 | - automake 121 | - libtool 122 | - autotools-dev 123 | - pkg-config 124 | - perl-base 125 | stage-packages: 126 | - libusb-1.0-0 127 | organize: 128 | usr/share/legacy-printer-app/testpage.pdf: usr/share/gutenprint-printer-app/testpage.pdf 129 | prime: 130 | - lib/*/lib*.so* 131 | - usr/lib/lib*.so* 132 | - usr/lib/*/lib*.so* 133 | - usr/share/gutenprint-printer-app/testpage.pdf 134 | - -var 135 | - -usr/var 136 | - -usr/bin/legacy-printer-app 137 | - -usr/include 138 | - -usr/lib/pkgconfig 139 | - -usr/lib/legacy-printer-app 140 | - -usr/share/legacy-printer-app 141 | - -usr/share/fonts 142 | - -usr/share/man 143 | - -usr/share/doc 144 | - -usr/share/doc-base 145 | - -usr/share/lintian 146 | - -snap 147 | after: [cups, pappl, libcupsfilters, libppd] 148 | 149 | qpdf: 150 | source: https://github.com/qpdf/qpdf/ 151 | source-type: git 152 | source-tag: 'v11.10.1' 153 | source-depth: 1 154 | # ext:updatesnap 155 | # version-format: 156 | # lower-than: '12' 157 | # no-9x-revisions: true 158 | plugin: cmake 159 | cmake-parameters: 160 | - -DCMAKE_INSTALL_PREFIX=/ 161 | - -DCMAKE_BUILD_RPATH_USE_ORIGIN=1 162 | - -DUSE_IMPLICIT_CRYPTO=0 163 | - -DREQUIRE_CRYPTO_GNUTLS=1 164 | - -DSHOW_FAILED_TEST_OUTPUT=1 165 | - -DCMAKE_BUILD_TYPE=RelWithDebInfo 166 | - -DQTEST_COLOR=0 167 | build-packages: 168 | - cmake 169 | - g++ 170 | - libjpeg-dev 171 | - zlib1g-dev 172 | - libgnutls28-dev 173 | stage-packages: 174 | - libjpeg-turbo8 175 | stage: 176 | # The *.la file which gets installed by "make install" contains a 177 | # wrong prefix, breaking parts of this Snap which use this library 178 | - -usr/lib/lib*.la 179 | prime: 180 | - lib/*/lib*.so* 181 | - usr/lib/lib*.so* 182 | - usr/lib/*/lib*.so* 183 | - -etc/fonts 184 | - -var 185 | - -usr/include 186 | - -share/man 187 | - -share/doc 188 | - -share/lintian 189 | - -usr/share/fonts 190 | - -usr/share/man 191 | - -usr/share/doc 192 | - -usr/share/doc-base 193 | - -usr/share/lintian 194 | - -usr/lib/libqpdf.a 195 | - -usr/lib/libqpdf.la 196 | - -usr/lib/pkgconfig 197 | 198 | ghostscript: 199 | #source: https://git.ghostscript.com/ghostpdl.git 200 | source: https://github.com/ArtifexSoftware/ghostpdl.git 201 | source-type: git 202 | source-tag: 'ghostpdl-10.05.1rc1_test002' 203 | source-depth: 1 204 | # ext:updatesnap 205 | # version-format: 206 | # format: "ghostpdl-%M.%m.%R" 207 | # lower-than: '11' 208 | # no-9x-revisions: true 209 | plugin: autotools 210 | # We only need Raster and PostScript output 211 | autotools-configure-parameters: 212 | - --prefix=/usr 213 | - --without-x 214 | - --disable-gtk 215 | - --with-drivers=cups,pwgraster,ps2write 216 | - --enable-freetype 217 | - --without-tesseract 218 | - --without-gpdl 219 | - --without-xps 220 | - --without-pcl 221 | - --datarootdir=/snap/gutenprint-printer-app/current/usr/share/ 222 | stage-packages: 223 | - libpaper1 224 | - libfontconfig1 225 | - libfreetype6 226 | - libpng16-16 227 | prime: 228 | - usr/bin/gs 229 | - lib/*/lib*.so* 230 | - usr/lib/*/lib*.so* 231 | - usr/share/ghostscript 232 | - -etc/fonts 233 | - -var 234 | - -usr/include 235 | - -usr/lib/pkgconfig 236 | - -usr/share/fonts 237 | - -usr/share/man 238 | - -usr/share/doc 239 | - -usr/share/doc-base 240 | - -usr/share/lintian 241 | - -snap 242 | organize: 243 | snap/gutenprint-printer-app/current/usr/share: usr/share 244 | after: [cups] 245 | 246 | cups: 247 | source: https://github.com/OpenPrinting/cups 248 | source-type: git 249 | source-tag: 'v2.4.12' 250 | source-depth: 1 251 | # ext:updatesnap 252 | # version-format: 253 | # lower-than: '3' 254 | # no-9x-revisions: true 255 | plugin: autotools 256 | # We only need libcups (with headers, ...) and the backends 257 | override-build: | 258 | set -eux 259 | patch -p1 < $CRAFT_PROJECT_DIR/patches/cups-dnssd-backend-socket-only.patch 260 | # We use "--with-tls=gnutls" here, as current CUPS defaults to SSL here 261 | # and this is buggy, causing a segfault when serving out a HTTPS web 262 | # interface page. 263 | ./configure --sysconfdir=/var/snap/gutenprint-printer-app/common/ --with-tls=gnutls 264 | cd cups 265 | make 266 | cd .. 267 | cd backend 268 | # Have USB quirk files in user-modifiable space for debugging 269 | perl -p -i -e 's/"CUPS_DATADIR"/"USB_QUIRK_DIR"/' usb-libusb.c 270 | make snmp dnssd socket ipp ipps lpd usb 271 | cd .. 272 | mkdir -p $CRAFT_PART_INSTALL/usr/lib 273 | cp cups/libcups*.a $CRAFT_PART_INSTALL/usr/lib/ 274 | cp -P cups/libcups.so* $CRAFT_PART_INSTALL/usr/lib/ 275 | mkdir -p $CRAFT_PART_INSTALL/usr/include/cups 276 | cp cups/*.h $CRAFT_PART_INSTALL/usr/include/cups/ 277 | mkdir -p $CRAFT_PART_INSTALL/usr/bin 278 | cp cups-config $CRAFT_PART_INSTALL/usr/bin/ 279 | mkdir -p $CRAFT_PART_INSTALL/usr/lib/gutenprint-printer-app/backend/ 280 | (cd backend; \ 281 | cp snmp dnssd socket ipp ipps lpd usb org.cups.usb-quirks $CRAFT_PART_INSTALL/usr/lib/gutenprint-printer-app/backend/ \ 282 | ) 283 | cp conf/snmp.conf $CRAFT_PART_INSTALL/usr/lib/gutenprint-printer-app/backend/ 284 | build-packages: 285 | - patch 286 | - gettext 287 | - autoconf 288 | - automake 289 | - libtool 290 | - autotools-dev 291 | - pkg-config 292 | - libavahi-client-dev 293 | - libavahi-common-dev 294 | - libavahi-compat-libdnssd-dev 295 | - libdbus-1-dev 296 | - libfontconfig1-dev 297 | - libfreetype6-dev 298 | - libgnutls28-dev 299 | - libjpeg-dev 300 | - libkrb5-dev 301 | - libpam0g-dev 302 | - libpaper-dev 303 | - libpng-dev 304 | - libusb-1.0-0-dev 305 | - perl-base 306 | stage-packages: 307 | - libusb-1.0-0 308 | # We stage everything Avahi-related here and do not stage 309 | # anything of this in the pappl part to avoid any file clashes. 310 | - libavahi-common3 311 | - libavahi-client3 312 | prime: 313 | - -etc/fonts 314 | - -var 315 | - -usr/include 316 | - -usr/lib/pkgconfig 317 | - -usr/share/cups 318 | - -usr/share/fonts 319 | - -usr/share/man 320 | - -usr/share/doc 321 | - -usr/share/doc-base 322 | - -usr/share/lintian 323 | - lib/*/lib*.so* 324 | - usr/lib/lib*.so* 325 | - usr/lib/*/lib*.so* 326 | - usr/lib/gutenprint-printer-app/backend/* 327 | 328 | libcupsfilters: 329 | source: https://github.com/OpenPrinting/libcupsfilters 330 | source-type: git 331 | source-tag: '2.1.1' 332 | source-depth: 1 333 | # ext:updatesnap 334 | # version-format: 335 | # lower-than: '3' 336 | # no-9x-revisions: true 337 | plugin: autotools 338 | # We only need libcupsfilters itself. so we simply do not prime the 339 | # auxiliary files (/usr/share) 340 | autotools-configure-parameters: 341 | - --prefix=/usr 342 | - --disable-avahi 343 | - --disable-mutool 344 | build-packages: 345 | - gettext 346 | - autoconf 347 | - automake 348 | - autotools-dev 349 | - pkg-config 350 | - g++ 351 | - sharutils 352 | - liblcms2-dev 353 | - libpoppler-cpp-dev 354 | - libpng-dev 355 | - libjpeg-dev 356 | - libtiff5-dev 357 | - zlib1g-dev 358 | - libfontconfig1-dev 359 | - libdbus-1-dev 360 | - libexif-dev 361 | stage-packages: 362 | - libpoppler-cpp0v5 363 | - libjbig0 364 | - liblcms2-2 365 | - libnspr4 366 | - libnss3 367 | - libopenjp2-7 368 | - libpoppler118 369 | # We stage libtiff5 and libwebp7 here and do not stage them in the 370 | # "gutenprint-printer-app" part to avoid any file clashes. 371 | - libtiff5 372 | - libwebp7 373 | - libexif12 374 | stage: 375 | - -usr/lib/lib*.la 376 | # The *.la file which gets installed by "make install" contains a 377 | # wrong prefix, breaking parts of this Snap which use this library 378 | prime: 379 | - -etc 380 | - -var 381 | - -usr/include 382 | - -usr/lib/pkgconfig 383 | - usr/share/cups 384 | - -usr/share/fonts 385 | - -usr/share/man 386 | - -usr/share/doc 387 | - -usr/share/doc-base 388 | - -usr/share/lintian 389 | - lib/*/lib*.so* 390 | - usr/lib/lib*.so* 391 | - usr/lib/*/lib*.so* 392 | - usr/lib/*/nss 393 | # Reported unused by snapcraft linter 394 | - -usr/lib/*/libssl3.* 395 | after: [cups, qpdf, ghostscript] 396 | 397 | libppd: 398 | source: https://github.com/OpenPrinting/libppd 399 | source-type: git 400 | source-tag: '2.1.1' 401 | source-depth: 1 402 | # ext:updatesnap 403 | # version-format: 404 | # lower-than: '3' 405 | # no-9x-revisions: true 406 | plugin: autotools 407 | # We only need libppd itself 408 | autotools-configure-parameters: 409 | - --prefix=/usr 410 | - --disable-mutool 411 | - --disable-pdftocairo 412 | - --disable-acroread 413 | - --with-pdftops-path=/snap/gutenprint-printer-app/current/usr/bin/pdftops 414 | # To find the libraries built in this Snap 415 | build-environment: 416 | - LD_LIBRARY_PATH: "${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$CRAFT_STAGE/usr/lib" 417 | build-packages: 418 | - gettext 419 | - autoconf 420 | - automake 421 | - autotools-dev 422 | - pkg-config 423 | - g++ 424 | - sharutils 425 | - poppler-utils 426 | prime: 427 | - -etc 428 | - -var 429 | - -usr/include 430 | - -usr/lib/pkgconfig 431 | - -usr/share/ppdc 432 | - -usr/share/fonts 433 | - -usr/share/man 434 | - -usr/share/doc 435 | - -usr/share/doc-base 436 | - -usr/share/lintian 437 | - lib/*/lib*.so* 438 | - usr/lib/lib*.so* 439 | - usr/lib/*/lib*.so* 440 | - usr/lib/*/nss 441 | after: [cups, ghostscript, libcupsfilters] 442 | 443 | gutenprint: 444 | # github source 445 | # source: https://github.com/echiu64/gutenprint.git 446 | source: https://salsa.debian.org/printing-team/gutenprint.git 447 | source-type: git 448 | source-tag: 'debian/5.3.4.20220624T01008808d602-4' 449 | # github source tag 450 | # source-tag: 'gutenprint-5_3_3' 451 | source-depth: 1 452 | # ext:updatesnap 453 | # version-format: 454 | # format: 'debian/%V' 455 | # lower-than: '6' 456 | # no-9x-revisions: true 457 | plugin: autotools 458 | # We only need the library, the XML resources, and the CUPS driver 459 | # (PPD generator, filter, backend) 460 | autotools-configure-parameters: 461 | - --prefix=/usr 462 | - --datarootdir=/snap/gutenprint-printer-app/current/usr/share 463 | - --enable-shared 464 | - --disable-rpath 465 | - --with-modules=static 466 | - --without-gimp2 467 | - --disable-libgutenprintui2 468 | - --with-cups 469 | - --enable-cups-level3-ppds 470 | - --enable-translated-cups-ppds 471 | - --enable-simplified-cups-ppds 472 | - --enable-cups-1_2-enhancements 473 | - --disable-cups-ppds 474 | - --enable-escputil 475 | - --disable-samples 476 | - --disable-test 477 | - --disable-testpattern 478 | - --enable-nls 479 | - --without-doc 480 | build-packages: 481 | - byacc 482 | - libreadline-dev 483 | - libusb-1.0-0-dev 484 | - zlib1g-dev 485 | - flex 486 | - gettext 487 | - chrpath 488 | - libtool-bin 489 | - curl 490 | organize: 491 | snap/gutenprint-printer-app/current/usr/share: usr/share 492 | usr/lib/cups/filter/rastertogutenprint.5.3: usr/lib/gutenprint-printer-app/filter/rastertogutenprint.5.3 493 | usr/lib/cups/filter/commandtoepson: usr/lib/gutenprint-printer-app/filter/commandtoepson 494 | usr/lib/cups/filter/commandtocanon: usr/lib/gutenprint-printer-app/filter/commandtocanon 495 | usr/lib/cups/backend/gutenprint53+usb: usr/lib/gutenprint-printer-app/backend/gutenprint53+usb 496 | usr/share/cups/usb/net.sf.gimp-print.usb-quirks: usr/lib/gutenprint-printer-app/backend/net.sf.gimp-print.usb-quirks 497 | usr/lib/cups/driver/gutenprint.5.3: usr/share/ppd/gutenprint.5.3 498 | prime: 499 | - usr/bin/cups-calibrate 500 | - usr/bin/escputil 501 | - usr/sbin/*genppd* 502 | - usr/lib/lib*.so* 503 | - usr/lib/gutenprint-printer-app 504 | - usr/share/ppd/gutenprint.5.3 505 | - usr/share/gutenprint 506 | - usr/share/locale 507 | - usr/share/cups/calibrate.ppm 508 | - -snap 509 | - -etc/fonts 510 | - -var 511 | - -usr/include 512 | - -share/man 513 | - -share/doc 514 | - -share/lintian 515 | - -usr/share/fonts 516 | - -usr/share/man 517 | - -usr/share/doc 518 | - -usr/share/doc-base 519 | - -usr/share/lintian 520 | - -usr/share/gutenprint/doc 521 | - -usr/lib/gutenprint 522 | - -usr/lib/libgutenprint.a 523 | - -usr/lib/libgutenprint.la 524 | - -usr/lib/pkgconfig 525 | - -usr/lib/cups 526 | after: [cups] 527 | 528 | gutenprint-printer-app: 529 | plugin: make 530 | source: . 531 | make-parameters: 532 | - LDFLAGS="$LDFLAGS -ljpeg" 533 | - VERSION="$VERSION" 534 | # To find the libraries built in this Snap 535 | build-environment: 536 | - LD_LIBRARY_PATH: "${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$CRAFT_STAGE/usr/lib" 537 | # To improve convenience for developers (and everyone who wants to 538 | # build from source), we do a "make clean" before "make" here, 539 | # because if we had done "make" off-Snap, directly in the source 540 | # tree. and afterwards build the Snap with snapcraft, the build 541 | # sucks in our local binary of gutenprint-printer-app instead of 542 | # compiling its own one in the Snap harness with the appropriate 543 | # libraries, ending up with the Snap containing an executable 544 | # which does not work inside the Snap. The "make clean" removes 545 | # any accidentally grabbed binary. 546 | # 547 | # We need to directly call the "make" and "make install" commands 548 | # here as we cannot inject an environment variable into the default 549 | # build process ("craftctl default") and we also cannot call 550 | # "craftctl get version" in the lines of "make-parameters:" or 551 | # "build-environment:". This way we get the version number of our 552 | # Snap (which is extracted from the Gutenprint upstream source) 553 | # into the gutenprint-printer-app executable. 554 | override-build: | 555 | set -eux 556 | make clean 557 | VERSION="`craftctl get version`" 558 | make -j"8" LDFLAGS="$LDFLAGS -ljpeg" VERSION="$VERSION" 559 | make -j"8" install LDFLAGS="$LDFLAGS -ljpeg" VERSION="$VERSION" DESTDIR="$CRAFT_PART_INSTALL" 560 | #craftctl default 561 | build-packages: 562 | - libusb-1.0-0-dev 563 | stage-packages: 564 | - libusb-1.0-0 565 | - libjbig0 566 | - liblcms2-2 567 | # We stage libtiff5 and libwebp7 already in the "libcupsfilters" part, so 568 | # we do not stage them here again, to avoid any file clashes. 569 | #- libtiff5 570 | #- libwebp7 571 | stage: 572 | - -usr/lib/gutenprint-printer-app 573 | prime: 574 | - usr/bin/gutenprint-printer-app 575 | - lib/*/lib*.so* 576 | - usr/lib/*/lib*.so* 577 | - usr/share/gutenprint-printer-app 578 | - -var 579 | - -usr/share/man 580 | # Reported unused by snapcraft linter 581 | - -usr/lib/*/libgssapi.* 582 | after: [pappl-retrofit, pappl, libcupsfilters, libppd, gutenprint] 583 | 584 | scripts: 585 | plugin: dump 586 | source: . 587 | organize: 588 | # Startup wrapper scripts 589 | snap/local/run-gutenprint-printer-app*: scripts/ 590 | prime: 591 | - scripts/ 592 | after: [gutenprint-printer-app] 593 | --------------------------------------------------------------------------------