diff --git a/.gitignore b/.gitignore index ad679558..b12df8ac 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,12 @@ target # Contains mutation testing data **/mutants.out*/ +# Flatpak +flatpak/cargo-sources.json +flatpak/io.github.HakanSeven12.H7CAD.local.yml +.flatpak-builder/ +build-dir/ + # RustRover # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore diff --git a/flatpak/README-flatpak.md b/flatpak/README-flatpak.md new file mode 100644 index 00000000..7f23eff0 --- /dev/null +++ b/flatpak/README-flatpak.md @@ -0,0 +1,53 @@ +# Flatpak Packaging + +## App ID +`io.github.HakanSeven12.H7CAD` + +## Requirements + +```bash +# flatpak-builder +sudo apt install flatpak-builder + +# Required runtime and SDK +flatpak install flathub org.freedesktop.Platform//24.08 +flatpak install flathub org.freedesktop.Sdk//24.08 +flatpak install flathub org.freedesktop.Sdk.Extension.rust-stable//24.08 +``` + +## Generating cargo-sources.json + +Flathub builds run without internet access, so all Cargo dependencies must be +pre-downloaded: + +```bash +# Download flatpak-cargo-generator.py +git clone https://github.com/flatpak/flatpak-builder-tools.git +cd flatpak-builder-tools/cargo + +# Generate cargo-sources.json (run from the H7CAD repo root) +python3 flatpak-cargo-generator.py /path/to/H7CAD/Cargo.lock -o /path/to/H7CAD/flatpak/cargo-sources.json +``` + +## Local Testing + +```bash +# Run from the flatpak/ directory +flatpak-builder --force-clean --user --install ../build-dir io.github.HakanSeven12.H7CAD.local.yml +flatpak run io.github.HakanSeven12.H7CAD +``` + +## Submitting to Flathub + +1. Fork https://github.com/flathub/flathub +2. Create a new repository named `io.github.HakanSeven12.H7CAD` from the `new-pr` branch +3. Copy the files from this directory + `cargo-sources.json` into the new repo +4. Fill in the `commit:` field in the manifest with the actual commit hash +5. Follow the Flathub submission guide: + https://docs.flathub.org/docs/for-app-authors/submission + +## Notes + +- A GitHub release/tag `v0.1.0` must exist before submitting to Flathub +- Get the commit hash with `git rev-parse v0.1.0` and replace `FILL_IN_COMMIT_HASH` in the manifest +- Validate the manifest with `flatpak-builder-lint` before opening a Flathub PR diff --git a/flatpak/io.github.HakanSeven12.H7CAD.desktop b/flatpak/io.github.HakanSeven12.H7CAD.desktop new file mode 100644 index 00000000..bdc9a433 --- /dev/null +++ b/flatpak/io.github.HakanSeven12.H7CAD.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=H7CAD +Comment=A CAD application for 2D/3D drawing and design +Exec=H7CAD +Icon=io.github.HakanSeven12.H7CAD +Terminal=false +Type=Application +Categories=Graphics;Engineering; +MimeType=image/vnd.dxf; +Keywords=CAD;DXF;drawing;design;engineering;2D;3D; +StartupWMClass=H7CAD diff --git a/flatpak/io.github.HakanSeven12.H7CAD.metainfo.xml b/flatpak/io.github.HakanSeven12.H7CAD.metainfo.xml new file mode 100644 index 00000000..6cadf1cc --- /dev/null +++ b/flatpak/io.github.HakanSeven12.H7CAD.metainfo.xml @@ -0,0 +1,50 @@ + + + io.github.HakanSeven12.H7CAD + + H7CAD + A CAD application for 2D/3D drawing and design + + MIT + GPL-3.0-only + + +

+ H7CAD is a computer-aided design (CAD) application built with Rust. + It supports 2D drafting and 3D modeling with GPU-accelerated rendering, + and can open and work with DXF files. +

+ +
+ + io.github.HakanSeven12.H7CAD.desktop + + https://github.com/HakanSeven12/H7CAD + https://github.com/HakanSeven12/H7CAD/issues + + + + Main application window + https://github.com/user-attachments/assets/25bc2bb2-c35c-477d-a3e9-45c86690b5c9 + + + + + + +

Initial release of H7CAD.

+
+
+
+ + + + + Hakan Seven + +
diff --git a/flatpak/io.github.HakanSeven12.H7CAD.yml b/flatpak/io.github.HakanSeven12.H7CAD.yml new file mode 100644 index 00000000..fd22f3f8 --- /dev/null +++ b/flatpak/io.github.HakanSeven12.H7CAD.yml @@ -0,0 +1,36 @@ +app-id: io.github.HakanSeven12.H7CAD +runtime: org.freedesktop.Platform +runtime-version: '24.08' +sdk: org.freedesktop.Sdk +sdk-extensions: + - org.freedesktop.Sdk.Extension.rust-stable +command: H7CAD + +finish-args: + - --device=dri + - --socket=wayland + - --socket=fallback-x11 + - --share=ipc + - --filesystem=home + +build-options: + append-path: /usr/lib/sdk/rust-stable/bin + env: + CARGO_HOME: /run/build/H7CAD/cargo + +modules: + - name: H7CAD + buildsystem: simple + build-commands: + - cargo --offline fetch --manifest-path Cargo.toml --verbose + - cargo --offline build --release --verbose + - install -Dm755 target/release/H7CAD /app/bin/H7CAD + - install -Dm644 assets/logo.svg /app/share/icons/hicolor/scalable/apps/io.github.HakanSeven12.H7CAD.svg + - install -Dm644 flatpak/io.github.HakanSeven12.H7CAD.desktop /app/share/applications/io.github.HakanSeven12.H7CAD.desktop + - install -Dm644 flatpak/io.github.HakanSeven12.H7CAD.metainfo.xml /app/share/metainfo/io.github.HakanSeven12.H7CAD.metainfo.xml + sources: + - type: git + url: https://github.com/HakanSeven12/H7CAD.git + tag: v0.1.0 + commit: FILL_IN_COMMIT_HASH + - cargo-sources.json