2019-06-12 22:44:32 +02:00
|
|
|
#!/bin/bash
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "\n------------------------------------- SCRIPT SETUP ------------------------------------------\n";
|
2019-06-12 22:44:32 +02:00
|
|
|
|
|
|
|
# Prevents build from breaking in CI/CD environments
|
|
|
|
export SHELL=/bin/bash;
|
|
|
|
|
2019-06-16 08:57:29 +02:00
|
|
|
# Sets up internal script variables
|
|
|
|
printf "\nSetting up script variables\n";
|
|
|
|
SCRIPT_FOLDER=$(realpath $(dirname $0));
|
|
|
|
REPOSITORY_FOLDER=$(realpath $SCRIPT_FOLDER/../);
|
|
|
|
printf "SCRIPT_FOLDER: $SCRIPT_FOLDER\n";
|
|
|
|
printf "REPOSITORY_FOLDER: $REPOSITORY_FOLDER\n";
|
|
|
|
|
|
|
|
# Installs some needed dependencies
|
|
|
|
printf "\nInstalling script dependencies\n";
|
|
|
|
sudo apt update;
|
|
|
|
sudo apt install python python3 inkscape wget -y;
|
|
|
|
|
|
|
|
printf "\n\n------------------------------------ ICON GENERATION ----------------------------------------\n";
|
|
|
|
|
|
|
|
ICON_FILE=$REPOSITORY_FOLDER/branding/icon/icon.svg;
|
|
|
|
BRANDING_FOLDER=$SCRIPT_FOLDER/resources/source_files/browser/branding/librewolf;
|
|
|
|
printf "\nGenerating icons from $ICON_FILE and moving to $BRANDING_FOLDER\n";
|
|
|
|
|
|
|
|
# Linux Icons
|
|
|
|
inkscape -z -f $ICON_FILE -e $BRANDING_FOLDER/default16.png -w 16 -h16;
|
|
|
|
inkscape -z -f $ICON_FILE -e $BRANDING_FOLDER/default32.png -w 32 -h32;
|
|
|
|
inkscape -z -f $ICON_FILE -e $BRANDING_FOLDER/default48.png -w 48 -h48;
|
|
|
|
inkscape -z -f $ICON_FILE -e $BRANDING_FOLDER/default64.png -w 64 -h64;
|
|
|
|
inkscape -z -f $ICON_FILE -e $BRANDING_FOLDER/default128.png -w 128 -h128;
|
|
|
|
|
|
|
|
# Windows Icons
|
|
|
|
inkscape -z -f $ICON_FILE -e $BRANDING_FOLDER/VisualElements_70.png -w 70 -h70;
|
|
|
|
inkscape -z -f $ICON_FILE -e $BRANDING_FOLDER/VisualElements_150.png -w 150 -h150;
|
|
|
|
|
|
|
|
# TODO: Add Apple Icons
|
|
|
|
|
|
|
|
printf "\n\n--------------------------------------- PREBUILD --------------------------------------------\n";
|
|
|
|
|
|
|
|
# Downloads and runs bootstrapper to install dependencies.
|
|
|
|
printf "\nRunning bootstrapper to install build dependencies\n";
|
2019-06-12 22:44:32 +02:00
|
|
|
wget -nv -O - \
|
|
|
|
https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py \
|
|
|
|
| python - --application-choice=browser --no-interactive;
|
|
|
|
|
|
|
|
# adds the new rust install to PATH
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "\nAdding new rust install to PATH\n";
|
2019-06-12 22:44:32 +02:00
|
|
|
. $HOME/.cargo/env;
|
|
|
|
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "\n\n---------------------------------------- BUILD ----------------------------------------------\n";
|
2019-06-12 22:44:32 +02:00
|
|
|
|
|
|
|
# Creates and enters the folder where compiling will take place
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "\nCreating compile folder\n";
|
|
|
|
mkdir compile_folder;
|
|
|
|
cd compile_folder;
|
2019-06-12 22:44:32 +02:00
|
|
|
|
|
|
|
# Clones the firefox source code for compiling
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "\nCloning Firefox Source Code\n";
|
2019-06-12 22:44:32 +02:00
|
|
|
hg clone https://hg.mozilla.org/releases/mozilla-release;
|
|
|
|
|
2019-06-16 08:57:29 +02:00
|
|
|
# Copies our branding to the source code, changing it from firefox to librewolf
|
|
|
|
printf "\nCopying branding to firefox source code\n";
|
|
|
|
cp -r $SCRIPT_FOLDER/resources/source_files/* mozilla-release;
|
2019-06-12 22:44:32 +02:00
|
|
|
|
|
|
|
# Bootstraps, builds and packages librewolf
|
|
|
|
cd mozilla-release;
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "\nRunning bootstrapper to install build dependencies\n";
|
2019-06-12 22:44:32 +02:00
|
|
|
./mach bootstrap --application-choice=browser --no-interactive;
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "\nBuilding LibreWolf\n";
|
2019-06-12 22:44:32 +02:00
|
|
|
./mach build;
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "\nPackaging LibreWolf\n";
|
2019-06-12 22:44:32 +02:00
|
|
|
./mach package;
|
2019-06-16 08:57:29 +02:00
|
|
|
cd $SCRIPT_FOLDER;
|
2019-06-12 22:44:32 +02:00
|
|
|
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "\n\n-------------------------------------- POSTBUILD --------------------------------------------\n";
|
2019-06-12 22:44:32 +02:00
|
|
|
|
|
|
|
# moves the packaged tarball to the main folder
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "\nRelocating binary tarball to script folder\n"
|
|
|
|
cp ./compile_folder/mozilla-release/obj*/dist/librewolf*.tar.bz2 ./;
|
|
|
|
|
|
|
|
# Remove the compile folder
|
|
|
|
printf "\nDeleting the compile_folder\n";
|
|
|
|
rm -rf ./compile_folder;
|
|
|
|
|
|
|
|
printf "\n\n--------------------------------- SETTINGS INTEGRATION --------------------------------------\n";
|
2019-06-12 22:44:32 +02:00
|
|
|
|
|
|
|
# Adds the librefox config files to the packaged tarball
|
2019-06-16 08:57:29 +02:00
|
|
|
PACKAGE_FILE_NAME="librewolf*.tar.bz2\n";
|
|
|
|
printf "\nExtracting librewolf binary tarball\n";
|
2019-06-12 22:44:32 +02:00
|
|
|
tar -xvf ./$PACKAGE_FILE_NAME;
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "\nCopying librewolf settings to extracted binary tarball\n";
|
|
|
|
cp -r $REPOSITORY_FOLDER/settings/* ./librewolf;
|
|
|
|
printf "\nRecompressing binary tarball\n";
|
2019-06-12 22:44:32 +02:00
|
|
|
tar -jcvf ./$PACKAGE_FILE_NAME librewolf;
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "\nDeleting extracted binary tarball folder\n";
|
2019-06-12 22:44:32 +02:00
|
|
|
rm -rvf ./librewolf;
|
|
|
|
|
2019-06-16 08:57:29 +02:00
|
|
|
# BUILD APP IMAGE #################################################################################
|
|
|
|
# cp -r $BINARY_FOLDER ./app_image_build_folder
|
|
|
|
# Adds the librefox config files to the packaged tarball
|
|
|
|
# PACKAGE_FILE_NAME="librewolf*.tar.bz2";
|
|
|
|
# tar -xvf ./$PACKAGE_FILE_NAME;
|
|
|
|
# cp -r ../settings/* ./librewolf;
|
|
|
|
# tar -jcvf ./$PACKAGE_FILE_NAME librewolf;
|
|
|
|
# rm -rvf ./librewolf;
|
|
|
|
|
2019-06-12 22:44:32 +02:00
|
|
|
|