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/../);
|
2019-06-16 13:40:19 +02:00
|
|
|
BRANDING_FOLDER=$SCRIPT_FOLDER/resources/source_files/browser/branding/librewolf;
|
2019-06-18 03:34:52 +02:00
|
|
|
ICON_FOLDER=$REPOSITORY_FOLDER/branding/icon/;
|
2019-06-16 13:40:19 +02:00
|
|
|
PACKAGE_FILE="librewolf*.tar.bz2";
|
2019-06-16 13:41:59 +02:00
|
|
|
APPIMAGE_RESOURCE_FOLDER=$SCRIPT_FOLDER/resources/appimage;
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "SCRIPT_FOLDER: $SCRIPT_FOLDER\n";
|
|
|
|
printf "REPOSITORY_FOLDER: $REPOSITORY_FOLDER\n";
|
2019-06-16 13:40:19 +02:00
|
|
|
printf "BRANDING_FOLDER: $BRANDING_FOLDER\n";
|
2019-06-18 03:34:52 +02:00
|
|
|
printf "ICON_FOLDER: $ICON_FOLDER\n";
|
2019-06-16 13:40:19 +02:00
|
|
|
printf "PACKAGE_FILE: $PACKAGE_FILE\n";
|
|
|
|
printf "APPIMAGE_RESOURCE_FOLDER: $APPIMAGE_RESOURCE_FOLDER\n";
|
2019-06-16 08:57:29 +02:00
|
|
|
|
|
|
|
# Installs some needed dependencies
|
|
|
|
printf "\nInstalling script dependencies\n";
|
2019-06-17 01:48:10 +02:00
|
|
|
apt update;
|
2019-06-23 21:05:21 +02:00
|
|
|
apt install sudo python python3 inkscape icnsutils wget fuse libfuse-dev kmod -y;
|
2019-06-16 08:57:29 +02:00
|
|
|
|
2019-06-23 16:52:42 +02:00
|
|
|
# Loads the FUSE kernel module
|
2019-06-24 06:33:59 +02:00
|
|
|
sudo depmod;
|
2019-06-23 16:52:42 +02:00
|
|
|
sudo modprobe fuse;
|
|
|
|
|
2019-06-16 13:40:19 +02:00
|
|
|
printf "\n\n---------------------------------- ICON GENERATION ------------------------------------------\n";
|
2019-06-16 08:57:29 +02:00
|
|
|
|
2019-06-18 03:34:52 +02:00
|
|
|
printf "\nGenerating icons from $ICON_FOLDER and moving to $BRANDING_FOLDER\n";
|
2019-06-16 08:57:29 +02:00
|
|
|
|
|
|
|
# Linux Icons
|
2019-06-18 03:34:52 +02:00
|
|
|
inkscape -z -f $ICON_FOLDER/icon.svg -e $BRANDING_FOLDER/default16.png -w 16 -h 16;
|
|
|
|
inkscape -z -f $ICON_FOLDER/icon.svg -e $BRANDING_FOLDER/default32.png -w 32 -h 32;
|
|
|
|
inkscape -z -f $ICON_FOLDER/icon.svg -e $BRANDING_FOLDER/default48.png -w 48 -h 48;
|
|
|
|
inkscape -z -f $ICON_FOLDER/icon.svg -e $BRANDING_FOLDER/default64.png -w 64 -h 64;
|
|
|
|
inkscape -z -f $ICON_FOLDER/icon.svg -e $BRANDING_FOLDER/default128.png -w 128 -h 128;
|
2019-06-16 08:57:29 +02:00
|
|
|
|
|
|
|
# Windows Icons
|
2019-06-18 03:34:52 +02:00
|
|
|
inkscape -z -f $ICON_FOLDER/icon.svg -e $BRANDING_FOLDER/VisualElements_70.png -w 70 -h70;
|
|
|
|
inkscape -z -f $ICON_FOLDER/icon.svg -e $BRANDING_FOLDER/VisualElements_150.png -w 150 -h150;
|
2019-06-16 08:57:29 +02:00
|
|
|
|
|
|
|
# TODO: Add Apple Icons
|
2019-06-18 03:34:52 +02:00
|
|
|
png2icns $BRANDING_FOLDER/firefox.icns $BRANDING_FOLDER/default128.png;
|
2019-06-16 08:57:29 +02:00
|
|
|
|
2019-06-18 03:34:52 +02:00
|
|
|
inkscape -z -f $ICON_FOLDER/document-icon.svg -e $BRANDING_FOLDER/document-icon.png -w 128 -h 128;
|
|
|
|
png2icns $BRANDING_FOLDER/document.icns $BRANDING_FOLDER/document-icon.png;
|
|
|
|
rm -r $BRANDING_FOLDER/document-icon.png
|
2019-06-16 13:40:19 +02:00
|
|
|
printf "\n\n-------------------------------------- PREBUILD ---------------------------------------------\n";
|
2019-06-16 08:57:29 +02:00
|
|
|
|
|
|
|
# Downloads and runs bootstrapper to install dependencies.
|
|
|
|
printf "\nRunning bootstrapper to install build dependencies\n";
|
2019-06-16 13:40:19 +02:00
|
|
|
wget https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py;
|
|
|
|
python ./bootstrap.py --application-choice=browser --no-interactive;
|
2019-06-12 22:44:32 +02:00
|
|
|
|
|
|
|
# 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 13:40:19 +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
|
|
|
|
|
|
|
cd mozilla-release;
|
2019-06-16 13:40:19 +02:00
|
|
|
|
|
|
|
# Bootstraps librewolf again (using the ./mach script inside the source code)
|
|
|
|
printf "\nRunning bootstrapper to install build dependencies (using ./mach script within source code)\n";
|
2019-06-12 22:44:32 +02:00
|
|
|
./mach bootstrap --application-choice=browser --no-interactive;
|
2019-06-16 13:40:19 +02:00
|
|
|
|
|
|
|
# Builds librewolf
|
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 13:40:19 +02:00
|
|
|
|
|
|
|
# Packages LibreWolf
|
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 13:40:19 +02:00
|
|
|
cd $SCRIPT_FOLDER;
|
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 ./;
|
|
|
|
|
|
|
|
printf "\n\n--------------------------------- SETTINGS INTEGRATION --------------------------------------\n";
|
2019-06-12 22:44:32 +02:00
|
|
|
|
2019-06-16 13:40:19 +02:00
|
|
|
# Extracts the binary tarball
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "\nExtracting librewolf binary tarball\n";
|
2019-06-16 13:40:19 +02:00
|
|
|
tar -xvf ./$PACKAGE_FILE;
|
|
|
|
|
|
|
|
# Adds the librefox config files to the packaged tarball
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "\nCopying librewolf settings to extracted binary tarball\n";
|
|
|
|
cp -r $REPOSITORY_FOLDER/settings/* ./librewolf;
|
2019-06-16 13:40:19 +02:00
|
|
|
|
|
|
|
# Repacks the binary tarball
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "\nRecompressing binary tarball\n";
|
2019-06-16 13:40:19 +02:00
|
|
|
tar -jcvf ./$PACKAGE_FILE librewolf;
|
|
|
|
|
|
|
|
# Moves the final binary tarball to build_output
|
|
|
|
printf "\nMoving binary tarball to build_output folder\n";
|
|
|
|
mv $PACKAGE_FILE $SCRIPT_FOLDER/build_output/;
|
|
|
|
|
|
|
|
printf "\n\n------------------------------------ APPIMAGE BUILD -----------------------------------------\n";
|
|
|
|
|
|
|
|
# Copy and generate icons
|
|
|
|
printf "\nGenerating AppImage Icons\n";
|
2019-06-18 03:34:52 +02:00
|
|
|
cp $ICON_FOLDER/icon.svg $APPIMAGE_RESOURCE_FOLDER/librewolf.svg;
|
2019-06-16 13:40:19 +02:00
|
|
|
ln -rs $APPIMAGE_RESOURCE_FOLDER/librewolf.svg $SCRIPT_FOLDER/resources/appimage/.DirIcon;
|
|
|
|
|
|
|
|
# Copy appimage resources to main tarball
|
|
|
|
printf "Copying AppImage resources to binary tarball folder\n";
|
|
|
|
cp -vrT $APPIMAGE_RESOURCE_FOLDER ./librewolf;
|
|
|
|
|
|
|
|
# Downloads appimage tool
|
|
|
|
printf "\nDownloading AppImage Tool\n";
|
2019-06-30 16:38:15 +02:00
|
|
|
wget https://github.com/AppImage/AppImageKit/releases/latest/download/appimagetool-x86_64.AppImage -O appimagetool;
|
|
|
|
chmod +x ./appimagetool;
|
|
|
|
./appimagetool --appimage-extract;
|
2019-06-16 13:40:19 +02:00
|
|
|
|
|
|
|
# Generate AppImage
|
|
|
|
printf "\nGenerating AppImage\n";
|
2019-06-30 16:38:15 +02:00
|
|
|
./squashfs-root/AppRun ./librewolf;
|
2019-06-16 13:40:19 +02:00
|
|
|
chmod +x ./LibreWolf*.AppImage;
|
|
|
|
|
|
|
|
# Move AppImage to build_output folder
|
|
|
|
printf "\nMoving AppImage to build_output folder\n";
|
|
|
|
mv ./LibreWolf*.AppImage ./build_output;
|
|
|
|
|
|
|
|
printf "\n\n---------------------------------------- CLEANUP --------------------------------------------\n";
|
|
|
|
|
|
|
|
# Remove the compile folder
|
|
|
|
printf "\nDeleting the compile_folder\n";
|
2019-06-17 06:37:18 +02:00
|
|
|
rm -rf ./compile_folder;
|
2019-06-16 13:40:19 +02:00
|
|
|
|
|
|
|
# Delete the extracted binary tarball folder
|
2019-06-16 08:57:29 +02:00
|
|
|
printf "\nDeleting extracted binary tarball folder\n";
|
2019-06-17 06:37:18 +02:00
|
|
|
rm -rf ./librewolf;
|
2019-06-12 22:44:32 +02:00
|
|
|
|
2019-06-16 13:40:19 +02:00
|
|
|
# Delete the appimage tool
|
|
|
|
printf "\nRemoving AppImage tool\n";
|
2019-06-30 16:38:15 +02:00
|
|
|
rm -f ./appimagetool;
|
|
|
|
rm -rf ./squashfs-root;
|
2019-06-12 22:44:32 +02:00
|
|
|
|
2019-06-16 13:40:19 +02:00
|
|
|
# Delete the bootstrapper script
|
|
|
|
printf "\nRemoving bootstrapper.py\n";
|
|
|
|
rm -f ./bootstrap.py;
|