BlueGit

timfa posprint

Files

posprint / docs / BUILD.md

BUILD.md

BUILD.md 4.7 KiB Download Raw

Build scripts

Local release builds for Windows and Linux.

Toolchain

You need a Rust toolchain (1.88+; CI uses 1.96). Install once:

# Recommended (any distro)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# then restart the shell, or: source "$HOME/.cargo/env"

# Or on Arch Linux
sudo pacman -S --needed rust

Also install the platform build libraries under Linux build dependencies below before cargo test / cargo build.

Interactive shells: the build scripts detect missing requirements (Rust, apt/pacman packages, cargo-deb, base-devel) and ask whether to install them automatically. Non-interactive runs (CI/pipes) never prompt; they print install instructions and exit.

Windows

.\scripts\build-windows.ps1

Output: target\release\posprint.exe

If cargo/rustc are missing and the shell is interactive, the script offers to install Rust via winget (Rustlang.Rustup) or rustup-init.

Options:

.\scripts\build-windows.ps1 -SkipTests

Linux

chmod +x scripts/build-linux.sh
./scripts/build-linux.sh                # release binary
./scripts/build-linux.sh --deb          # binary + .deb (prompts to install if interactive)
./scripts/build-linux.sh --deb --install  # build .deb and install with apt

On a TTY, missing apt build packages and (with --deb) cargo-deb are offered for install before building.

On Arch Linux:

chmod +x scripts/build-arch.sh
./scripts/build-arch.sh                 # .pkg.tar.zst (prompts to install if interactive)
./scripts/build-arch.sh --install      # build and install with pacman

On a TTY, missing base-devel, Rust, and common pacman build libs are offered for install before building.

build-arch.sh accepts a rustup toolchain on PATH. If the pacman rust/cargo packages are not installed, it runs makepkg --nodeps after verifying rustc/cargo work (the PKGBUILD still lists those packages for AUR/CI).

After a successful package build, both scripts ask whether to install (TTY only). Pass --install to skip the prompt and install automatically. Non-interactive runs (CI/pipes) never prompt.

Outputs:

ArtifactPath
Binarytarget/release/posprint
Debian packagetarget/debian/*.deb
Arch packagepackaging/arch/posprint-*-x86_64.pkg.tar.zst

Linux targets we support

FormatDistrosNotes
.debDebian, Ubuntu, Mint, Pop!_OS, etc.Recommended for apt-based systems; produced by cargo-deb
.pkg.tar.zstArch Linux, Manjaro, EndeavourOS, etc.Recommended for pacman; sudo pacman -U posprint-*.pkg.tar.zst
Raw binaryAny x86_64 LinuxCopy target/release/posprint; needs X11/Wayland libs at runtime
.rpmFedora, RHEL, openSUSENot automated yet; build binary and wrap with fpm if needed
AppImageUniversalNot automated yet; good for portable distribution

Architecture: x86_64 (amd64) only in CI and build scripts today.

Linux build dependencies (Debian/Ubuntu)

sudo apt-get install -y build-essential pkg-config \
  libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev \
  libssl-dev libudev-dev

For .deb:

cargo install cargo-deb --locked

Arch Linux build dependencies

sudo pacman -S --needed base-devel rust pkgconf openssl libxkbcommon libxcb dbus \
  wayland libx11 fontconfig freetype2 libglvnd git rsync

AUR publishing

Normal local Arch packaging uses packaging/arch/PKGBUILD.

Automated AUR publishing uses:

  • packaging/aur/PKGBUILD
  • packaging/aur/.SRCINFO
  • scripts/publish-aur.sh

That AUR package builds from the GitLab tag tarball, not from a prebuilt binary.

Setup and required GitLab secrets are documented in AUR.md.

File association (.pos → posprint)

The package installs:

  • /usr/share/mime/packages/posprint.xml → MIME type application/x-posprint for *.pos
  • /usr/share/applications/posprint.desktop → claims that MIME type

After pacman -U, pacman hooks refresh the MIME and desktop databases. To make posprint the default opener (double-click):

xdg-mime default posprint.desktop application/x-posprint
xdg-mime query filetype some.pos          # expect: application/x-posprint
xdg-mime query default application/x-posprint  # expect: posprint.desktop

If query filetype still says text/plain, the MIME package was not installed or the cache is stale:

sudo update-mime-database /usr/share/mime
sudo update-desktop-database /usr/share/applications

Tests before release

cargo test --release
Source
1# Build scripts
2
3Local release builds for Windows and Linux.
4
5## Toolchain
6
7You need a Rust toolchain (**1.88+**; CI uses 1.96). Install once:
8
9```bash
10# Recommended (any distro)
11curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
12# then restart the shell, or: source "$HOME/.cargo/env"
13
14# Or on Arch Linux
15sudo pacman -S --needed rust
16```
17
18Also install the platform build libraries under **Linux build dependencies** below before `cargo test` / `cargo build`.
19
20**Interactive shells:** the build scripts detect missing requirements (Rust, apt/pacman packages, `cargo-deb`, `base-devel`) and ask whether to install them automatically. Non-interactive runs (CI/pipes) never prompt; they print install instructions and exit.
21
22## Windows
23
24```powershell
25.\scripts\build-windows.ps1
26```
27
28Output: `target\release\posprint.exe`
29
30If `cargo`/`rustc` are missing and the shell is interactive, the script offers to install Rust via **winget** (`Rustlang.Rustup`) or **rustup-init**.
31
32Options:
33
34```powershell
35.\scripts\build-windows.ps1 -SkipTests
36```
37
38## Linux
39
40```bash
41chmod +x scripts/build-linux.sh
42./scripts/build-linux.sh # release binary
43./scripts/build-linux.sh --deb # binary + .deb (prompts to install if interactive)
44./scripts/build-linux.sh --deb --install # build .deb and install with apt
45```
46
47On a TTY, missing **apt** build packages and (with `--deb`) **cargo-deb** are offered for install before building.
48
49On **Arch Linux**:
50
51```bash
52chmod +x scripts/build-arch.sh
53./scripts/build-arch.sh # .pkg.tar.zst (prompts to install if interactive)
54./scripts/build-arch.sh --install # build and install with pacman
55```
56
57On a TTY, missing **base-devel**, Rust, and common pacman build libs are offered for install before building.
58
59`build-arch.sh` accepts a **rustup** toolchain on `PATH`. If the pacman `rust`/`cargo` packages are not installed, it runs `makepkg --nodeps` after verifying `rustc`/`cargo` work (the PKGBUILD still lists those packages for AUR/CI).
60
61After a successful package build, both scripts ask whether to install (TTY only). Pass `--install` to skip the prompt and install automatically. Non-interactive runs (CI/pipes) never prompt.
62
63Outputs:
64
65| Artifact | Path |
66|----------|------|
67| Binary | `target/release/posprint` |
68| Debian package | `target/debian/*.deb` |
69| Arch package | `packaging/arch/posprint-*-x86_64.pkg.tar.zst` |
70
71### Linux targets we support
72
73| Format | Distros | Notes |
74|--------|---------|-------|
75| **`.deb`** | Debian, Ubuntu, Mint, Pop!_OS, etc. | **Recommended** for apt-based systems; produced by `cargo-deb` |
76| **`.pkg.tar.zst`** | Arch Linux, Manjaro, EndeavourOS, etc. | **Recommended** for pacman; `sudo pacman -U posprint-*.pkg.tar.zst` |
77| **Raw binary** | Any x86_64 Linux | Copy `target/release/posprint`; needs X11/Wayland libs at runtime |
78| **`.rpm`** | Fedora, RHEL, openSUSE | Not automated yet; build binary and wrap with `fpm` if needed |
79| **AppImage** | Universal | Not automated yet; good for portable distribution |
80
81**Architecture:** `x86_64` (amd64) only in CI and build scripts today.
82
83### Linux build dependencies (Debian/Ubuntu)
84
85```bash
86sudo apt-get install -y build-essential pkg-config \
87 libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev \
88 libssl-dev libudev-dev
89```
90
91For `.deb`:
92
93```bash
94cargo install cargo-deb --locked
95```
96
97### Arch Linux build dependencies
98
99```bash
100sudo pacman -S --needed base-devel rust pkgconf openssl libxkbcommon libxcb dbus \
101 wayland libx11 fontconfig freetype2 libglvnd git rsync
102```
103
104### AUR publishing
105
106Normal local Arch packaging uses `packaging/arch/PKGBUILD`.
107
108Automated AUR publishing uses:
109
110- `packaging/aur/PKGBUILD`
111- `packaging/aur/.SRCINFO`
112- `scripts/publish-aur.sh`
113
114That AUR package builds from the GitLab tag tarball, not from a prebuilt binary.
115
116Setup and required GitLab secrets are documented in [AUR.md](AUR.md).
117
118### File association (`.pos` → posprint)
119
120The package installs:
121
122- `/usr/share/mime/packages/posprint.xml` → MIME type `application/x-posprint` for `*.pos`
123- `/usr/share/applications/posprint.desktop` → claims that MIME type
124
125After `pacman -U`, pacman hooks refresh the MIME and desktop databases. To make posprint the **default** opener (double-click):
126
127```bash
128xdg-mime default posprint.desktop application/x-posprint
129xdg-mime query filetype some.pos # expect: application/x-posprint
130xdg-mime query default application/x-posprint # expect: posprint.desktop
131```
132
133If `query filetype` still says `text/plain`, the MIME package was not installed or the cache is stale:
134
135```bash
136sudo update-mime-database /usr/share/mime
137sudo update-desktop-database /usr/share/applications
138```
139
140## Tests before release
141
142```bash
143cargo test --release
144```