aboutsummaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
Diffstat (limited to 'linux')
-rw-r--r--linux/README.md14
-rwxr-xr-xlinux/appimage/build_appimage.sh44
l---------linux/appimage/content/.DirIcon1
-rwxr-xr-xlinux/appimage/content/AppRun12
-rw-r--r--linux/appimage/content/librewolf.desktop6
-rw-r--r--linux/appimage/content/librewolf.svg90
-rwxr-xr-xlinux/binary_tarball/build_tarball.sh22
-rwxr-xr-xlinux/binary_tarball/content/launch_librewolf.sh32
-rwxr-xr-xlinux/binary_tarball/scripts/1_Install_Dependencies.sh10
-rwxr-xr-xlinux/binary_tarball/scripts/2_Download_Source_Code.sh11
-rwxr-xr-xlinux/binary_tarball/scripts/3_Configure_Source_Code.sh17
-rwxr-xr-xlinux/binary_tarball/scripts/4_Build_Binary_Tarball.sh34
-rwxr-xr-xlinux/binary_tarball/scripts/5_Configure_Binary_Tarball.sh23
-rw-r--r--linux/binary_tarball/toggle-settings.sh21
-rwxr-xr-xlinux/build.sh20
-rwxr-xr-xlinux/flatpak/build_flatpak.sh61
-rw-r--r--linux/flatpak/content/io.gitlab.LibreWolf.json25
17 files changed, 443 insertions, 0 deletions
diff --git a/linux/README.md b/linux/README.md
new file mode 100644
index 0000000..f09f6af
--- /dev/null
+++ b/linux/README.md
@@ -0,0 +1,14 @@
+This folder contains all the required material to build the browser on Linux platforms.
+
+### Requirements
+* Ubuntu or Linux Mint (Bionic or later)
+
+### Notes
+* As this script installs files during the build, it is recommended to run this script in a VM or installation dedicated to building.
+* You will occassionally need to enter your sudo password. Running this script as root has not been tested
+* This script has been tested with Linux Mint 19.1
+* The flatpak build is not ready yet.
+
+### Instructions
+* Run build.sh inside this folder.
+* Packages will be saved in the repository root folder.
diff --git a/linux/appimage/build_appimage.sh b/linux/appimage/build_appimage.sh
new file mode 100755
index 0000000..c3e53d0
--- /dev/null
+++ b/linux/appimage/build_appimage.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+printf "\n\n------------------------------------ APPIMAGE BUILD -----------------------------------------\n";
+
+# Aborts the script upon any faliure
+set -e;
+
+# Sets up script variables
+BINARY_TARBALL=$1
+APPIMAGE_FILE=$2
+_SCRIPT_FOLDER=$(realpath $(dirname $0));
+_BINARY_TARBALL_EXTRACTED_FOLDER=$_SCRIPT_FOLDER/librewolf;
+_BUILD_APPIMAGE_FILE=$_SCRIPT_FOLDER/LibreWolf*.AppImage;
+_APPIMAGETOOL_DOWNLOAD_URL=https://github.com/AppImage/AppImageKit/releases/latest/download/appimagetool-x86_64.AppImage;
+_APPIMAGETOOL_EXTRACTED_FOLDER=$_SCRIPT_FOLDER/squashfs-root;
+_APPIMAGETOOL_FILE=$_SCRIPT_FOLDER/appimagetool;
+_APPIMAGE_CONTENT_FOLDER=$_SCRIPT_FOLDER/content
+
+# Extracts the binary tarball
+printf "\nExtracting librewolf binary tarball\n";
+mkdir $_BINARY_TARBALL_EXTRACTED_FOLDER;
+tar -xvf $BINARY_TARBALL -C $_BINARY_TARBALL_EXTRACTED_FOLDER;
+
+# Copy appimage resources to main tarball
+printf "Copying AppImage resources to binary tarball folder\n";
+cp -vrT $_APPIMAGE_CONTENT_FOLDER $_BINARY_TARBALL_EXTRACTED_FOLDER;
+
+# Downloads appimage tool
+printf "\nDownloading AppImage Tool\n";
+apt -qq update && apt -qqy install wget;
+wget $_APPIMAGETOOL_DOWNLOAD_URL -O $_APPIMAGETOOL_FILE;
+chmod +x $_APPIMAGETOOL_FILE;
+$_APPIMAGETOOL_FILE --appimage-mount $_APPIMAGETOOL_EXTRACTED_FOLDER;
+rm -f $_APPIMAGETOOL_FILE;
+
+# Generate AppImage
+printf "\nGenerating AppImage\n";
+ARCH=x86_64 $_APPIMAGETOOL_EXTRACTED_FOLDER/AppRun $_BINARY_TARBALL_EXTRACTED_FOLDER;
+rm -rf $_BINARY_TARBALL_EXTRACTED_FOLDER;
+rm -rf $_APPIMAGETOOL_EXTRACTED_FOLDER;
+chmod +x $_BUILD_APPIMAGE_FILE;
+
+# Move AppImage to specified location
+printf "\nMoving AppImage to specified location\n";
+mv $_BUILD_APPIMAGE_FILE $APPIMAGE_FILE;
diff --git a/linux/appimage/content/.DirIcon b/linux/appimage/content/.DirIcon
new file mode 120000
index 0000000..2653ffb
--- /dev/null
+++ b/linux/appimage/content/.DirIcon
@@ -0,0 +1 @@
+librewolf.svg \ No newline at end of file
diff --git a/linux/appimage/content/AppRun b/linux/appimage/content/AppRun
new file mode 100755
index 0000000..e347dcd
--- /dev/null
+++ b/linux/appimage/content/AppRun
@@ -0,0 +1,12 @@
+#!/bin/sh
+SELF=$(readlink -f "$0")
+HERE=${SELF%/*}
+export PATH="${HERE}:${HERE}/usr/bin/:${HERE}/usr/sbin/:${HERE}/usr/games/:${HERE}/bin/:${HERE}/sbin/${PATH:+:$PATH}"
+export LD_LIBRARY_PATH="${HERE}/usr/lib/:${HERE}/usr/lib/i386-linux-gnu/:${HERE}/usr/lib/x86_64-linux-gnu/:${HERE}/usr/lib32/:${HERE}/usr/lib64/:${HERE}/lib/:${HERE}/lib/i386-linux-gnu/:${HERE}/lib/x86_64-linux-gnu/:${HERE}/lib32/:${HERE}/lib64/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
+export PYTHONPATH="${HERE}/usr/share/pyshared/${PYTHONPATH:+:$PYTHONPATH}"
+export XDG_DATA_DIRS="${HERE}/usr/share/${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"
+export PERLLIB="${HERE}/usr/share/perl5/:${HERE}/usr/lib/perl5/${PERLLIB:+:$PERLLIB}"
+export GSETTINGS_SCHEMA_DIR="${HERE}/usr/share/glib-2.0/schemas/${GSETTINGS_SCHEMA_DIR:+:$GSETTINGS_SCHEMA_DIR}"
+export QT_PLUGIN_PATH="${HERE}/usr/lib/qt4/plugins/:${HERE}/usr/lib/i386-linux-gnu/qt4/plugins/:${HERE}/usr/lib/x86_64-linux-gnu/qt4/plugins/:${HERE}/usr/lib32/qt4/plugins/:${HERE}/usr/lib64/qt4/plugins/:${HERE}/usr/lib/qt5/plugins/:${HERE}/usr/lib/i386-linux-gnu/qt5/plugins/:${HERE}/usr/lib/x86_64-linux-gnu/qt5/plugins/:${HERE}/usr/lib32/qt5/plugins/:${HERE}/usr/lib64/qt5/plugins/${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}"
+EXEC=$(grep -e '^Exec=.*' "${HERE}"/*.desktop | head -n 1 | cut -d "=" -f 2 | cut -d " " -f 1)
+exec "${EXEC}" "$@"
diff --git a/linux/appimage/content/librewolf.desktop b/linux/appimage/content/librewolf.desktop
new file mode 100644
index 0000000..3e36765
--- /dev/null
+++ b/linux/appimage/content/librewolf.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Name=LibreWolf
+Exec=librewolf
+Icon=librewolf
+Type=Application
+Categories=Network;
diff --git a/linux/appimage/content/librewolf.svg b/linux/appimage/content/librewolf.svg
new file mode 100644
index 0000000..2c6262a
--- /dev/null
+++ b/linux/appimage/content/librewolf.svg
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="67.733337mm"
+ height="67.733337mm"
+ viewBox="0 0 67.733337 67.733337"
+ version="1.1"
+ id="svg8"
+ inkscape:version="0.92.4 5da689c313, 2019-01-14"
+ sodipodi:docname="LibreWolf.svg">
+ <defs
+ id="defs2" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.9899495"
+ inkscape:cx="-15.106575"
+ inkscape:cy="110.91343"
+ inkscape:document-units="mm"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1366"
+ inkscape:window-height="711"
+ inkscape:window-x="0"
+ inkscape:window-y="30"
+ inkscape:window-maximized="1"
+ inkscape:showpageshadow="false"
+ units="px"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0" />
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(-42.106554,-153.8982)">
+ <circle
+ style="fill:#00acff;fill-opacity:1;stroke:none;stroke-width:0.53545821;stroke-miterlimit:4;stroke-dasharray:none"
+ id="path875"
+ cx="75.973221"
+ cy="187.76486"
+ r="33.866669" />
+ <path
+ style="fill:#ffffff;stroke-width:0.13229167"
+ d="m 72.543594,214.67719 c -4.744093,-0.60875 -9.281981,-2.49991 -13.241953,-5.51858 -1.29157,-0.98455 -3.714943,-3.42363 -4.772834,-4.80375 -2.96241,-3.86476 -4.804479,-8.2508 -5.41218,-12.88661 -0.260164,-1.98464 -0.258719,-5.63349 0.0029,-7.44738 1.308078,-9.0677 7.01463,-16.8454 15.20915,-20.72918 3.811512,-1.80647 7.300266,-2.57114 11.730683,-2.57114 7.165903,0 13.5265,2.56749 18.680882,7.54063 2.483054,2.39575 4.148141,4.66808 5.573968,7.60677 1.92868,3.9751 2.70979,7.43276 2.70979,11.99526 0,6.00619 -1.7345,11.24407 -5.336957,16.11672 -1.070527,1.44797 -3.161747,3.64749 -4.549468,4.78507 -3.806562,3.12041 -8.658642,5.23183 -13.473174,5.86296 -1.663528,0.21807 -5.593318,0.24524 -7.120854,0.0492 z m 10.041381,-4.86547 c 2.898391,-0.91366 5.260364,-2.14146 7.540624,-3.91979 1.212494,-0.9456 3.308223,-3.06144 4.186916,-4.22711 2.38328,-3.16162 4.004927,-7.12196 4.482067,-10.94597 0.229814,-1.84182 0.09634,-5.73827 -0.2545,-7.4296 -0.9294,-4.48046 -2.931647,-8.26499 -6.086007,-11.50342 -1.966575,-2.01898 -3.756882,-3.34972 -6.060203,-4.50458 -3.495001,-1.75236 -6.489835,-2.46043 -10.423481,-2.46442 -4.164073,-0.004 -7.815325,0.95024 -11.429055,2.98766 -3.289753,1.85476 -6.690628,5.25952 -8.553227,8.563 -1.371786,2.43299 -2.37583,5.32029 -2.767595,7.95869 -0.256867,1.72991 -0.261933,5.16508 -0.01006,6.82145 0.504067,3.31489 1.761474,6.59111 3.584314,9.33904 0.995409,1.50058 0.964154,1.48393 1.842248,0.98153 1.570774,-0.8987 1.980396,-1.33342 2.836087,-3.00984 1.000624,-1.96036 2.070459,-3.6735 3.037094,-4.86332 1.115822,-1.37347 1.269228,-1.61793 1.828988,-2.9147 0.281654,-0.65249 0.786977,-1.61074 1.122938,-2.12943 l 0.61084,-0.94309 -0.79023,-0.77671 c -1.049647,-1.03168 -1.922751,-2.2016 -2.087012,-2.79651 -0.167761,-0.60758 0.03021,-0.9466 0.818744,-1.40207 0.797354,-0.46057 1.367585,-0.5929 3.498657,-0.81193 1.037629,-0.10665 2.164153,-0.30199 2.518962,-0.43681 0.353024,-0.13414 1.407825,-0.70824 2.344001,-1.27579 2.702947,-1.63863 2.931619,-1.72344 4.552111,-1.68831 1.368686,0.0297 1.371262,0.0291 2.182813,-0.46143 1.700674,-1.02802 4.14305,-2.88289 7.357044,-5.58733 0.61632,-0.5186 1.21002,-0.92569 1.31934,-0.90464 0.45462,0.0876 1.289567,2.13636 1.416407,3.47562 0.07693,0.81225 -0.08023,1.6155 -0.562014,2.87261 -0.13146,0.34301 -0.19208,0.67043 -0.134706,0.7276 0.13774,0.13726 0.610706,-0.4535 0.610706,-0.76279 0,-0.39435 0.261127,-0.43936 0.616327,-0.10623 0.258235,0.24218 0.480842,0.31151 1.000202,0.31151 0.567073,0 0.707447,0.0526 0.928773,0.3479 0.375574,0.50112 0.463647,1.86688 0.176201,2.73231 -0.279641,0.84191 -1.124801,1.81287 -1.891829,2.17341 -0.686334,0.32262 -2.075841,1.67928 -2.726081,2.66164 -0.248906,0.37604 -0.715586,1.15995 -1.037066,1.74204 -0.321487,0.58208 -0.86074,1.46154 -1.19834,1.95436 -0.664294,0.96972 -1.233147,2.3224 -1.782214,4.23798 -0.322553,1.1253 -0.34962,1.41826 -0.362953,3.92797 -0.01613,3.0317 -0.172894,3.77561 -0.9925,4.7091 -0.931805,1.06126 -1.861937,3.39186 -1.940127,4.8613 -0.04935,0.92751 -0.192246,1.83164 -0.395304,2.50122 -0.08942,0.29484 0.07752,0.2914 1.072102,-0.0221 z"
+ id="path847"
+ inkscape:connector-curvature="0" />
+ <path
+ sodipodi:type="star"
+ style="fill:#00acff;fill-opacity:1;stroke:none;stroke-width:1.5;stroke-miterlimit:4;stroke-dasharray:none"
+ id="path814"
+ sodipodi:sides="4"
+ sodipodi:cx="18.854025"
+ sodipodi:cy="172.98837"
+ sodipodi:r1="1.6036172"
+ sodipodi:r2="1.1339285"
+ sodipodi:arg1="1.5707963"
+ sodipodi:arg2="2.3561945"
+ inkscape:flatsided="true"
+ inkscape:rounded="0"
+ inkscape:randomized="0"
+ d="m 18.854025,174.59199 -1.603617,-1.60362 1.603617,-1.60361 1.603617,1.60361 z"
+ transform="matrix(0.23203125,0.40188991,-0.99392962,0.57384553,246.21921,73.888081)" />
+ </g>
+</svg>
diff --git a/linux/binary_tarball/build_tarball.sh b/linux/binary_tarball/build_tarball.sh
new file mode 100755
index 0000000..83da436
--- /dev/null
+++ b/linux/binary_tarball/build_tarball.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+printf "\n------------------------------------- BINARY TARBALL BUILD ------------------------------------------\n";
+
+# Aborts the script upon any faliure
+set -e;
+
+# Sets up script variables
+BINARY_TARBALL=$1;
+_SCRIPT_FOLDER=$(realpath $(dirname $0));
+_REPOSITORY_FOLDER=$(realpath $_SCRIPT_FOLDER/../../../);
+_BINARY_TARBALL_SOURCE_FOLDER=$_SCRIPT_FOLDER/compile;
+_BINARY_TARBALL_SOURCE_CONTENT_FOLDER=$_REPOSITORY_FOLDER/browser/common/source_files/;
+_BINARY_TARBALL_SETTINGS_FOLDER=$_REPOSITORY_FOLDER/settings;
+_BINARY_TARBALL_LAUNCH_SCRIPT=$_SCRIPT_FOLDER/binary_tarball/content/launch_librewolf.sh;
+
+# Executes the build
+$_SCRIPT_FOLDER/scripts/1_Install_Dependencies.sh;
+$_SCRIPT_FOLDER/scripts/2_Download_Source_Code.sh $_BINARY_TARBALL_SOURCE_FOLDER;
+$_SCRIPT_FOLDER/scripts/3_Configure_Source_Code.sh $_BINARY_TARBALL_SOURCE_FOLDER $_BINARY_TARBALL_SOURCE_CONTENT_FOLDER;
+$_SCRIPT_FOLDER/scripts/4_Build_Binary_Tarball.sh $_BINARY_TARBALL_SOURCE_FOLDER $BINARY_TARBALL;
+$_SCRIPT_FOLDER/scripts/5_Configure_Binary_Tarball.sh $BINARY_TARBALL $_BINARY_TARBALL_SETTINGS_FOLDER $_BINARY_TARBALL_LAUNCH_SCRIPT;
+
diff --git a/linux/binary_tarball/content/launch_librewolf.sh b/linux/binary_tarball/content/launch_librewolf.sh
new file mode 100755
index 0000000..26c1bd5
--- /dev/null
+++ b/linux/binary_tarball/content/launch_librewolf.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+
+INSTALL_FOLDER=$(realpath $(dirname $0));
+INSTALL_SETTINGS_FOLDER=$INSTALL_FOLDER/settings;
+PROFILE_SETTINGS_FOLDER=$HOME/.librewolf/settings;
+
+# Adds option to install settings if argument is passed
+if [ "$1" = "--install-settings" ]; then
+ mkdir -p $PROFILE_SETTINGS_FOLDER;
+ cp $INSTALL_SETTINGS_FOLDER/defaults/pref/local-settings.js $PROFILE_SETTINGS_FOLDER/local-settings.js;
+ cp $INSTALL_SETTINGS_FOLDER/distribution/policies.json $PROFILE_SETTINGS_FOLDER/policies.json;
+ cp $INSTALL_SETTINGS_FOLDER/librewolf.cfg $PROFILE_SETTINGS_FOLDER/librewolf.cfg;
+ cp $INSTALL_SETTINGS_FOLDER/toggle-settings.sh $PROFILE_SETTINGS_FOLDER/toggle-settings.sh;
+fi
+
+# Sets up settings links
+mkdir -p $INSTALL_FOLDER/defaults/pref/;
+mkdir -p $INSTALL_FOLDER/distribution/;
+ln -s $PROFILE_SETTINGS_FOLDER/local-settings.js $INSTALL_FOLDER/defaults/pref/local-settings.js;
+ln -s $PROFILE_SETTINGS_FOLDER/policies.json $INSTALL_FOLDER/distribution/policies.json;
+ln -s $PROFILE_SETTINGS_FOLDER/librewolf.cfg $INSTALL_FOLDER/librewolf.cfg;
+
+# Sets env variables to disable dedicated profiles (which breaks some packaging methods)
+export MOZ_LEGACY_PROFILES=1;
+export SNAP_NAME="firefox";
+
+# Launches librewolf
+chmod +x $INSTALL_FOLDER/librewolf;
+$INSTALL_FOLDER/librewolf "$@";
+
+
+
diff --git a/linux/binary_tarball/scripts/1_Install_Dependencies.sh b/linux/binary_tarball/scripts/1_Install_Dependencies.sh
new file mode 100755
index 0000000..c241e6b
--- /dev/null
+++ b/linux/binary_tarball/scripts/1_Install_Dependencies.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+printf "\n\n-------------------------------------- DEPENDENCY INSTALLATION ---------------------------------------------\n";
+
+# Setup Script Variables
+_DEPENDENCIES="mercurial wget";
+
+# Installs Dependencies
+printf "\nInstalling dependencies\n";
+apt-get -qq update;
+apt-get -qqy install $_DEPENDENCIES;
diff --git a/linux/binary_tarball/scripts/2_Download_Source_Code.sh b/linux/binary_tarball/scripts/2_Download_Source_Code.sh
new file mode 100755
index 0000000..ac022a1
--- /dev/null
+++ b/linux/binary_tarball/scripts/2_Download_Source_Code.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+printf "\n\n--------------------------------- SOURCE CODE DOWNLOAD --------------------------------------\n";
+
+# Setup Script Variables
+SOURCE_FOLDER=$1;
+_SOURCE_CODE_URL="https://hg.mozilla.org/releases/mozilla-release";
+
+# Clone Firefox Source Code
+printf "\nCloning Firefox Source Code\n";
+hg clone $_SOURCE_CODE_URL $SOURCE_FOLDER;
+
diff --git a/linux/binary_tarball/scripts/3_Configure_Source_Code.sh b/linux/binary_tarball/scripts/3_Configure_Source_Code.sh
new file mode 100755
index 0000000..9adc430
--- /dev/null
+++ b/linux/binary_tarball/scripts/3_Configure_Source_Code.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+printf "\n\n------------------------------ FINAL PREBUILD CONFIGURATION ---------------------------------\n";
+
+# Setup Script Variables
+SOURCE_CODE_FOLDER=$1;
+SOURCE_CODE_CUSTOMIZATION_FOLDER=$2;
+_POCKET_SED_STRING="s/'pocket'/#'pocket'/g";
+_POCKET_FILE=$SOURCE_CODE_FOLDER/browser/components/moz.build;
+
+# Copy Source Code Changes to Source Code
+printf "\nCopying branding and source code changes to firefox source code\n";
+cp -r $SOURCE_CODE_CUSTOMIZATION_FOLDER/* $SOURCE_CODE_FOLDER/;
+
+# Disables Pocket
+printf "\nDisabling Pocket\n";
+sed -i $_POCKET_SED_STRING $_POCKET_FILE;
+
diff --git a/linux/binary_tarball/scripts/4_Build_Binary_Tarball.sh b/linux/binary_tarball/scripts/4_Build_Binary_Tarball.sh
new file mode 100755
index 0000000..5f3ebe5
--- /dev/null
+++ b/linux/binary_tarball/scripts/4_Build_Binary_Tarball.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+printf "\n\n--------------------------------------- BUILD -----------------------------------------------\n";
+
+# Setup Script Variables
+SOURCE_FOLDER=$1;
+OUTPUT_TARBALL=$2;
+_SOURCE_CODE_BINARY_TARBALL_LOCATION="./obj*/dist/librewolf*.tar.bz2";
+
+# Prevents build from breaking in CI/CD environments
+export SHELL=/bin/bash;
+
+# Changes current folder to the source code folder
+cd $SOURCE_FOLDER;
+
+# Runs bootstrapper to install dependencies
+printf "\nRunning bootstrapper to install build dependencies (using ./mach script within source code)\n";
+./mach bootstrap --application-choice=browser --no-interactive;
+
+# Executes the actual build
+printf "\nBuilding LibreWolf\n";
+./mach build;
+
+# Packages the build into a binary tarball
+printf "\nPackaging LibreWolf\n";
+./mach package;
+
+# Moves the packaged tarball to the specified location
+printf "\nMoving Binary Tarball to output location\n";
+mv $_SOURCE_CODE_BINARY_TARBALL_LOCATION $OUTPUT_TARBALL;
+
+# Deletes the source code
+printf "\nDeleting source code\n";
+rm -rf $SOURCE_FOLDER;
+
diff --git a/linux/binary_tarball/scripts/5_Configure_Binary_Tarball.sh b/linux/binary_tarball/scripts/5_Configure_Binary_Tarball.sh
new file mode 100755
index 0000000..293dc16
--- /dev/null
+++ b/linux/binary_tarball/scripts/5_Configure_Binary_Tarball.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+printf "\n\n--------------------------------- SETTINGS INTEGRATION --------------------------------------\n";
+
+# Setup Script Variables
+BINARY_TARBALL=$1;
+SETTINGS_FOLDER=$2;
+LAUNCHER_SCRIPT=$3;
+_EXTRACTED_TARBALL_FOLDER=./librewolf;
+
+# Extracts the binary tarball
+printf "\nExtracting librewolf binary tarball\n";
+tar -xvf $BINARY_TARBALL;
+
+# Adds the librefox config files to the packaged tarball
+printf "\nCopying librewolf settings to extracted binary tarball\n";
+cp -r $SETTINGS_FOLDER $_EXTRACTED_TARBALL_FOLDER/settings;
+cp $LAUNCHER_SCRIPT $_EXTRACTED_TARBALL_FOLDER/launch_librewolf.sh;
+
+# Repacks the binary tarball
+printf "\nRecompressing binary tarball\n";
+tar -jcvf $BINARY_TARBALL $_EXTRACTED_TARBALL_FOLDER;
+
+
diff --git a/linux/binary_tarball/toggle-settings.sh b/linux/binary_tarball/toggle-settings.sh
new file mode 100644
index 0000000..ff46bde
--- /dev/null
+++ b/linux/binary_tarball/toggle-settings.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+# Exit script with a non-zero exit code if:
+# - any command fails (-e | --errexit)
+# - any variable is unset (-u | --nounset)
+# - a part of a piped sequence fails (-o pipefail)
+set -euo pipefail
+
+SCRIPT_FOLDER=$(realpath $(dirname $0));
+
+# Enable settings ------------------------------------------------------------------------------------------
+if [[ "${1}" = "--enable" ]]; then
+ mv "${SCRIPT_FOLDER}/[DISABLED] local-settings.js" "${SCRIPT_FOLDER}/local-settings.js";
+ mv "${SCRIPT_FOLDER}/[DISABLED] policies.json" "${SCRIPT_FOLDER}/policies.json";
+ mv "${SCRIPT_FOLDER}/[DISABLED] librewolf.cfg" "${SCRIPT_FOLDER}/librewolf.cfg";
+# Disable settings ------------------------------------------------------------------------------------------
+elif [[ "${1}" = "--disable" ]]; then
+ mv "${SCRIPT_FOLDER}/local-settings.js" "${SCRIPT_FOLDER}/[DISABLED] local-settings.js";
+ mv "${SCRIPT_FOLDER}/policies.json" "${SCRIPT_FOLDER}/[DISABLED] policies.json";
+ mv "${SCRIPT_FOLDER}/librewolf.cfg" "${SCRIPT_FOLDER}/[DISABLED] librewolf.cfg";
+fi
diff --git a/linux/build.sh b/linux/build.sh
new file mode 100755
index 0000000..850e8ad
--- /dev/null
+++ b/linux/build.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+printf "\n------------------------------------- SCRIPT SETUP ------------------------------------------\n";
+
+# Aborts the script upon any faliure
+set -e;
+
+# Sets up script variables
+SCRIPT_FOLDER=$(realpath $(dirname $0));
+REPOSITORY_FOLDER=$(realpath $SCRIPT_FOLDER/../../);
+BINARY_TARBALL=$REPOSITORY_FOLDER/LibreWolf.tar.bz2;
+APPIMAGE_FILE=$REPOSITORY_FOLDER/LibreWolf.AppImage;
+FLATPAK_REPO=$REPOSITORY_FOLDER/librewolf-flatpak-repo;
+FLATPAK_BUNDLE=$REPOSITORY_FOLDER/LibreWolf.flatpak;
+
+$SCRIPT_FOLDER/binary_tarball/build_tarball.sh $BINARY_TARBALL;
+$SCRIPT_FOLDER/appimage/build_appimage.sh $BINARY_TARBALL $APPIMAGE_FILE;
+$SCRIPT_FOLDER/flatpak/build_flatpak.sh $BINARY_TARBALL $FLATPAK_REPO $FLATPAK_BUNDLE;
+
+
+
diff --git a/linux/flatpak/build_flatpak.sh b/linux/flatpak/build_flatpak.sh
new file mode 100755
index 0000000..bebf131
--- /dev/null
+++ b/linux/flatpak/build_flatpak.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+printf "\n\n---------------------------------------- FLATPAK BUILD --------------------------------------------\n";
+
+# Aborts the script upon any faliure
+set -e;
+
+# Setup Script Variables
+BINARY_TARBALL=$1;
+FLATPAK_REPO=$2;
+FLATPAK_BUNDLE=$3;
+_SCRIPT_FOLDER=$(realpath $(dirname $0));
+_APT_SOURCE_LIST=/etc/apt/source.list;
+_APT_REPO='deb http://ppa.launchpad.net/alexlarsson/flatpak/ubuntu bionic main'
+_APT_REPO_KEY=FA577F07;
+_APT_PACKAGES_TO_INSTALL="flatpak flatpak-builder";
+_FLATHUB_REPO="flathub https://flathub.org/repo/flathub.flatpakrepo";
+_FLATHUB_PACKAGES_TO_INSTALL="org.gnome.Platform/x86_64/3.32 org.gnome.Sdk/x86_64/3.32";
+_EXTRACTED_BINARY_TARBALL_FOLDER=./librewolf
+_FLATPAK_JSON_FILE=$_SCRIPT_FOLDER/content/io.gitlab.LibreWolf.json;
+_FLATPAK_BUILD_SOURCE_FOLDER=./source;
+_FLATPAK_BUILD_FOLDER=build-dir;
+
+
+# Install flatpak
+printf "\nInstalling flatpak\n";
+echo $_APT_REPO >> $_APT_SOURCE_LIST;
+apt-get -qq update && apt-get -qqy install gnupg2 && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $_APT_REPO_KEY;
+apt-get -qq update;
+apt-get -qqy install $_APT_PACKAGES_TO_INSTALL;
+
+# Install build dependencies
+printf "\nInstalling flatpak build dependencies\n";
+flatpak remote-add --if-not-exists $_FLATHUB_REPO;
+flatpak install -y flathub $_FLATHUB_PACKAGES_TO_INSTALL;
+
+# Extracts the binary tarball
+printf "\nExtracting librewolf binary tarball\n";
+tar -xvf $BINARY_TARBALL;
+
+# Prepare for flatpak build
+printf "\nPreparing files for flatpak build\n";
+mkdir $_FLATPAK_BUILD_SOURCE_FOLDER && mv $_EXTRACTED_BINARY_TARBALL_FOLDER $_FLATPAK_BUILD_SOURCE_FOLDER/librewolf;
+
+# Build Repo
+printf "\nBuilding flatpak repository\n";
+cp "$_FLATPAK_JSON_FILE" ./;
+flatpak-builder --repo="$FLATPAK_REPO" "$_FLATPAK_BUILD_FOLDER" io.gitlab.LibreWolf.json;
+
+# Build bundle
+printf "\nBuilding flatpak bundle\n";
+flatpak build-bundle $FLATPAK_REPO $FLATPAK_BUNDLE io.gitlab.LibreWolf master;
+
+# Clean up flatpak files
+printf "\nCleaning up flatpak related files\n";
+rm -rf $_FLATPAK_BUILD_FOLDER;
+rm -rf $_FLATPAK_BUILD_SOURCE_FOLDER;
+rm -rf ./.flatpak-builder;
+
+# Delete the extracted binary tarball folder
+printf "\nDeleting extracted binary tarball folder\n";
+rm -rf $_EXTRACTED_BINARY_TARBALL_FOLDER;
diff --git a/linux/flatpak/content/io.gitlab.LibreWolf.json b/linux/flatpak/content/io.gitlab.LibreWolf.json
new file mode 100644
index 0000000..0e2b549
--- /dev/null
+++ b/linux/flatpak/content/io.gitlab.LibreWolf.json
@@ -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: */
+ ]
+}
bgstack15