Improve the Flatpak build process

.desktop file, icon and appdata are now properly exported by flatpak.

"Wayland first" flatpak, falling back to X11 if not on Wayland.
Note: this is currently potentially broken on many systems (ie. font
rendering is broken).
See https://github.com/flatpak/flatpak/issues/2861.
Might work when using Wayland + Gnome, does not seem to work on Arch +
Sway (couldn't get it working with any workaround for now).

Several smaller issues addressed.

A few untested issues might remain (Screensharing, WebRTC/Camera access)

Addresses (at least partially): #128, #132, #131, #118
master
ohfp 2021-01-01 01:38:44 +01:00
parent 561ff61674
commit 9c0fcc0de5
No known key found for this signature in database
GPG Key ID: 2954CC8585E27A3F
6 changed files with 49 additions and 24 deletions

View File

@ -11,6 +11,7 @@ This project follows the official Firefox releases, but also uses
### Fixed
- Flatpak now properly provides a .desktop-file (and some other small improvements)
- Fixed AppImage crashes when `XDG_DATA_DIRS` is unset (fixes #139)
## [84.0-1] - 2020-12-25

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>io.gitlab.LibreWolf</id>
<launchable type="desktop-id">io.gitlab.LibreWolf</launchable>
<launchable type="desktop-id">io.gitlab.LibreWolf.desktop</launchable>
<name>LibreWolf</name>
<summary>LibreWolf Web Browser</summary>
<metadata_license>CC0-1.0</metadata_license>

View File

@ -10,7 +10,7 @@ FLATPAK_REPO=$2;
FLATPAK_BUNDLE=$3;
_SCRIPT_FOLDER=$(realpath $(dirname $0));
_FLATHUB_REPO="flathub https://flathub.org/repo/flathub.flatpakrepo";
_FLATHUB_PACKAGES_TO_INSTALL="org.gnome.Platform/${CARCH}/3.36 org.gnome.Sdk/${CARCH}/3.36";
_FLATHUB_PACKAGES_TO_INSTALL="org.gnome.Platform/${CARCH}/3.36 org.gnome.Sdk/${CARCH}/3.36 org.freedesktop.Platform//19.08 org.freedesktop.Sdk//19.08";
_EXTRACTED_BINARY_TARBALL_FOLDER=$_SCRIPT_FOLDER/librewolf
_FLATPAK_JSON_FILE=$_SCRIPT_FOLDER/content/io.gitlab.LibreWolf.json;
_FLATPAK_BUILD_SOURCE_FOLDER=$_SCRIPT_FOLDER/source;
@ -50,16 +50,17 @@ mv $_EXTRACTED_BINARY_TARBALL_FOLDER $_FLATPAK_BUILD_SOURCE_FOLDER;
# Build Repo
printf "\nBuilding flatpak repository\n";
cp "$_FLATPAK_JSON_FILE" ./;
flatpak-builder --disable-rofiles-fuse --repo="$FLATPAK_REPO" "$_FLATPAK_BUILD_FOLDER" io.gitlab.LibreWolf.json;
# add appstream metadata
# TODO: firefox uses files/share/appdata/ in their flatpak, but https://docs.flatpak.org/en/latest/conventions.html says otherwise. which is "more" correct?
install -Dvm644 "$_FLATPAK_BUILD_SOURCE_FOLDER/librewolf/io.gitlab.LibreWolf.appdata.xml" "$_FLATPAK_BUILD_FOLDER/files/share/metainfo/io.gitlab.LibreWolf.appdata.xml"
# TODO: firefox uses files/share/appdata/ in their flatpak, but https://docs.flatpak.org/en/latest/conventions.html says otherwise. which is "more" correct? => using both for now, just in case...
install -Dvm644 "$_FLATPAK_BUILD_SOURCE_FOLDER/librewolf/io.gitlab.LibreWolf.appdata.xml" "$_SCRIPT_FOLDER/source/share/metainfo/io.gitlab.LibreWolf.appdata.xml"
install -Dvm644 "$_FLATPAK_BUILD_SOURCE_FOLDER/librewolf/io.gitlab.LibreWolf.appdata.xml" "$_SCRIPT_FOLDER/source/share/appdata/LibreWolf.appdata.xml"
# add .desktop file
install -Dvm644 "$_SCRIPT_FOLDER/content/librewolf.desktop" "$_FLATPAK_BUILD_FOLDER/files/share/application/librewolf.desktop"
# it's not clear if the above is sufficient; follow what mozilla does
install -Dvm644 "$_SCRIPT_FOLDER/content/librewolf.desktop" "$_FLATPAK_BUILD_FOLDER/export/share/application/librewolf.desktop"
install -Dvm644 "$_SCRIPT_FOLDER/content/io.gitlab.LibreWolf.desktop" "$_SCRIPT_FOLDER/source/share/applications/LibreWolf.desktop"
install -Dvm644 "$_FLATPAK_BUILD_SOURCE_FOLDER/librewolf/browser/chrome/icons/default/default128.png" "$_SCRIPT_FOLDER/source/share/icons/hicolor/128x128/apps/io.gitlab.LibreWolf.png"
flatpak-builder --disable-rofiles-fuse --repo="$FLATPAK_REPO" "$_FLATPAK_BUILD_FOLDER" io.gitlab.LibreWolf.json;
# Build bundle
printf "\nBuilding flatpak bundle\n";

View File

@ -0,0 +1,25 @@
[Desktop Entry]
Name=LibreWolf
Exec=librewolf %u
Icon=io.gitlab.LibreWolf
Type=Application
MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;application/pdf;application/json;
StartupWMClass=LibreWolf
Categories=Network;WebBrowser;
StartupNotify=true
Terminal=false
X-MultipleArgs=false
Keywords=Internet;WWW;Browser;Web;Explorer;
Actions=new-window;new-private-window;profilemanager;
[Desktop Action new-window]
Name=Open a New Window
Exec=librewolf %u
[Desktop Action new-private-window]
Name=Open a New Private Window
Exec=librewolf --private-window %u
[Desktop Action profilemanager]
Name=Open the Profile Manager
Exec=librewolf --ProfileManager %u

View File

@ -4,6 +4,9 @@
"runtime-version": "3.36",
"sdk": "org.gnome.Sdk",
"command": "librewolf",
"rename-desktop-file": "LibreWolf.desktop",
"rename-appdata-file": "LibreWolf.appdata.xml",
"rename-icon": "io.gitlab.LibreWolf",
"modules": [
"flatpak/content/shared-modules/dbus-glib/dbus-glib-0.110.json",
{
@ -11,6 +14,10 @@
"buildsystem": "simple",
"build-commands": [
"mkdir -p /app/share && mv librewolf -t /app/share",
"mv share/appdata /app/share",
"mv share/applications /app/share",
"mv share/icons /app/share",
"mv share/metainfo /app/share",
"mkdir -p /app/bin && ln -s /app/share/librewolf/librewolf /app/bin/"
],
"sources": [
@ -23,20 +30,23 @@
],
"finish-args": [
"--share=ipc",
"--socket=x11",
"--socket=wayland",
"--socket=fallback-x11",
"--socket=pcsc",
"--socket=pulseaudio",
"--persist=.librewolf",
"--persist=.mozilla",
"--filesystem=xdg-download:rw",
"--device=all",
"--device=dri",
"--filesystem=~/.config/dconf:ro",
"--env=DCONF_USER_CONFIG_DIR=.config/dconf",
"--talk-name=org.freedesktop.FileManager1",
"--system-talk-name=org.freedesktop.NetworkManager",
"--talk-name=org.a11y.Bus",
"--talk-name=org.gnome.SessionManager",
"--talk-name=org.freedesktop.ScreenSaver",
"--talk-name=org.gtk.vfs.*",
"--socket=wayland",
"--socket=session-bus",
"--share=network"
]
}

View File

@ -1,12 +0,0 @@
[Desktop Entry]
Name=LibreWolf
Exec=librewolf %u
Icon=librewolf
Type=Application
MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;application/pdf;application/json;
StartupWMClass=LibreWolf
Categories=Network;WebBrowser;
StartupNotify=true
Terminal=false
X-MultipleArgs=false
Keywords=Internet;WWW;Browser;Web;Explorer