-
-
Notifications
You must be signed in to change notification settings - Fork 47
feat(installer): initial flatpak packaging #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f7bb755
3153256
c483806
8d5e9c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| .POSIX: | ||
| # Development flatpak tasks | ||
|
|
||
| FLATPAK_ID := info.craftablescience.vpkedit.Devel | ||
|
|
||
| _GIT_TOPLEVEL := $(shell git rev-parse --show-toplevel) | ||
|
|
||
| FLATPAK_BUILD_MANIFEST := $(realpath ./$(FLATPAK_ID).yaml) | ||
| FLATPAK_BUILD_DIR := $(_GIT_TOPLEVEL)/flatpak-build/ | ||
| FLATPAK_REPO := $(_GIT_TOPLEVEL)/.flatpak-builder/cache | ||
|
|
||
| FLATPAK_INSTALLATION := --system # or --user | ||
| FLATPAK_BUILDER_FLAGS := --force-clean --install-deps-from=flathub --ccache --repo=$(FLATPAK_REPO) $(FLATPAK_INSTALLATION) $(FLATPAK_BUILDER_EXTRA_FLAGS) | ||
| FLATPAK_INSTALL_FLAGS := --reinstall $(FLATPAK_INSTALLATION) | ||
|
|
||
| flatpak: | ||
| cd $(_GIT_TOPLEVEL) && \ | ||
| flatpak-builder $(FLATPAK_BUILDER_FLAGS) $(FLATPAK_BUILD_DIR) $(FLATPAK_BUILD_MANIFEST) || \ | ||
| printf "you may need to add flathub to your target installation\n\ | ||
| flatpak remote-add --if-not-exists %s flathub https://dl.flathub.org/repo/flathub.flatpakrepo\n" \ | ||
| $(FLATPAK_INSTALLATION) \ | ||
| 2>&1 | ||
|
|
||
| # https://github.com/flatpak/flatpak/issues/5076 | ||
| # on debian stable flatpak inside container, cannot install without setting | ||
| # session env due to lack of d-bus system bus to connect to parental controls api (?!!!) | ||
| # set FLATPAK_SYSTEM_HELPER_ON_SESSION=1 | ||
| flatpak-install: | ||
| flatpak install $(FLATPAK_INSTALL_FLAGS) $(FLATPAK_REPO) $(FLATPAK_ID) $(FLATPAK_ID).Debug | ||
|
|
||
| .PHONY: flatpak flatpak-install | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| install(TARGETS ${PROJECT_NAME}cli ${PROJECT_NAME} | ||
| DESTINATION "bin/") | ||
|
|
||
| set(VPKEDIT_MIME_TYPE_ICON_ID "${VPKEDIT_FLATPAK_ID}" CACHE INTERNAL "" FORCE) | ||
|
|
||
| # Desktop file | ||
| configure_file( | ||
| "${CMAKE_CURRENT_LIST_DIR}/desktop.in" | ||
| "${CMAKE_CURRENT_LIST_DIR}/generated/${VPKEDIT_FLATPAK_ID}.desktop") | ||
| install(FILES "${CMAKE_CURRENT_LIST_DIR}/generated/${VPKEDIT_FLATPAK_ID}.desktop" | ||
| DESTINATION "share/applications/") | ||
| install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/branding/logo.png" | ||
| DESTINATION "share/pixmaps/" | ||
| RENAME "${PROJECT_NAME}.png") | ||
| install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/branding/logo.png" | ||
| DESTINATION "share/icons/hicolor/128x128/apps/" | ||
| RENAME "${VPKEDIT_FLATPAK_ID}.png") | ||
|
|
||
| # MIME type info | ||
| configure_file( | ||
| "${CMAKE_CURRENT_LIST_DIR}/../linux/mime-type.xml.in" | ||
| "${CMAKE_CURRENT_LIST_DIR}/generated/mime-type.xml") | ||
| install(FILES "${CMAKE_CURRENT_LIST_DIR}/generated/mime-type.xml" | ||
| DESTINATION "share/mime/packages/" | ||
| RENAME "${VPKEDIT_FLATPAK_ID}.xml") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| [Desktop Entry] | ||
| Name=${PROJECT_NAME_PRETTY} | ||
| Comment=${PROJECT_DESCRIPTION} | ||
| Exec=${PROJECT_NAME} %f | ||
| Icon=${VPKEDIT_MIME_TYPE_ICON_ID} | ||
| Terminal=false | ||
| Type=Application | ||
| Categories=Game | ||
| MimeType=application/x-vpkedit-007;application/x-vpkedit-bee-pack;application/x-vpkedit-bmz;application/x-vpkedit-bsp;application/x-vpkedit-fpk;application/x-vpkedit-fpx;application/x-vpkedit-gcf;application/x-vpkedit-gma;application/x-vpkedit-hog;application/x-vpkedit-ol;application/x-vpkedit-ore;application/x-vpkedit-pak;application/x-vpkedit-pck;application/x-vpkedit-vpk;application/x-vpkedit-vpp;application/x-dmx;application/x-mdl;image/x-ppl;image/x-tth;image/x-ttz;image/x-vtf; | ||
| PrefersNonDefaultGPU=true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| "$schema": "https://raw.githubusercontent.com/flatpak/flatpak-builder/main/data/flatpak-manifest.schema.json" | ||
| id: info.craftablescience.vpkedit.Devel | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't be better using the name capitalized?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. uppercased rDNS names are harder to tab complete which upsets me to no end There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's more correct but ultimately doesn't matter, up to you or craftablescience |
||
| runtime: org.kde.Platform | ||
| runtime-version: "6.8" | ||
| sdk: org.kde.Sdk | ||
| command: vpkedit | ||
| finish-args: | ||
| - "--socket=wayland" | ||
| - "--socket=fallback-x11" | ||
| - "--filesystem=host" | ||
| - "--env=QT_QPA_PLATFORMTHEME=kde" | ||
|
Comment on lines
+7
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know the current model of flatpak and portals doesn't work much in favor of how vpkedit gets split vpk, but i don't think it's a good idea to have access to I don't think Other than that there's a couple of missing args like |
||
| modules: | ||
| - name: vpkedit | ||
| buildsystem: cmake-ninja | ||
| build-options: | ||
| build-args: | ||
| - "--share=network" | ||
|
Comment on lines
+16
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Following about being on flathub, you cannot build with network permission, since this is a development manifest there's no problem but just saying. Also, vpkedit even needs internet to build?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. one of the dependencies git-clones another dependency in a certified C++ build systems moment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh i see, that's annoying but we should be able to workaround downloading ahead of time and placing where its expect to be hopefully
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its all using cmake's FetchContent, so if the repos are precloned in the places it expects to find them it should build without internet There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i thought it was only one dependency that require this but found out it isn't and also couldn't figure it out where to put it to the build process automatically use instead of trying to download but well, i continued to do stuff and just enabled network in the meantime, but then one of the dependencies i can't download and now tbh i don't know what to do
another option i see is just skipping building in flatpak and just extracting the release packages, far from ideal but it should work any thoughts?
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think hosting precompiled binaries that the flatpak links to is a workable idea. If VPKEdit is changed to use these binaries for every platform, it would also save a lot of time building locally and in CI. I'll need to do some setup on the sourcepp end to make an auto-release button first ofc. I was planning to set up releases at some point regardless to distribute the C wrapper dlls without the end user needing to compile the library. Of course on the flip side I also think that building the VPKEdit flatpak without sourcepp prebuilt is also workable and might even be easier once the FetchContent stuff is resolved. That error you're getting with bzip2 might be because it's cloning multiple copies at the same time? Or sourceforge is just unreliable... if its unsolvable there is a CMake option to disable bzip2 compression support.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps it's possible to build it as a module inside the KDE SDK for the flatpak builder and then bring it into the build afterwards? This would mean that there is no ABI drift There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
i think you mean
i don't think i'm following what you saying, can explain wdym?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One of the benefits of containerisation is having a consistent set of libraries to build against, getting around the DLL Hell that mixing and matching ABIs and libraries from different distributions can cause. This is why shipping Qt shared objects inside tarballs for Linux apps kind of gives me the willies. We're not Windows, we don't really have stable ABI guarantees since we got used to being able to rebuild things at will, usually by our distribution, but Flatpak is a concession after learning that doesn't scale. It should be possible to create an artifact that contains the binaries for the dependencies that ask for network access, then import that artifact into a sandboxed build for Flathub, without the build system for VPKEdit needing network access. All the while matching the SDK environment so that everything is consistent.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah but i just ended up got it working after a little help and inspiration from the nix package, also there's the detail that compiling together helps to compile for another architectures. About the Extrapolated a bit but now only has some more things to do like metainfo and testing to make sure everything works. |
||
| config-opts: | ||
| - "-Wno-dev" | ||
| - "-DCMAKE_BUILD_TYPE=Release" | ||
| - "-DVPKEDIT_USE_LTO=ON" | ||
| - "-DVPKEDIT_BUILD_INSTALLER=OFF" | ||
| - "-DVPKEDIT_BUILD_FLATPAK=ON" | ||
| - "-DVPKEDIT_FLATPAK_ID=info.craftablescience.vpkedit.Devel" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't really need to specify, you can just use the env |
||
| builddir: true | ||
| sources: | ||
| - type: dir | ||
| path: ../../.. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't have the option to use the flatpak version of
flatpak-builder(org.flatpak.Builder) and the way it seems to work is that any error that could occur during the compilation would also print about needing to add flathub.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using
org.flatpak.Builderis an obvious change yeah, i wrote this on ublue where it is installed on the host