Skip to content
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

Flatpak #39

Closed
JakobDev opened this issue Jan 2, 2024 · 23 comments
Closed

Flatpak #39

JakobDev opened this issue Jan 2, 2024 · 23 comments

Comments

@JakobDev
Copy link
Contributor

JakobDev commented Jan 2, 2024

I created a Flatpak for DeltaPatcher. This allows easier installing on evry Linux Distro. Here is the Manifest:

id: io.github.marco_calautti.DeltaPatcher
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
command: DeltaPatcher
finish-args:
  - --socket=fallback-x11
  - --socket=wayland
  - --filesystem=host
  - --device=dri
  - --device=dri

modules:
  - name: DeltaPatcher
    buildsystem: cmake-ninja
    post-install:
      - install -Dm755 app/DeltaPatcher $FLATPAK_DEST/bin/DeltaPatcher
    sources:
      - type: git
        url: https://github.com/marco-calautti/DeltaPatcher.git

I shows a error but it works without any problems. It needs a few things before it can be fully released. tell me, if you are interested.

@marco-calautti
Copy link
Owner

That would be actually nice to have. I guess you need to add a .desktop file with the icon, and such. You can find the icons at different resolutions in the "graphics" directory in the repo. My only concern is support to the system theme. Delta Patcher supports light and dark modes, depending on the system settings. The flatpak should be configured properly so that Delta Patcher is able to use the right theme. Feel free to submit a pull request!

@marco-calautti
Copy link
Owner

Another thing I am not sure how will workout in Flatpak is the lack of portals. Delta Patcher does not make explicit use of portals, and so I am wondering how it can access files from the file system. I guess you need to specify the right filesystem permissions in the manifest (which are currently doing), but using "host" as filesystem permissions is maybe overkill. I guess "home" is a better option for Delta Patcher.

@JakobDev
Copy link
Contributor Author

JakobDev commented Jan 3, 2024

I have now created #40 for the data files.

My only concern is support to the system theme. Delta Patcher supports light and dark modes, depending on the system settings.

Looks like this is already supported by wxWidgets.

Another thing I am not sure how will workout in Flatpak is the lack of portals.

Gtk has GtkFileChooserNative, which uses the Portals. I don't know much abou wxWidgets, but maybe you can use this function in the Gtk Backend.

You also need to fix this error, which appers on startup.
grafik

@marco-calautti
Copy link
Owner

The error you mention is due to the fact you are compiling wxwidgets in debug mode. Please use the cmake flags as specified in the readme for Linux.

@marco-calautti
Copy link
Owner

Of you are using the system's wxwidgets lib, then you will also get that error, as all binaroes of wxwidgets I am aware of in repositories are all compiled with assertions ON

@JakobDev
Copy link
Contributor Author

JakobDev commented Jan 3, 2024

When using DCMAKE_BUILD_TYPE=RelWithDebInfo the message no longer appears, but you should fix the underlying bug.

@marco-calautti
Copy link
Owner

I have just pushed a pull request that fixes the warnings. They should not appear anymore. Anyway, I think building in Release mode is still preferred, as this avoids wxWidgets countinuously calling its asserts, "slowing down" things.

@JakobDev
Copy link
Contributor Author

JakobDev commented Jan 3, 2024

Anyway, I think building in Release mode is still preferred

It is usual to build a Flatpak with debug symbols, but you can change this if you really want it.

The only missing thing is now to use the Portals. If you don't know how to use Portals in wxWidgets, you can use zenity, whcih is preinstalled in the Flatpak Runtime. Just run zenity --file-selection to open a file dialog. You can use the --file-filter argument to add a filter.

Here is the current version of the Manifest:

id: io.github.marco_calautti.DeltaPatcher
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
command: DeltaPatcher
finish-args:
  - --socket=fallback-x11
  - --socket=wayland
  - --filesystem=host
  - --device=dri
  - --device=dri

modules:
  - name: DeltaPatcher
    buildsystem: cmake-ninja
    config-opts:
      - -DCMAKE_BUILD_TYPE=RelWithDebInfo
      - -DwxBUILD_SHARED=OFF
    sources:
      - type: dir
        path: /path/to/source

Just set the path to the source directory of DeltaPatcher.

@marco-calautti
Copy link
Owner

marco-calautti commented Jan 4, 2024

I tried the manifest on my local machine, and portals are not required, assuming we give filesystem access (actually, Delta Patcher only requires home). I slightly modified the manifest to also allow the flatpak to have access to the current system gtk theme:

id: io.github.marco_calautti.DeltaPatcher
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
command: DeltaPatcher
finish-args:
  - --socket=fallback-x11
  - --socket=wayland
  - --filesystem=home
  - --filesystem=xdg-config/gtk-3.0:ro
  - --device=dri
  - --device=dri

modules:
  - name: DeltaPatcher
    buildsystem: cmake-ninja
    config-opts:
      - -DCMAKE_BUILD_TYPE=RelWithDebInfo
      - -DwxBUILD_SHARED=OFF
    sources:
      - type: dir
        path: /path/to/source

@marco-calautti
Copy link
Owner

I will now create a new tag for the new version, and I guess you can submit the flatpak manifest to flathub referencing the new tag.

@marco-calautti
Copy link
Owner

@JakobDev
Copy link
Contributor Author

JakobDev commented Jan 5, 2024

portals are not required, assuming we give filesystem access

I don't said that it is not working with filesystem access. That's the reason my Manifest has Host access, but it would be better if Portals were used instead of this Permission.

(actually, Delta Patcher only requires home)

I would rather give host access. With home access Users can't open any files on external drives. Full home access aleady allows breaking the Sandbox, as you can edit e.g. .bashrc or startup files, so host access is not more insecure.

and I guess you can submit the flatpak manifest to flathub referencing the new tag.

Yes. Use this as you source:

- type: git
  url: https://github.com/marco-calautti/DeltaPatcher.git
  tag: 'v3.1.3'
  commit: 46011a90aade9c178020d9d5c96817b33c7b33c3
  x-checker-data:
    type: git

@JakobDev
Copy link
Contributor Author

JakobDev commented Jan 5, 2024

I discovered a little misstake in my Manifest instead of:

- --device=dri
- --device=dri

use

- --device=dri
- --share=ipc

@marco-calautti
Copy link
Owner

I fear portals would not be enough for Delta Patcher, as it also requires to write and rename additional files in a non interactive way when patching a file (e.g., creating a backup of the original file).

@JakobDev
Copy link
Contributor Author

JakobDev commented Jan 5, 2024

Portals give only access to the selected file, so in this case Portals would not work for you.

@JakobDev
Copy link
Contributor Author

Is there anything blocking you from publish on Flathub?

@marco-calautti
Copy link
Owner

Mostly my daily job. I plan to release it in one of the upcoming weekends.

@JakobDev
Copy link
Contributor Author

OK. I was just wondering.

@marco-calautti
Copy link
Owner

@marco-calautti
Copy link
Owner

It is now on flathub https://flathub.org/it/apps/io.github.marco_calautti.DeltaPatcher
closing

@JakobDev
Copy link
Contributor Author

JakobDev commented Apr 9, 2024

You should verify it. Just login with your GitHub on Flathub and you can verify it in the developer settings.

@marco-calautti
Copy link
Owner

I did login but it seems there are some checks that failed. I requested a review.

@marco-calautti
Copy link
Owner

Ok, now it is verified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants