Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85711361
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/packaging/GNU-Linux/flatpak/Makefile b/packaging/GNU-Linux/flatpak/Makefile
new file mode 100644
index 0000000..53dcadd
--- /dev/null
+++ b/packaging/GNU-Linux/flatpak/Makefile
@@ -0,0 +1,45 @@
+
+all: kazv.flatpak
+.PHONY: clean distclean vodozemac-bindings-update
+
+PYTHON := $(shell which python)
+NJOBS := $(shell nproc)
+FLATHUB_REPO := https://flathub.org/repo/flathub.flatpakrepo
+FLATPAK_CARGO_GENERATOR := https://raw.githubusercontent.com/flatpak/flatpak-builder-tools/master/cargo/flatpak-cargo-generator.py
+ifneq ($(GPG_KEY),)
+SIGN_ARGS = --gpg-sign=$(GPG_KEY)
+else
+SIGN_ARGS =
+endif
+
+repo: add-flathub-repo cargo-sources.json
+ flatpak-builder --jobs=$(NJOBS) --user --install-deps-from=flathub --force-clean --ccache --repo=repo $(SIGN_ARGS) flatpak-build moe.kazv.mxc.kazv.yaml
+
+kazv.flatpak: repo
+ flatpak build-bundle repo kazv.flatpak --runtime-repo='$(FLATHUB_REPO)' $(SIGN_ARGS) moe.kazv.mxc.kazv
+
+venv/bin/flatpak-cargo-generator: venv
+ wget -O $@ '$(FLATPAK_CARGO_GENERATOR)'
+ chmod +x $@
+
+venv: $(PYTHON)
+ $(PYTHON) -m venv $@
+ ./venv/bin/pip3 install aiohttp tomlkit
+
+add-flathub-repo:
+ flatpak remote-add --user --if-not-exists flathub '$(FLATHUB_REPO)'
+
+vodozemac-bindings:
+ git clone https://lily-is.land/kazv/vodozemac-bindings.git
+
+vodozemac-bindings-update: vodozemac-bindings
+ cd vodozemac-bindings && git pull --rebase
+
+cargo-sources.json: venv/bin/flatpak-cargo-generator vodozemac-bindings-update
+ . ./venv/bin/activate && venv/bin/flatpak-cargo-generator vodozemac-bindings/Cargo.lock -o cargo-sources.json
+
+clean:
+ rm -rf repo kazv.flatpak flatpak-build
+
+distclean: clean
+ rm -rf venv vodozemac-bindings cargo-sources.json
diff --git a/packaging/GNU-Linux/flatpak/README.md b/packaging/GNU-Linux/flatpak/README.md
index 08f2761..ae534ca 100644
--- a/packaging/GNU-Linux/flatpak/README.md
+++ b/packaging/GNU-Linux/flatpak/README.md
@@ -1,52 +1,62 @@
# Building flatpak for kazv
+## Automatically
+
+In this directory, run
+
+```
+make NJOBS=<number of jobs>
+```
+
+## Manually
+
All blocks are run from the repository root unless specified.
Setup the environment:
```
cd packaging/GNU-Linux/flatpak
python -m venv venv
. ./venv/bin/activate
pip3 install aiohttp tomlkit
wget -O./venv/bin/flatpak-cargo-generator https://raw.githubusercontent.com/flatpak/flatpak-builder-tools/master/cargo/flatpak-cargo-generator.py
chmod +x ./venv/bin/flatpak-cargo-generator
cd ../../..
```
Setup flatpak:
```
flatpak remote-add --user --if-not-exists flathub 'https://flathub.org/repo/flathub.flatpakrepo'
```
Fetch cargo sources (if you run into problems building vodozemac-bindings, run `git pull` in the `vodozemac-bindings` directory and rerun `flatpak-cargo-generator` command):
```
cd packaging/GNU-Linux/flatpak
. ./venv/bin/activate
git clone https://lily-is.land/kazv/vodozemac-bindings.git
flatpak-cargo-generator vodozemac-bindings/Cargo.lock -o cargo-sources.json
cd ../../..
```
Build:
```
cd packaging/GNU-Linux/flatpak
flatpak-builder --jobs=NJOBS --user --install-deps-from=flathub --force-clean --ccache --repo=repo flatpak-build moe.kazv.mxc.kazv.yaml
flatpak build-bundle repo kazv.flatpak --runtime-repo='https://flathub.org/repo/flathub.flatpakrepo' moe.kazv.mxc.kazv
```
Replace `NJOBS` with the number of parallel jobs you want to run.
Install:
```
cd packaging/GNU-Linux/flatpak
flatpak install --user --bundle ./kazv.flatpak
```
# See also
[Upstream documentation about building a flatpak](https://docs.flatpak.org/en/latest/hosting-a-repository.html)
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Sep 19, 5:11 AM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1768905
Default Alt Text
(3 KB)
Attached To
Mode
rK kazv
Attached
Detach File
Event Timeline
Log In to Comment