GitCorner

Code

ossartcraftlightcraft🌐
5a24289898fd
# Flatpak manifest for LightCraft, ready for a Flathub submission.
#
# Flatpak builds run offline, so the crate sources must be vendored first. From the repo root:
#
#   ./packaging/linux/flatpak/generate-cargo-sources.py
#   flatpak-builder --user --install --force-clean build-flatpak packaging/linux/flatpak/ai.storyteller.lightcraft.yml
#   flatpak run ai.storyteller.lightcraft
#
# The wrapper downloads the pinned upstream flatpak-cargo-generator, verifies its checksum,
# applies the two reviewed patches described in packaging/linux/flatpak/README.md, and writes
# cargo-sources.json atomically. That README also covers dependencies and offline validation.
#
# For Flathub, replace the `dir` source with a `git` source pinned to a release tag and commit.
#
# ai.storyteller.lightcraft.bundle.yml (same directory) builds the .flatpak attached to every
# release from the prebuilt binaries. Keep runtime-version and finish-args identical in both
# (packaging-lint checks this).
id: ai.storyteller.lightcraft
runtime: org.freedesktop.Platform
runtime-version: '25.08'
sdk: org.freedesktop.Sdk
sdk-extensions:
  - org.freedesktop.Sdk.Extension.rust-stable
command: lightcraft
finish-args:
  # The shared updater inspects and updates this installation via flatpak-spawn --host.
  - --talk-name=org.freedesktop.Flatpak
  - --filesystem=xdg-data/ArtCraft/versions:ro
  # Display: Wayland first; X11 only when no Wayland compositor is running.
  - --socket=wayland
  - --socket=fallback-x11
  # X11 shared memory (MIT-SHM). Without it the X11 fallback is slow or fails.
  - --share=ipc
  # GPU access for the wgpu renderer (Vulkan, or GL as a fallback).
  - --device=dri
  # Screen readers: AccessKit asks the accessibility bus (org.a11y.Bus) whether one is running and
  # publishes the window there over AT-SPI. Without it the sandbox hides the bus and the app is
  # invisible to Orca and other assistive technology.
  - --talk-name=org.a11y.Bus
  # The library lives in ~/Pictures/LightCraft Library by default, and imports usually come from
  # Pictures. Open/Save dialogs go through the file-chooser portal (rfd's xdg-portal backend) and
  # drag-and-drop through the document portal, so picked folders elsewhere work without broad
  # filesystem access.
  - --filesystem=xdg-pictures
  # Deliberately not granted: home/host filesystem access. Network is needed for update checks
  # against GitHub and the optional SAM 3 model download (AI Object/Describe masks,
  # docs/ai-masks.md).
  - --share=network
build-options:
  append-path: /usr/lib/sdk/rust-stable/bin
modules:
  - name: lightcraft
    buildsystem: simple
    build-options:
      env:
        CARGO_HOME: /run/build/lightcraft/cargo
        CARGO_NET_OFFLINE: 'true'
    build-commands:
      - cargo --offline build --release --locked -p lightcraft -p lightcraft-cli
      - install -Dm755 target/release/lightcraft /app/bin/lightcraft
      - install -Dm755 target/release/lightcraft-cli /app/bin/lightcraft-cli
      - install -Dm644 packaging/linux/ai.storyteller.lightcraft.desktop /app/share/applications/ai.storyteller.lightcraft.desktop
      - install -Dm644 packaging/linux/ai.storyteller.lightcraft.mime.xml /app/share/mime/packages/ai.storyteller.lightcraft.xml
      - mkdir -p /app/share/icons && cp -R assets/app-icon/hicolor /app/share/icons/
      - install -Dm644 NOTICE /app/share/doc/lightcraft/NOTICE
      - install -Dm644 assets/ATTRIBUTION.md /app/share/doc/lightcraft/ATTRIBUTION.md
      - install -Dm644 assets/fonts/OFL-Inter.txt /app/share/doc/lightcraft/OFL-Inter.txt
      - >-
        version=$(awk '/^\[/{p=($0=="[workspace.package]");next} p&&$1=="version"{gsub(/[" ]/,"",$3);print $3;exit}' Cargo.toml);
        install -d /app/share/metainfo;
        sed -e "s/@VERSION@/$version/" -e "s/@DATE@/$(date -u +%Y-%m-%d)/"
        packaging/linux/ai.storyteller.lightcraft.metainfo.xml.in > /app/share/metainfo/ai.storyteller.lightcraft.metainfo.xml
    sources:
      - type: dir
        path: ../../..
        skip:
          - target
          - dist
          - corpus
          - build-flatpak
          - .flatpak-builder
      - cargo-sources.json