inyokaproject / inyokaedit

A markup editor for Inyoka articles.
GNU General Public License v3.0
7 stars 6 forks source link

Flatpak #114

Closed JakobDev closed 10 months ago

JakobDev commented 1 year ago

I've created a Flatpak for InyokaEdit. You will need these files:

org.inyokaproject.inyokaedit.yaml

id: org.inyokaproject.inyokaedit
runtime: org.kde.Platform
runtime-version: '6.5'
sdk: org.kde.Sdk
base: io.qt.qtwebengine.BaseApp
base-version: '6.5'
command: inyokaedit
rename-icon: inyokaedit
finish-args:
  - --env=QTWEBENGINEPROCESS_PATH=/app/bin/QtWebEngineProcess
  - --socket=fallback-x11
  - --socket=wayland
  - --share=network
  - --device=dri
  - --share=ipc
cleanup-commands:
  - /app/cleanup-BaseApp.sh

modules:
  - name: inyokaedit
    buildsystem: cmake-ninja
    config-opts:
      - -DCOMMUNITY=community/ubuntuusers_de
      - -DQT6=ON
    post-install:
      - mv $FLATPAK_DEST/share/mime/packages/inyokaedit.xml $FLATPAK_DEST/share/mime/packages/$FLATPAK_ID.xml
      - sed -i 's/<id>org.inyokaproject.inyokaedit.desktop/<id>org.inyokaproject.inyokaedit/g' $FLATPAK_DEST/share/metainfo/org.inyokaproject.inyokaedit.metainfo.xml
    sources:
      - type: archive
        archive-type: tar-gzip
        url: https://api.github.com/repos/inyokaproject/inyokaedit/tarball/v0.27.3
        sha256: ff1c9a1da0bb94d9210964c1f064ec821ee114440a90930daf1368f79524049a
        x-checker-data:
            type: json
            url: https://api.github.com/repos/inyokaproject/inyokaedit/releases/latest
            version-query: .tag_name
            url-query: .tarball_url
      - type: archive
        dest: community
        url: https://github.com/inyokaproject/inyokaedit/releases/download/v0.27.3/inyokaedit-community-0.27.3.zip
        sha256: 3a79e2379abd4e1aea375e2e537d2606740f0a8be571d151d94da9bad95598ff
        x-checker-data:
            type: json
            url: https://api.github.com/repos/inyokaproject/inyokaedit/releases/latest
            version-query: .tag_name
            url-query: .assets[] | select(.name | startswith("inyokaedit-community")) | .browser_download_url
      - type: patch
        path: cmake.patch

cmake.patch:

diff -ruN a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt    2023-04-26 16:28:15.000000000 +0200
+++ b/CMakeLists.txt    2023-07-07 10:24:52.633074389 +0200
@@ -19,7 +19,7 @@
     VERSION 0.27.1
     DESCRIPTION "Editor for Inyoka based portals"
     HOMEPAGE_URL "https://github.com/inyokaproject/inyokaedit"
-    LANGUAGES CXX
+    LANGUAGES C CXX
 )
 set(PROJECT_COPYRIGHT "(C) 2011-present The InyokaEdit developers")

It builds and is working. As you can see, I needed to patch the CMakeLists.txt to make the build actually work. Would be nice, if this would be included upstream. Another thing I had to do was renaming the icons (done by rename-icon) and the Mime package from inyokaedit to org.inyokaproject.inyokaedit. I also needed to use org.inyokaproject.inyokaedit instead of org.inyokaproject.inyokaedit.desktop as ID in the AppStream. This should be included Upstream. I can create a PR to do this.

A big problem is, that QtWebEngine exists in the Flatpak, but is not found. You should also fix that.

Tell me, if you are interested in publishing the Flatpak on Flathub.

ElTh0r0 commented 1 year ago

Great, many thanks @JakobDev for your support! I included the mentioned changes in the code. Regarding QtWebEngine: Not sure, why it was not automatically found, but adding it to the config-opts solved it for me:

id: org.inyokaproject.inyokaedit
runtime: org.kde.Platform
runtime-version: '6.5'
sdk: org.kde.Sdk
base: io.qt.qtwebengine.BaseApp
base-version: '6.5'
command: inyokaedit
finish-args:
  - --env=QTWEBENGINEPROCESS_PATH=/app/bin/QtWebEngineProcess
  - --socket=fallback-x11
  - --socket=wayland
  - --share=network
  - --device=dri
  - --share=ipc
cleanup-commands:
  - /app/cleanup-BaseApp.sh

modules:
  - name: inyokaedit
    buildsystem: cmake-ninja
    config-opts:
      - -DCOMMUNITY=community/ubuntuusers_de
      - -DQT6=ON
      - -DPREVIEW=useqtwebengine
    sources:
      - type: archive
        archive-type: zip
        url: https://github.com/inyokaproject/inyokaedit/archive/refs/heads/main.zip
        sha256: e314603b90a6e6394e502fc7143c3e631e1112e7ff6d9cc916f8a81be01a4a58
      - type: archive
        dest: community
        url: https://github.com/inyokaproject/inyokaedit/releases/download/v0.27.3/inyokaedit-community-0.27.3.zip
        sha256: 3a79e2379abd4e1aea375e2e537d2606740f0a8be571d151d94da9bad95598ff
        x-checker-data:
            type: json
            url: https://api.github.com/repos/inyokaproject/inyokaedit/releases/latest
            version-query: .tag_name
            url-query: .assets[] | select(.name | startswith("inyokaedit-community")) | .browser_download_url

I'll do some more tests in the next days and would upload it to Flathub, too. Please test with the included upstream changes as well! I already saw, that the spellchecker plugin is not working (but this is not working in my AppImage as well..). But so far everything else seem to work.

JakobDev commented 1 year ago

Great, many thanks @JakobDev for your support!

You're welcome

Regarding QtWebEngine: Not sure, why it was not automatically found, but adding it to the config-opts solved it for me:

Maybe you have a error in your detection logic. You should also mention this Option in your Readme.

You can also use git as source, so it won't break when making a new commit:

  - type: git
    url: https://github.com/inyokaproject/inyokaedit.git
    commit: whatever

If you don't specify the commit, it uses the latest commit.

If everything is ready you should make a new Release (it is common that Flatpaks on Flathub contains a full release). and switch back to the archive type. The x-checker-data are for flatpak-external-data-checker. If InyokaEdit is on Flathub, it will automatically and release a new Version open a PR with the new version.

I already saw, that the spellchecker plugin is not working (but this is not working in my AppImage as well..).

Maybe it's missing a library or some data files (e.g. dicts). or a Path is hardcoded to /usr. Can you try to investigate what's causes this, s I can help you fix it?

btw: Is the domain inyokaproject.org still in use? I'm asking because Flathub requires the use of a valid Domain of the Developer as App ID.

ElTh0r0 commented 10 months ago

(Spellchecker in Flatpak fixed with v0.28.1) I still couldn't figure out the issue with the spellchecker plugin / too less time to investigate, but I released a Flatpak build with v0.27.4 on the release page (not on Flathub, yet) Thanks again for your support!

JakobDev commented 10 months ago

still couldn't figure out the issue with the spellchecker plugin

If you have a question how Flatpak works, just ask.

not on Flathub, yet

Just make a a PR against the new-pr branch with your manifest here. Here are detailed instructions.

Jut a side note: the current version of the KDE runtime is 6.6.