Papers Document Viewer flatpak built against the elementary platform
Run flatpak-builder to configure the build environment, download dependencies, build, and install
flatpak-builder build org.gnome.papers.json --user --install --force-clean --install-deps-from=appcenter --install-deps-from=flathubThen execute with
flatpak run org.gnome.PapersSome code of Papers is written in Rust so it uses Cargo to resolve dependencies of it. However, network access during the build process is not recommended in Flatpak. flatpak-cargo-generator resolves this problem by converting all necessary dependencies listed in the Cargo.lock into a Flatpak manifest file to download them as modules at the beginning of the build process.
First, prepare Cargo.lock of Papers. We patch Cargo.lock to add granite, so we need to apply our patch against the original source code of Papers:
# The tag name matches with the version of the papers module in org.gnome.papers.json
git clone https://gitlab.gnome.org/GNOME/papers.git -b 50.2 --depth=1
cd papers/
git apply <path to add-granite.patch>
cd ../
Then, make sure you have flatpak-cargo-generator submodule cloned:
git submodule update --init --recursive
Now, use flatpak-cargo-generator to generate generated-sources.json:
uv run ./flatpak-builder-tools/cargo/flatpak-cargo-generator.py papers/Cargo.lock