From 7829c8757a73d8e8fc5c2481fe758fbd87ad1532 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Mon, 22 Jun 2026 11:44:57 +0800 Subject: Working viewer except for media plugins for now JSON instead of YAML because there was some warning/error when I tried the YAML version. Network sharing needed as a build argument for fetching prebuilt packages. I added a device=input finish argument to anticipate devices like the SpaceNavigator. flatpak-builder seems to build debug versions of the binaries by default and install them to lib/debug, and since libraries are all installed to lib64, the whole lib folder can be safely cleaned up. The USE_FLATPAK boolean CMake variable got introduced in the viewer codebase. The source type is "dir" for now to ease early development, just drop the JSON file in the viewer source code root directory, and run as in the build instruction. Later we should change this to archive or git, so this repo can stand alone and be ready to be contributed to flathub. --- .gitignore | 2 ++ README.md | 5 ++++ net.megapahit.Viewer.json | 58 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 net.megapahit.Viewer.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..43d2950 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.flatpak-builder +*.flatpak diff --git a/README.md b/README.md new file mode 100644 index 0000000..87bc85f --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +``` +$ flatpak-builder --force-clean --user --install-deps-from=flathub --install build-flatpak-`uname -m` net.megapahit.Viewer.json +$ flatpak run net.megapahit.Viewer +$ flatpak build-bundle ~/.local/share/flatpak/repo megapahit.flatpak net.megapahit.Viewer +``` diff --git a/net.megapahit.Viewer.json b/net.megapahit.Viewer.json new file mode 100644 index 0000000..232e606 --- /dev/null +++ b/net.megapahit.Viewer.json @@ -0,0 +1,58 @@ +{ + "id": "net.megapahit.Viewer", + "runtime": "org.freedesktop.Platform", + "runtime-version": "25.08", + "sdk": "org.freedesktop.Sdk", + "command": "megapahit", + "build-options": { + "env": { + "LL_BUILD": "-O3 -std=c++20 -fPIC -DLL_LINUX=1" + }, + "build-args": [ + "--share=network" + ] + }, + "finish-args": [ + "--device=dri", + "--device=input", + "--share=ipc", + "--share=network", + "--socket=pulseaudio", + "--socket=wayland", + "--socket=fallback-x11", + "--filesystem=home" + ], + "cleanup":[ + "/lib" + ], + "modules": [ + { + "name": "megapahit", + "buildsystem": "cmake-ninja", + "subdir": "indra", + "config-opts": [ + "-DCMAKE_BUILD_TYPE:STRING=Release", + "-DADDRESS_SIZE:STRING=64", + "-DUSE_OPENAL:BOOL=ON", + "-DUSE_FMODSTUDIO:BOOL=OFF", + "-DUSE_FLATPAK:BOOL=ON", + "-DENABLE_MEDIA_PLUGINS:BOOL=ON", + "-DLL_TESTS:BOOL=OFF", + "-DNDOF:BOOL=ON", + "-DROOT_PROJECT_NAME:STRING=Megapahit", + "-DVIEWER_CHANNEL:STRING=Megapahit", + "-DVIEWER_BINARY_NAME:STRING=megapahit", + "-DBUILD_SHARED_LIBS:BOOL=OFF", + "-DINSTALL:BOOL=ON", + "-DPACKAGE:BOOL=OFF", + "-DCMAKE_INSTALL_PREFIX=/app" + ], + "sources": [ + { + "type": "dir", + "path": "." + } + ] + } + ] +} -- cgit v1.3