Introduce experimental builds that can test settings and policies

This commit is contained in:
Bert van der Weerd 2021-03-24 18:38:43 +01:00
parent 08d6d86570
commit 8e837eb87b
No known key found for this signature in database
GPG key ID: 4CFABB96ADE0F5B1
5 changed files with 204 additions and 64 deletions

2
.gitignore vendored
View file

@ -6,6 +6,6 @@ unity-menubar.patch
context-menu.patch
mozilla-vpn-ad.patch
mozconfig
Makefile
librewolf
tmp.nsi
tmp-experimental.nsi

View file

@ -1,43 +1,58 @@
exe=.exe
objdir=obj-x86_64-pc-mingw32/dist/firefox
# sanity checks
if [ ! -d obj-x86_64-pc-mingw32/dist/firefox ]; then
echo "artifacts_win.sh: directory obj-x86_64-pc-mingw32/dist/firefox not found."
if [ ! -d $objdir ]; then
echo "artifacts_win.sh: directory $objdir not found. did you run './build.sh build'?"
exit 1;
fi
rm -rf ../firefox ../librewolf
cp -r obj-x86_64-pc-mingw32/dist/firefox ..
cp -r $objdir ..
pushd ..
mv firefox librewolf
# apply the LibreWolf settings
cp -rv settings/* librewolf
# rename the executable manually
cd librewolf ; mv -v firefox.exe librewolf.exe ; cd ..
# recreate the zip file..
pushd librewolf ; mv -v firefox$exe librewolf$exe ; popd
# clean garbage files
cd librewolf ; rm -rf maintenanceservice* pingsender.exe firefox.*.xml precomplete removed-files ; cd ..
# be sure to remove the previous zip file..
rm -f librewolf-$pkgver.en-US.win64.zip*
zip -r9 librewolf-$pkgver.en-US.win64.zip librewolf
if [ $? -ne 0 ]; then exit 1; fi
sha256sum.exe librewolf-$pkgver.en-US.win64.zip > librewolf-$pkgver.en-US.win64.zip.sha256sum
if [ $? -ne 0 ]; then exit 1; fi
# now to try to make the installer.
cd librewolf ; rm -rf maintenanceservice* pingsender* firefox.*.xml precomplete removed-files ; cd ..
# copy the windows icon
cp -v common/source_files/browser/branding/librewolf/firefox.ico librewolf/librewolf.ico
sed "s/pkg_version/$pkgver/g" < artifacts_win.nsi > tmp.nsi
makensis-3.01.exe tmp.nsi
if [ $? -ne 0 ]; then exit 1; fi
sha256sum.exe librewolf-$pkgver.en-US.win64-setup.exe > librewolf-$pkgver.en-US.win64-setup.exe.sha256sum
# create the final zip artifact
rm -f librewolf-$pkgver.en-US.win64.zip
zip -qr9 librewolf-$pkgver.en-US.win64.zip librewolf
if [ $? -ne 0 ]; then exit 1; fi
# now to try to make the installer
rm -f librewolf-$pkgver.en-US.win64-setup.exe tmp.nsi
sed "s/pkg_version/$pkgver/g" < artifacts_win.nsi > tmp.nsi
makensis-3.01.exe -V1 tmp.nsi
if [ $? -ne 0 ]; then exit 1; fi
# patch to experimental config
if [ ! -z $experimental ]; then
pushd librewolf
echo "Applying experimental patches..."
patch -p1 -i ../patches/librewolf-config.patch
if [ $? -ne 0 ]; then exit 1; fi
patch -p1 -i ../patches/librewolf-policies.patch
if [ $? -ne 0 ]; then exit 1; fi
popd
# create the final zip artifact
rm -f librewolf-$pkgver.en-US.win64-experimental.zip
zip -qr9 librewolf-$pkgver.en-US.win64-experimental.zip librewolf
if [ $? -ne 0 ]; then exit 1; fi
# now to try to make the installer
rm -f librewolf-$pkgver.en-US.win64-experimental-setup.exe tmp-experimental.nsi
sed "s/win64-setup/win64-experimental-setup/g" < tmp.nsi > tmp-experimental.nsi
makensis-3.01.exe -V1 tmp-experimental.nsi
if [ $? -ne 0 ]; then exit 1; fi
fi
popd

163
build.sh
View file

@ -1,6 +1,10 @@
#!/bin/sh
# build.sh - build librewolf on windows
# derived from https://gitlab.com/librewolf-community/browser/linux/-/blob/master/PKGBUILD
#
# This script is set up like a Makefile, it's a list of functions that perform a
# certain sub-task, that function can be called as a commandline argument to the script.
#
set -e
@ -28,56 +32,33 @@ deps_pkg() {
echo "deps_pkg: done."
}
rustup() {
# rust needs special love: https://www.atechtown.com/install-rust-language-on-debian-10/
echo "rustup: begin."
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
cargo install cbindgen
echo "rustup: done."
}
mach_env() {
echo "mach_env: begin."
if [ ! -d firefox-$pkgver ]; then exit 1; fi
cd firefox-$pkgver
./mach create-mach-environment
if [ $? -ne 0 ]; then exit 1; fi
cd ..
echo "mach_env: done."
}
git_subs() {
echo "git_subs: begin."
git submodule update --recursive
git submodule foreach git merge origin master
echo "git_subs: done."
}
clean() {
echo "clean: begin."
echo "Deleting previous firefox-${pkgver} ..."
echo "Deleting firefox-${pkgver} ..."
rm -rf firefox-$pkgver
echo "Deleting other cruft ..."
rm -rf librewolf
rm -f firefox-$pkgver.source.tar.xz
rm -f mozconfig
rm -f *.patch
# windows
rm -f librewolf-$pkgver.en-US.win64.zip*
rm -f librewolf-$pkgver.en-US.win64-setup.exe*
rm -f tmp.nsi
rm -f librewolf-$pkgver.en-US.win64.zip
rm -f librewolf-$pkgver.en-US.win64-setup.exe
rm -f librewolf-$pkgver.en-US.win64-experimental.zip
rm -f librewolf-$pkgver.en-US.win64-experimental-setup.exe
rm -f tmp.nsi tmp-experimental.nsi
# linux
rm -f librewolf-$pkgver.en-US.deb.zip*
rm -f librewolf-$pkgver.en-US.rpm.zip*
rm -f librewolf-$pkgver.en-US.deb.zip
rm -f librewolf-$pkgver.en-US.rpm.zip
echo "clean: done."
}
fetch() {
echo "fetch: begin."
@ -190,7 +171,7 @@ END
echo 'remove_addons.patch:'
patch -p1 -i ../remove_addons.patch
if [ $? -ne 0 ]; then exit 1; fi
echo 'unity-menubar.patch: (skipped)'
#echo 'unity-menubar.patch:'
#patch -p1 -i ../unity-menubar.patch
#if [ $? -ne 0 ]; then exit 1; fi
@ -201,7 +182,7 @@ END
gsed --version > /dev/null
if [ $? -eq 0 ]; then
sed=gsed;
# while we're at it, disable webrtc
# disable webrtc, build errors
cat>>../mozconfig <<END
# disable webrtc on freebsd
ac_add_options --disable-webrtc
@ -291,6 +272,10 @@ artifacts_win() {
./mach package
if [ $? -ne 0 ]; then exit 1; fi
echo ""
echo "artifacts_win: Creating final artifacts."
echo ""
# there is just too much garbage in this installer function to
# have it all here..
. ../artifacts_win.sh
@ -299,6 +284,27 @@ artifacts_win() {
echo "artifacts_win: done."
}
artifacts_exp() {
echo "artifacts_exp: begin."
if [ ! -d firefox-$pkgver ]; then exit 1; fi
cd firefox-$pkgver
./mach package
if [ $? -ne 0 ]; then exit 1; fi
echo ""
echo "artifacts_exp: Creating final artifacts."
echo ""
# enable artifacts_win.sh to apply patches
experimental=experimental
. ../artifacts_win.sh
cd ..
echo "artifacts_exp: done."
}
artifacts_deb()
{
echo "artifacts_deb: begin."
@ -308,6 +314,10 @@ artifacts_deb()
./mach package
if [ $? -ne 0 ]; then exit 1; fi
echo ""
echo "artifacts_deb: Creating final artifacts."
echo ""
. ../artifacts_deb.sh
cd ..
@ -324,6 +334,10 @@ artifacts_rpm()
./mach package
if [ $? -ne 0 ]; then exit 1; fi
echo ""
echo "artifacts_rpm: Creating final artifacts."
echo ""
. ../artifacts_rpm.sh
cd ..
@ -331,6 +345,60 @@ artifacts_rpm()
}
rustup() {
# rust needs special love: https://www.atechtown.com/install-rust-language-on-debian-10/
echo "rustup: begin."
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
cargo install cbindgen
echo "rustup: done."
}
mach_env() {
echo "mach_env: begin."
if [ ! -d firefox-$pkgver ]; then exit 1; fi
cd firefox-$pkgver
./mach create-mach-environment
if [ $? -ne 0 ]; then exit 1; fi
cd ..
echo "mach_env: done."
}
git_subs() {
echo "git_subs: begin."
git submodule update --recursive
git submodule foreach git merge origin master
echo "git_subs: done."
}
#
# Experimental configuration options
#
config_diff() {
pushd settings > /dev/null
cp "/c/Program Files/LibreWolf/librewolf.cfg" librewolf.cfg
git diff librewolf.cfg > ../patches/librewolf-config.patch
git diff librewolf.cfg
git checkout librewolf.cfg > /dev/null 2>&1
popd > /dev/null
}
policies_diff() {
pushd settings/distribution > /dev/null
cp "/c/Program Files/LibreWolf/distribution/policies.json" policies.json
git diff policies.json > ../../patches/librewolf-policies.patch
git diff policies.json
git checkout policies.json > /dev/null 2>&1
popd > /dev/null
}
# windows: change $PATH to find all the build tools in .mozbuild
# this might do the trick on macos aswell?
if [ -f '/c/mozilla-build/start-shell.bat' ]; then
@ -342,10 +410,23 @@ if [ -f $HOME/.cargo/env ]; then
source $HOME/.cargo/env
fi
# process commandline arguments and do something
done_something=0
if [[ "$*" == *config_diff* ]]; then
config_diff
done_something=1
fi
if [[ "$*" == *policies_diff* ]]; then
policies_diff
done_something=1
fi
if [[ "$*" == *clean* ]]; then
clean
done_something=1
@ -394,6 +475,10 @@ if [[ "$*" == *artifacts_win* ]]; then
artifacts_win
done_something=1
fi
if [[ "$*" == *artifacts_exp* ]]; then
artifacts_exp
done_something=1
fi
if [[ "$*" == *artifacts_deb* ]]; then
artifacts_deb
done_something=1
@ -418,6 +503,7 @@ Use: ./build.sh fetch extract do_patches build package artifacts_win
do_patches - create a mozconfig, and patch the source.
build - the actual build.
artifacts_win - apply .cfg, build the zip file and NSIS setup.exe installer.
artifacts_exp - same as above, but apply experimental config/policy patches.
Linux related functions:
@ -429,11 +515,14 @@ Linux related functions:
Generic utility functionality:
clean - remove generated cruft.
git_subs - update git submodules.
mach_env - create mach build environment.
rustup - perform a rustup for this user.
clean - remove generated cruft.
git_subs - update git submodules.
config_diff - diff between my .cfg and dist .cfg file. (win10)
policies_diff - diff between my policies and the dist policies. (win10)
Examples:
For windows, use:

View file

@ -0,0 +1,22 @@
diff --git a/librewolf.cfg b/librewolf.cfg
index 1ad0cea..ed4cadd 100644
--- a/librewolf.cfg
+++ b/librewolf.cfg
@@ -389,7 +389,7 @@ defaultPref("extensions.ui.experiment.hidden", false);
lockPref("dom.indexedDB.enabled", true); //default true
//lockPref("dom.indexedDB.logging.details", false); //default true
//lockPref("dom.indexedDB.logging.enabled", false); //default true
-lockPref("dom.w3c_pointer_events.enabled", false);
+lockPref("dom.w3c_pointer_events.enabled", true);
//lockPref("network.http.spdy.enabled", false);
//lockPref("network.http.spdy.enabled.deps", false);
//lockPref("network.http.spdy.enabled.http2", false);
@@ -1804,7 +1804,7 @@ lockPref("datareporting.healthreport.uploadEnabled", false);
lockPref("datareporting.policy.dataSubmissionEnabled", false);
// Pref : Disable right-click menu manipulation via JavaScript (disabled)
-defaultPref("dom.event.contextmenu.enabled", false);
+defaultPref("dom.event.contextmenu.enabled", true);
// Pref : Disable clipboard event detection (onCut/onCopy/onPaste) via Javascript
// Disabling clipboard events breaks Ctrl+C/X/V copy/cut/paste functionaility in

View file

@ -0,0 +1,14 @@
diff --git a/distribution/policies.json b/distribution/policies.json
index 7f7e822..154db6e 100644
--- a/distribution/policies.json
+++ b/distribution/policies.json
@@ -62,7 +62,8 @@
"Extensions": {
"Install": [
- "https://addons.cdn.mozilla.net/user-media/addons/607454/ublock_origin-1.33.2-an+fx.xpi"
+ "https://addons.cdn.mozilla.net/user-media/addons/607454/ublock_origin-1.33.2-an+fx.xpi",
+ "https://addons.mozilla.org/firefox/downloads/file/3672658/decentraleyes-2.0.15-an+fx.xpi"
],
"Uninstall": [
"google@search.mozilla.org",