Hello, I want to compile the rust dependencies in my project offline since afaik flathub will not allow cargo to access the internet during the build process. I used the flatpak cargo generator against my Cargo.lock
file and got the following sources: https://pastebin.com/NBYaVe8p
My flatpak manifest file is as follows:
id: com.gitlab.adnan338.Timediff
runtime: org.gnome.Platform
runtime-version: "3.38"
sdk: org.gnome.Sdk
sdk-extensions:
- org.freedesktop.Sdk.Extension.rust-stable
command: timediff
finish-args:
- --socket=fallback-x11
- --share=ipc
build-options:
append-path: /usr/lib/sdk/rust-stable/bin
build-args:
- --share=network
modules:
- name: timediff
sources:
- deptree.json
# - type: git
# url: "https://gitlab.com/9898287/timediff"
# branch: offline_flatpak
- type: dir
path: "."
- type: file
path: "resources/com.gitlab.adnan338.Timediff.png"
- type: file
path: "resources/com.gitlab.adnan338.Timediff.desktop"
buildsystem: simple
build-commands:
- cargo --offline fetch --manifest-path Cargo.toml --verbose
- cargo --offline build --release --verbose,
- install -Dm755 target/release/timediff --target-directory=/app/bin
- install -Dm644 com.gitlab.adnan338.Timediff.desktop --target-directory=/app/share/applications
- install -Dm644 com.gitlab.adnan338.Timediff.png --target-directory=/app/share/icons/hicolor/scalable/apps
As you can see the deptree.json
(generated dependency list) needs to be compiled offline and made available to the build environment’s path but I am not sure how to achieve this. Obviously trying to build this fails:
# [snip]
========================================================================
Building module timediff in /home/adnan338/proj/timediff/.flatpak-builder/build/timediff-1
========================================================================
Running: cargo --offline fetch --manifest-path Cargo.toml --verbose
error: no matching package named `gio` found
location searched: registry `https://github.com/rust-lang/crates.io-index`
required by package `timediff v0.1.0 (/run/build/timediff)`
As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag.
Error: module timediff: Child process exited with code 101
make: *** [Makefile:9: flatpak-install] Error 1