mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-25 18:47:22 -06:00
Release builds said "Text recognition isn't installed: its models are missing" because no packaging script or release job fetched the OCR models: only `cargo xtask models` does, into the source tree. - packaging/env.sh gains stage_models DEST, which runs `cargo xtask models DEST` (every ATTRIBUTION.toml kind = "model" file, SHA-256 verified, with its licence text). No model file is named, so the models PRs #433/#572 add ship without packaging changes. - `cargo xtask models` also writes ATTRIBUTION.txt crediting each model (CC-BY-SA-4.0 requires attribution when redistributed). - macOS: PdfCraft.app/Contents/Resources/models, before signing. - Windows: models\ beside pdfcraft.exe in the MSI (WiX v5 <Files> harvest) and the portable zip; test-msi.ps1 checks the folder. - Linux deb/rpm/tar.gz/AppImage, Flatpak bundle and FreeBSD tarball: share/pdfcraft/models beside bin/. Models::search_dirs now also looks in <exe dir>/../share/pdfcraft/models (Models::dirs_beside_exe); a test builds every package layout on disk and finds the models in each. release.yml and freebsd.yml check the packages contain them. - The missing-models messages no longer tell end users to run cargo, and the 11 catalogs that keyed an old PRINTCRAFT_MODELS wording (or the previous one) now key the current English text; ATTRIBUTION hashes updated. A test checks the translations match. The web (wasm) build, which the issue reports, still has no models; this is the desktop half only. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
61 lines
2.3 KiB
Bash
Executable File
61 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build PdfCraft for FreeBSD and package it:
|
|
# $DIST/pdfcraft-<version>-freebsd-<arch>.tar.gz a /usr/local-style tree (bin/, share/)
|
|
#
|
|
# Extract it into /usr/local (or anywhere, and run bin/pdfcraft from there). The desktop entry,
|
|
# MIME type, AppStream metadata and icons are the freedesktop ones Linux uses.
|
|
#
|
|
# Usage: packaging/freebsd/package.sh [--skip-build]
|
|
# Needs: bash, a Rust toolchain, curl and the network (the OCR models), and the GUI libraries in .github/workflows/freebsd.yml.
|
|
set -euo pipefail
|
|
# shellcheck source=../env.sh
|
|
. "$(dirname "${BASH_SOURCE[0]}")/../env.sh"
|
|
LINUX="$ROOT/packaging/linux"
|
|
APP_ID=ai.storyteller.pdfcraft
|
|
|
|
SKIP_BUILD=0
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
--skip-build) SKIP_BUILD=1; shift ;;
|
|
-h | --help) sed -n '2,9p' "$0"; exit 0 ;;
|
|
*) echo "unknown argument: $1" >&2; exit 2 ;;
|
|
esac
|
|
done
|
|
|
|
ARCH="$(uname -m)"
|
|
case "$ARCH" in
|
|
amd64 | x86_64) ARCH=x86_64 ;;
|
|
arm64 | aarch64) ARCH=aarch64 ;;
|
|
*) echo "unsupported architecture $ARCH" >&2; exit 2 ;;
|
|
esac
|
|
BASENAME="pdfcraft-$VERSION-freebsd-$ARCH"
|
|
|
|
echo "==> PdfCraft $VERSION for FreeBSD $ARCH"
|
|
|
|
if [ "$SKIP_BUILD" = 0 ]; then
|
|
(cd "$ROOT" && cargo build --release --locked -p pdfcraft -p pdfcraft-cli)
|
|
fi
|
|
BIN="$CARGO_TARGET_DIR/release"
|
|
WORK="$CARGO_TARGET_DIR/freebsd-package"
|
|
STAGE="$WORK/$BASENAME"
|
|
rm -rf "$WORK"
|
|
|
|
# FreeBSD's install(1) has no -D: create the directories first.
|
|
mkdir -p "$STAGE/bin" "$STAGE/share/applications" "$STAGE/share/mime/packages" "$STAGE/share/metainfo" \
|
|
"$STAGE/share/icons" "$STAGE/share/doc/pdfcraft"
|
|
install -m 755 "$BIN/pdfcraft" "$BIN/pdfcraft-cli" "$STAGE/bin/"
|
|
strip "$STAGE/bin/pdfcraft" "$STAGE/bin/pdfcraft-cli" 2>/dev/null || true
|
|
install -m 644 "$LINUX/$APP_ID.desktop" "$STAGE/share/applications/$APP_ID.desktop"
|
|
install -m 644 "$LINUX/$APP_ID.mime.xml" "$STAGE/share/mime/packages/$APP_ID.xml"
|
|
sed -e "s/@VERSION@/$VERSION/g" -e "s/@DATE@/$PDFCRAFT_BUILD_DATE/g" \
|
|
"$LINUX/$APP_ID.metainfo.xml.in" >"$STAGE/share/metainfo/$APP_ID.metainfo.xml"
|
|
cp -R "$ROOT/assets/app-icon/hicolor" "$STAGE/share/icons/"
|
|
copy_docs "$STAGE/share/doc/pdfcraft"
|
|
# OCR models: the app finds them at <bin>/../share/pdfcraft/models.
|
|
stage_models "$STAGE/share/pdfcraft/models"
|
|
|
|
"$STAGE/bin/pdfcraft" --version
|
|
mkdir -p "$DIST"
|
|
tar -C "$WORK" -czf "$DIST/$BASENAME.tar.gz" "$BASENAME"
|
|
echo "wrote $DIST/$BASENAME.tar.gz"
|