From b28c07e4023c744acda5985c080ba0ccbf9f0164 Mon Sep 17 00:00:00 2001 From: BeatLink Date: Sun, 21 Jul 2019 00:30:19 -0500 Subject: update all scripts --- browser/linux/appimage/build_appimage.sh | 26 +++++----- .../binary_tarball/content/launch_librewolf.sh | 2 + .../scripts/1_Install_Dependencies.sh | 16 +++--- .../scripts/2_Download_Source_Code.sh | 10 ++-- .../scripts/3_Configure_Source_Code.sh | 20 ++++---- .../scripts/4_Build_Binary_Tarball.sh | 20 +++++--- .../scripts/5_Configure_Binary_Tarball.sh | 21 ++++---- browser/linux/build.sh | 34 ++++++++----- browser/linux/flatpak/build_flatpak.sh | 57 +++++++++++++--------- 9 files changed, 114 insertions(+), 92 deletions(-) (limited to 'browser/linux') diff --git a/browser/linux/appimage/build_appimage.sh b/browser/linux/appimage/build_appimage.sh index 57c1594..43330bc 100755 --- a/browser/linux/appimage/build_appimage.sh +++ b/browser/linux/appimage/build_appimage.sh @@ -1,25 +1,23 @@ #!/bin/sh +printf "\n\n------------------------------------ APPIMAGE BUILD -----------------------------------------\n"; +# Sets up script variables BINARY_TARBALL=$1 APPIMAGE_CONTENT_FOLDER=$2 APPIMAGE_FILE=$3 - -_LIBREWOLF_EXTRACTED_FOLDER=./librewolf; -_LIBREWOLF_FINAL_APPIMAGE=./LibreWolf*.AppImage; +_BINARY_TARBALL_EXTRACTED_FOLDER=./librewolf; +_BUILD_APPIMAGE_FILE=./LibreWolf*.AppImage; _APPIMAGETOOL_DOWNLOAD_URL=https://github.com/AppImage/AppImageKit/releases/latest/download/appimagetool-x86_64.AppImage; +_APPIMAGETOOL_EXTRACTED_FOLDER=./squashfs-root; _APPIMAGETOOL_FILE=./appimagetool; -printf "\n\n------------------------------------ APPIMAGE BUILD -----------------------------------------\n"; - -printf "APPIMAGE_RESOURCE_FOLDER: $APPIMAGE_CONTENT_FOLDER\n"; - # Extracts the binary tarball printf "\nExtracting librewolf binary tarball\n"; -tar -xvf ./$BINARY_TARBALL; +tar -xvf $BINARY_TARBALL; # Copy appimage resources to main tarball printf "Copying AppImage resources to binary tarball folder\n"; -cp -vrT $APPIMAGE_CONTENT_FOLDER $_LIBREWOLF_EXTRACTED_FOLDER; +cp -vrT $APPIMAGE_CONTENT_FOLDER $_BINARY_TARBALL_EXTRACTED_FOLDER; # Downloads appimage tool printf "\nDownloading AppImage Tool\n"; @@ -30,13 +28,13 @@ rm -f $_APPIMAGETOOL_FILE; # Generate AppImage printf "\nGenerating AppImage\n"; -./squashfs-root/AppRun $_LIBREWOLF_EXTRACTED_FOLDER; -rm -rf $_LIBREWOLF_EXTRACTED_FOLDER; -rm -rf ./squashfs-root; -chmod +x $_LIBREWOLF_FINAL_APPIMAGE; +$_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 build_output folder\n"; -mv $_LIBREWOLF_FINAL_APPIMAGE $APPIMAGE_FILE; +mv $_BUILD_APPIMAGE_FILE $APPIMAGE_FILE; diff --git a/browser/linux/binary_tarball/content/launch_librewolf.sh b/browser/linux/binary_tarball/content/launch_librewolf.sh index f8b099d..26c1bd5 100755 --- a/browser/linux/binary_tarball/content/launch_librewolf.sh +++ b/browser/linux/binary_tarball/content/launch_librewolf.sh @@ -14,6 +14,8 @@ if [ "$1" = "--install-settings" ]; then 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; diff --git a/browser/linux/binary_tarball/scripts/1_Install_Dependencies.sh b/browser/linux/binary_tarball/scripts/1_Install_Dependencies.sh index 0230e0d..c241e6b 100755 --- a/browser/linux/binary_tarball/scripts/1_Install_Dependencies.sh +++ b/browser/linux/binary_tarball/scripts/1_Install_Dependencies.sh @@ -1,12 +1,10 @@ #!/bin/sh - printf "\n\n-------------------------------------- DEPENDENCY INSTALLATION ---------------------------------------------\n"; -printf "\nInstalling dependencies\n"; -apt-get update -qq && apt-get install -qqy mercurial wget; #python python3 wget; -# wget https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py; -# python ./bootstrap.py --application-choice=browser --no-interactive || true -# rm -f ./bootstrap.py; -# adds the new rust install to PATH -# printf "\nAdding new rust install to PATH\n"; -#. $HOME/.cargo/env; +# Setup Script Variables +_DEPENDENCIES="mercurial wget"; + +# Installs Dependencies +printf "\nInstalling dependencies\n"; +apt-get -qq update; +apt-get -qqy install $_DEPENDENCIES; diff --git a/browser/linux/binary_tarball/scripts/2_Download_Source_Code.sh b/browser/linux/binary_tarball/scripts/2_Download_Source_Code.sh index c973038..ac022a1 100755 --- a/browser/linux/binary_tarball/scripts/2_Download_Source_Code.sh +++ b/browser/linux/binary_tarball/scripts/2_Download_Source_Code.sh @@ -1,9 +1,11 @@ #!/bin/sh +printf "\n\n--------------------------------- SOURCE CODE DOWNLOAD --------------------------------------\n"; -COMPILE_FOLDER=$1 +# Setup Script Variables +SOURCE_FOLDER=$1; +_SOURCE_CODE_URL="https://hg.mozilla.org/releases/mozilla-release"; -printf "\n\n--------------------------------- SOURCE CODE DOWNLOAD --------------------------------------\n"; -# Clones the firefox source code for compiling +# Clone Firefox Source Code printf "\nCloning Firefox Source Code\n"; -hg clone https://hg.mozilla.org/releases/mozilla-release $COMPILE_FOLDER; +hg clone $_SOURCE_CODE_URL $SOURCE_FOLDER; diff --git a/browser/linux/binary_tarball/scripts/3_Configure_Source_Code.sh b/browser/linux/binary_tarball/scripts/3_Configure_Source_Code.sh index e4e3a9a..9adc430 100755 --- a/browser/linux/binary_tarball/scripts/3_Configure_Source_Code.sh +++ b/browser/linux/binary_tarball/scripts/3_Configure_Source_Code.sh @@ -1,15 +1,17 @@ #!/bin/sh - -SOURCE_CODE_FOLDER=$1 -FOLDER_TO_ADD=$2 - printf "\n\n------------------------------ FINAL PREBUILD CONFIGURATION ---------------------------------\n"; -# Copies our custom source code changes (mostly branding) to the source code -printf "\nCopying custom files to firefox source code\n"; -cp -r $FOLDER_TO_ADD/* $SOURCE_CODE_FOLDER/; +# 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 +# Disables Pocket printf "\nDisabling Pocket\n"; -sed -i "s/'pocket'/#'pocket'/g" $SOURCE_CODE_FOLDER/browser/components/moz.build; +sed -i $_POCKET_SED_STRING $_POCKET_FILE; diff --git a/browser/linux/binary_tarball/scripts/4_Build_Binary_Tarball.sh b/browser/linux/binary_tarball/scripts/4_Build_Binary_Tarball.sh index 8faac49..5f3ebe5 100755 --- a/browser/linux/binary_tarball/scripts/4_Build_Binary_Tarball.sh +++ b/browser/linux/binary_tarball/scripts/4_Build_Binary_Tarball.sh @@ -1,30 +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; -printf "SHELL=$SHELL\n"; -printf "\n\n--------------------------------------- BUILD -----------------------------------------------\n"; -cd $SOURCE_FOLDER +# Changes current folder to the source code folder +cd $SOURCE_FOLDER; -# Installs build dependencies (using the ./mach script inside the source code) +# 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; -cd $SOURCE_FOLDER; - +# 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 ./obj*/dist/librewolf*.tar.bz2 $OUTPUT_TARBALL; +mv $_SOURCE_CODE_BINARY_TARBALL_LOCATION $OUTPUT_TARBALL; -printf "\nDeleting the compile_folder\n"; +# Deletes the source code +printf "\nDeleting source code\n"; rm -rf $SOURCE_FOLDER; diff --git a/browser/linux/binary_tarball/scripts/5_Configure_Binary_Tarball.sh b/browser/linux/binary_tarball/scripts/5_Configure_Binary_Tarball.sh index f859f11..c7dd3b7 100755 --- a/browser/linux/binary_tarball/scripts/5_Configure_Binary_Tarball.sh +++ b/browser/linux/binary_tarball/scripts/5_Configure_Binary_Tarball.sh @@ -1,24 +1,23 @@ #!/bin/sh - -BINARY_TARBALL=$1 -SETTINGS_FOLDER_TO_ADD=$2 -LAUNCHER_SCRIPT=$3 - 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; +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_TO_ADD ./librewolf/settings; -cp $LAUNCHER_SCRIPT ./librewolf/launch_librewolf.sh; -mkdir -p ./librewolf/defaults/pref/; -mkdir -p ./librewolf/distribution/; +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 librewolf; +tar -jcvf $BINARY_TARBALL $_EXTRACTED_TARBALL_FOLDER; diff --git a/browser/linux/build.sh b/browser/linux/build.sh index b44a321..e7ea79d 100755 --- a/browser/linux/build.sh +++ b/browser/linux/build.sh @@ -4,20 +4,28 @@ printf "\n------------------------------------- SCRIPT SETUP ------------------- # Aborts the script upon any faliure set -e; -# Sets up internal script variables -printf "\nSetting up script variables\n"; -SCRIPT_FOLDER=$(realpath $(dirname $0)) && printf "SCRIPT_FOLDER: $SCRIPT_FOLDER\n"; -REPOSITORY_FOLDER=$(realpath $SCRIPT_FOLDER/../../) && printf "REPOSITORY_FOLDER: $REPOSITORY_FOLDER\n"; -SOURCE_FOLDER=$SCRIPT_FOLDER/compile && printf "SOURCE_FOLDER: $SOURCE_FOLDER\n"; -SOURCE_CONTENT_FOLDER=$REPOSITORY_FOLDER/browser/common/source_files/ && printf "SOURCE_CONTENT_FOLDER: $SOURCE_CONTENT_FOLDER\n"; -BINARY_TARBALL=$REPOSITORY_FOLDER/LibreWolf.tar.bz2 && printf "BINARY_TARBALL: $BINARY_TARBALL\n"; -APPIMAGE_FILE=$REPOSITORY_FOLDER/LibreWolf.AppImage +# Sets up script variables +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; +BINARY_TARBALL=$REPOSITORY_FOLDER/LibreWolf.tar.bz2; +APPIMAGE_CONTENT=$SCRIPT_FOLDER/appimage/content; +APPIMAGE_FILE=$REPOSITORY_FOLDER/LibreWolf.AppImage; +FLATPAK_JSON_FILE=$SCRIPT_FOLDER/flatpak/content/io.gitlab.LibreWolf.json; +FLATPAK_REPO=$REPOSITORY_FOLDER/librewolf-flatpak-repo; +FLATPAK_BUNDLE=$REPOSITORY_FOLDER/LibreWolf.flatpak; +# Executes the build $SCRIPT_FOLDER/binary_tarball/scripts/1_Install_Dependencies.sh; -$SCRIPT_FOLDER/binary_tarball/scripts/2_Download_Source_Code.sh $SOURCE_FOLDER; -$SCRIPT_FOLDER/binary_tarball/scripts/3_Configure_Source_Code.sh $SOURCE_FOLDER $SOURCE_CONTENT_FOLDER; -$SCRIPT_FOLDER/binary_tarball/scripts/4_Build_Binary_Tarball.sh $SOURCE_FOLDER $BINARY_TARBALL; -$SCRIPT_FOLDER/binary_tarball/scripts/5_Configure_Binary_Tarball.sh $BINARY_TARBALL $REPOSITORY_FOLDER/settings $SCRIPT_FOLDER/binary_tarball/content/launch_librewolf.sh; +$SCRIPT_FOLDER/binary_tarball/scripts/2_Download_Source_Code.sh $BINARY_TARBALL_SOURCE_FOLDER; +$SCRIPT_FOLDER/binary_tarball/scripts/3_Configure_Source_Code.sh $BINARY_TARBALL_SOURCE_FOLDER $BINARY_TARBALL_SOURCE_CONTENT_FOLDER; +$SCRIPT_FOLDER/binary_tarball/scripts/4_Build_Binary_Tarball.sh $BINARY_TARBALL_SOURCE_FOLDER $BINARY_TARBALL; +$SCRIPT_FOLDER/binary_tarball/scripts/5_Configure_Binary_Tarball.sh $BINARY_TARBALL $BINARY_TARBALL_SETTINGS_FOLDER $BINARY_TARBALL_LAUNCH_SCRIPT; +$SCRIPT_FOLDER/appimage/build_appimage.sh $BINARY_TARBALL $APPIMAGE_CONTENT $APPIMAGE_FILE; +$SCRIPT_FOLDER/flatpak/build_flatpak.sh $BINARY_TARBALL $FLATPAK_JSON_FILE $FLATPAK_REPO $FLATPAK_BUNDLE; -$SCRIPT_FOLDER/appimage/build_appimage.sh $BINARY_TARBALL $SCRIPT_FOLDER/appimage/content $APPIMAGE_FILE; + diff --git a/browser/linux/flatpak/build_flatpak.sh b/browser/linux/flatpak/build_flatpak.sh index c2f487d..db8168e 100755 --- a/browser/linux/flatpak/build_flatpak.sh +++ b/browser/linux/flatpak/build_flatpak.sh @@ -1,44 +1,53 @@ - +#!/bin/sh printf "\n\n---------------------------------------- FLATPAK BUILD --------------------------------------------\n"; -# Install flatpak -# Installs some needed dependencies -printf "\nInstalling script dependencies\n"; -apt update; -apt install -y gnupg2; +# Setup Script Variables +BINARY_TARBALL=$1; +FLATPAK_JSON_FILE=$2; +FLATPAK_REPO=$3; +FLATPAK_BUNDLE=$4; +_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_BUILD_SOURCE_FOLDER=./source; +_FLATPAK_BUILD_FOLDER=build-dir; + -echo 'deb http://ppa.launchpad.net/alexlarsson/flatpak/ubuntu bionic main' >> /etc/apt/source.list; -apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FA577F07; +# Install flatpak +printf "\nInstalling flatpak\n"; +echo $_APT_REPO >> $_APT_SOURCE_LIST; +apt update && apt install -y gnupg2 && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $_APT_REPO_KEY; apt update; -apt install -y flatpak flatpak-builder; +apt install -y $_APT_PACKAGES_TO_INSTALL; # Install build dependencies printf "\nInstalling flatpak build dependencies\n"; -flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo; -flatpak install -y org.gnome.Platform/x86_64/3.32 org.gnome.Sdk/x86_64/3.32; +flatpak remote-add --if-not-exists $_FLATHUB_REPO; +flatpak install -y $_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 "source"; -cp -r ./librewolf ./source/librewolf; -cp $SCRIPT_FOLDER/resources/flatpak/io.gitlab.LibreWolf.json ./io.gitlab.LibreWolf.json; +mkdir $_FLATPAK_BUILD_SOURCE_FOLDER && mv -r $_EXTRACTED_BINARY_TARBALL_FOLDER $_FLATPAK_BUILD_SOURCE_FOLDER/librewolf; # Build Repo and standalone bundle printf "\nBuilding flatpak repository and bundle\n"; -flatpak-builder --repo=librewolf-flatpak-repo build-dir io.gitlab.LibreWolf.json; -flatpak build-bundle librewolf-flatpak-repo LibreWolf.flatpak io.gitlab.LibreWolf 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; +flatpak-builder --repo=$FLATPAK_REPO $_FLATPAK_BUILD_FOLDER $FLATPAK_JSON_FILE; +flatpak build-bundle $FLATPAK_REPO $FLATPAK_BUNDLE io.gitlab.LibreWolf master; # Clean up flatpak files printf "\nCleaning up flatpak related files\n"; -rm -rf ./build-dir; -rm -rf ./source; +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 ./librewolf; +rm -rf $_EXTRACTED_BINARY_TARBALL_FOLDER; -- cgit