Implement Flatpak build

This commit is contained in:
BeatLink 2019-07-14 01:39:32 -05:00
parent 3bf4148aca
commit e04f1370d1
3 changed files with 63 additions and 36 deletions

View file

@ -17,6 +17,7 @@ BRANDING_FOLDER=$SOURCE_FOLDER/browser/branding/librewolf;
ICON_FOLDER=$REPOSITORY_FOLDER/branding/icon/;
PACKAGE_FILE="librewolf*.tar.bz2";
APPIMAGE_RESOURCE_FOLDER=$SCRIPT_FOLDER/resources/appimage;
FLATPAK_MANIFEST_FILE=$SCRIPT_FOLDER/resources/flatpak/io.gitlab.LibreWolf.json;
printf "SCRIPT_FOLDER: $SCRIPT_FOLDER\n";
printf "REPOSITORY_FOLDER: $REPOSITORY_FOLDER\n";
printf "SOURCE_FOLDER: $SOURCE_FOLDER\n";
@ -24,6 +25,7 @@ printf "BRANDING_FOLDER: $BRANDING_FOLDER\n";
printf "ICON_FOLDER: $ICON_FOLDER\n";
printf "PACKAGE_FILE: $PACKAGE_FILE\n";
printf "APPIMAGE_RESOURCE_FOLDER: $APPIMAGE_RESOURCE_FOLDER\n";
printf "FLATPAK_MANIFEST_FILE: $FLATPAK_MANIFEST_FILE\n";
printf "\n\n-------------------------------------- PREBUILD ---------------------------------------------\n";
@ -122,6 +124,8 @@ tar -xvf ./$PACKAGE_FILE;
printf "\nCopying librewolf settings to extracted binary tarball\n";
cp -r $REPOSITORY_FOLDER/settings ./librewolf/settings;
printf "\n\n--------------------------------- BINARY TARBALL RECREATION --------------------------------------\n";
# Repacks the binary tarball
printf "\nRecompressing binary tarball\n";
tar -jcvf ./$PACKAGE_FILE librewolf;
@ -161,10 +165,40 @@ printf "\nRemoving AppImage tool\n";
rm -f ./appimagetool;
rm -rf ./squashfs-root;
printf "\n\n---------------------------------------- FLATPAK BUILD --------------------------------------------\n";
# Install flatpak
printf "\nInstalling Flatpak Builder\n";
sudo add-apt-repository -y ppa:alexlarsson/flatpak;
sudo apt update;
sudo apt install -y flatpak flatpak-builder;
# Install build dependencies
printf "\nInstalling flatpak build dependencies\n";
flatpak install -y org.gnome.Platform//3.32 org.gnome.Sdk//3.32;
# Prepare for flatpak build
printf "\nPreparing files for flatpak build\n";
mkdir "source";
cp -r ./librewolf ./source/librewolf;
# Build Repo and standalone bundle
printf "\nBuilding flatpak repository and bundle\n";
flatpak-builder --repo=librewolf-flatpak-repo build-dir $FLATPAK_MANIFEST_FILE;
flatpak build-bundle librewolf-flatpak-repo LibreWolf.flatpak $FLATPAK_MANIFEST_FILE master;
# move repo and bundle to build output here
printf "\nMoving repository and bundle to build output folder\n";
mv libreWolf-flatpak-repo build_output;
mv LibreWolf.flatpak build_output;
# Clean up flatpak files
printf "\nCleaning up flatpak related files\n";
rm -rf ./build-dir;
rm -rf ./source;
rm -rf ./.flatpak-builder;
# Delete the extracted binary tarball folder
printf "\nDeleting extracted binary tarball folder\n";
rm -rf ./librewolf;
#printf "\n\n---------------------------------------- FLATPAK BUILD --------------------------------------------\n";
#sudo apt install flatpak-builder;

View file

@ -0,0 +1,25 @@
{
"app-id": "io.gitlab.LibreWolf",
"runtime": "org.gnome.Platform",
"runtime-version": "3.32",
"sdk": "org.gnome.Sdk",
"command": "librewolf",
"modules": [{
"name": "librewolf",
"buildsystem": "simple",
"build-commands": [
"mkdir -p /app/share && mv librewolf -t /app/share",
"mkdir -p /app/bin && ln -s /app/share/librewolf/librewolf /app/bin/"
],
"sources": [{
"type": "dir",
"path": "source"
}]
}],
"finish-args": [
"--share=ipc", "--socket=x11", /* X11 + XShm access */
"--socket=wayland", /* Wayland access */
"--filesystem=home:rw", /* We want full fs access so we can read the files */
"--share=network" /* Needs to talk to the network: */
]
}

View file

@ -1,32 +0,0 @@
{
"app-id": "io.gitlab.LibreWolf",
"runtime": "org.gnome.Platform",
"runtime-version": "3.22",
"sdk": "org.gnome.Sdk",
"command": "librewolf",
"finish-args": [
/* X11 + XShm access */
"--share=ipc", "--socket=x11",
/* Wayland access */
"--socket=wayland",
/* We want full fs access so we can read the files */
"--filesystem=home:rw",
/* Needs to talk to the network: */
"--share=network"
],
"modules": [
{
"name": "librewolf",
"buildsystem": "simple",
"build-commands": [
"install -D hello.sh /app/bin/hello.sh"
],
"sources": [
{
"type": "file",
"path": "hello.sh"
}
]
}
]
}