VPKEdit icon indicating copy to clipboard operation
VPKEdit copied to clipboard

feat(installer): initial flatpak packaging

Open lina-bh opened this issue 9 months ago • 8 comments

Discussion in #221

What works:

  • The Flatpak builds and runs properly, with KDE desktop theme
  • I can load tf2_misc_000.vpk successfully inside and outside the sandbox

What currently does not work:

  • Translations are currently not included in the Flatpak
  • The portaled file picker is currently not used as it does not unveil the directory of the chosen file, which (not exclusively) vpkpp requires so it can open split files
  • As a consequence the Flatpak currently asks for --filesystem=host which may weird out some users
  • No AppStream data (description, url, etc)

Potentially controversial:

  • The category of the desktop file has been changed to Game since Flatpak will complain if an entry is in multiple categories. This makes sense to me, because in the launcher the app is next to Steam. May not make sense to anyone else.

What was not tested:

  • Windows
  • Non-KDE Linux desktops (GNOME)
  • Installation inside bare metal traditional Linux distro

What is currently missing but would be nice:

  • GitHub actions for CI/nightly builds

I'd like to get the current work into the repo so that it can be built upon further

How to build and install:

  • A Makefile is included in src/installer/linux, run make flatpak to build and make flatpak-install to install to your current system
  • Various options are available:
    • FLATPAK_INSTALLATION: change this to --user if, for example, you are running inside a development container
    • FLATPAK_BUILDER_FLAGS/FLATPAK_INSTALL_FLAGS: override flags passed to flatpak-builder and flatpak install
    • FLATPAK_BUILDER_EXTRA_FLAGS: as above, but in addition to the default flags

lina-bh avatar Feb 21 '25 12:02 lina-bh

@craftablescience do you have any time to review and merge?

lina-bh avatar Mar 02 '25 13:03 lina-bh

Sorry for the holdup, there's a lot going on in my life right now

craftablescience avatar Mar 03 '25 02:03 craftablescience

I have other tweaks I'll be pushing, but I don't know what the flatpak builder wants from the desktop entry. Will merge as soon as I get clarification

craftablescience avatar Mar 03 '25 03:03 craftablescience

Sorry for the holdup, there's a lot going on in my life right now

Sorry to hassle you, its not that important in the grand scheme of things, I had just worried that you hadn't seen it. Take as long as you need

lina-bh avatar Mar 03 '25 11:03 lina-bh

Hi @lina-bh,

These changes were a bit too bleeding edge for me to be comfortable merging before last release, so I waited to work on this until that was out. Please let me know if these changes work, I haven't tested them but in theory these changes revert the Linux installer to how it was before, and the flatpak should still work the same.

If this works for you, I'm good to merge it in its current state.

craftablescience avatar Mar 09 '25 22:03 craftablescience

Been a while but i think this PR and trunk have diverged, please take a look at main. As it happens life decided to start handing me my arse on a daily basis so I haven't gotten around to looking at this again

On Mon, 31 Mar 2025, at 06:04, underscorejoser wrote:

@.**** commented on this pull request.

Overall, there's a couple of more things to take a look at. I think it would be better to unify .desktop and other things because its not flatpak related and others package would also benefit, but it can be break current packages.

I don't know if its weird someone from nowhere reviewing but a time ago i was trying to make a flatpak package too for vpkedit. I had some trouble because i don't know C++ nor CMake and with a lot of updates being pushed there was a moment where i couldn't get it working so i stopped, but i'm gladly to see someone is doing, so i'm here to try to help.

In src/installer/flatpak/info.craftablescience.vpkedit.Devel.yaml https://github.com/craftablescience/VPKEdit/pull/223#discussion_r2020396461:

@@ -0,0 +1,28 @@ +"$schema": "https://raw.githubusercontent.com/flatpak/flatpak-builder/main/data/flatpak-manifest.schema.json" +id: info.craftablescience.vpkedit.Devel

Wouldn't be better using the name capitalized? info.craftablescience.VPKEdit

In src/installer/flatpak/info.craftablescience.vpkedit.Devel.yaml https://github.com/craftablescience/VPKEdit/pull/223#discussion_r2020400908:

+finish-args:

    • "--socket=wayland"
    • "--socket=fallback-x11"
    • "--filesystem=host"
    • "--env=QT_QPA_PLATFORMTHEME=kde"

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 host. I would prefer something like home but still not ideal, and for certain cases it wouldn't work ootb but for now its fine.

I don't think QT_QPA_PLATFORMTHEME=kde is needed and if this is gonna be on flathub it probably will be call out.

Other than that there's a couple of missing args like --device=dri and --share=ipc which is generally used.

In src/installer/flatpak/info.craftablescience.vpkedit.Devel.yaml https://github.com/craftablescience/VPKEdit/pull/223#discussion_r2020401729:

  •  build-args:
    
  •    - "--share=network"
    

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?

In src/installer/flatpak/info.craftablescience.vpkedit.Devel.yaml https://github.com/craftablescience/VPKEdit/pull/223#discussion_r2020402033:

    • "--socket=fallback-x11"
    • "--filesystem=host"
    • "--env=QT_QPA_PLATFORMTHEME=kde" +modules:
    • name: vpkedit
  • buildsystem: cmake-ninja
  • build-options:
  •  build-args:
    
  •    - "--share=network"
    
  •  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"
    

You don't really need to specify, you can just use the env FLATPAK_ID internally.

In src/installer/flatpak/Makefile https://github.com/craftablescience/VPKEdit/pull/223#discussion_r2020409528:

+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

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.

— Reply to this email directly, view it on GitHub https://github.com/craftablescience/VPKEdit/pull/223#pullrequestreview-2728221452, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIYEFFV7DIPO752Y3YYBXM32XDEHVAVCNFSM6AAAAABXTDPAJSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDOMRYGIZDCNBVGI. You are receiving this because you were mentioned.Message ID: @.***>

lina-bh avatar Mar 31 '25 09:03 lina-bh

Would you prefer i take your work to another pull request superseding it?

ghost avatar Mar 31 '25 12:03 ghost

absolutely no problem. tbf I had written this to get it working at any level for atomic systems but I am on regular r/w root now. if you would like to finish the long tail for flathub you have no objection from me 😅

I do wish that flatpak could pull packages from a bog standard OCI registry, but it appears that it's harder than it looks because you need to hand flatpak some metadata that you can't easily get working for eg GitHub container registry

lina-bh avatar Mar 31 '25 16:03 lina-bh

Closing due to inactivity + significantly diverged from main

craftablescience avatar Jul 18 '25 07:07 craftablescience