git_init, mach_run_config: Ability to patch/debug LibreWolf

This commit is contained in:
Bert van der Weerd 2021-03-26 16:51:40 +01:00
parent ec1dfca3c9
commit d5817ccb1b
No known key found for this signature in database
GPG key ID: 4CFABB96ADE0F5B1
6 changed files with 131 additions and 106 deletions

View file

@ -20,8 +20,9 @@ cp -rv settings/* librewolf
pushd librewolf ; mv -v firefox$exe librewolf$exe ; popd pushd librewolf ; mv -v firefox$exe librewolf$exe ; popd
# clean garbage files # clean garbage files
cd librewolf ; rm -rf maintenanceservice* pingsender* firefox.*.xml precomplete removed-files ; cd .. 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 # linux: copy app icon stuff
cp branding_files/register-librewolf branding_files/start-librewolf branding_files/start-librewolf.desktop.in librewolf
# create the final zip artifact # create the final zip artifact
rm -f librewolf-$pkgver.en-US.$ospkg.zip rm -f librewolf-$pkgver.en-US.$ospkg.zip

View file

@ -20,8 +20,10 @@ cp -rv settings/* librewolf
pushd librewolf ; mv -v firefox$exe librewolf$exe ; popd pushd librewolf ; mv -v firefox$exe librewolf$exe ; popd
# clean garbage files # clean garbage files
cd librewolf ; rm -rf maintenanceservice* pingsender* firefox.*.xml precomplete removed-files ; cd .. 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 # linux: copy app icon stuff
cp branding_files/register-librewolf branding_files/start-librewolf branding_files/start-librewolf.desktop.in librewolf
# create the final zip artifact # create the final zip artifact
rm -f librewolf-$pkgver.en-US.$ospkg.zip rm -f librewolf-$pkgver.en-US.$ospkg.zip

View file

@ -20,7 +20,8 @@ cp -rv settings/* librewolf
pushd librewolf ; mv -v firefox$exe librewolf$exe ; popd pushd librewolf ; mv -v firefox$exe librewolf$exe ; popd
# clean garbage files # clean garbage files
cd librewolf ; rm -rf maintenanceservice* pingsender* firefox.*.xml precomplete removed-files ; cd .. cd librewolf ; rm -rf maintenanceservice* pingsender* firefox.*.xml precomplete removed-files ; cd ..
# copy the windows icon
# windows: copy the windows icon
cp -v common/source_files/browser/branding/librewolf/firefox.ico librewolf/librewolf.ico cp -v common/source_files/browser/branding/librewolf/firefox.ico librewolf/librewolf.ico
# create the final zip artifact # create the final zip artifact

View file

@ -1,46 +0,0 @@
#! /bin/sh
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MOZ_APP_BASENAME=LibreWolf
MOZ_APP_VENDOR="LibreWolf Community"
MOZ_UPDATER=0
if test "$OS_ARCH" = "WINNT"; then
if ! test "$HAVE_64BIT_BUILD"; then
if test "$MOZ_UPDATE_CHANNEL" = "nightly" -o \
"$MOZ_UPDATE_CHANNEL" = "nightly-try" -o \
"$MOZ_UPDATE_CHANNEL" = "aurora" -o \
"$MOZ_UPDATE_CHANNEL" = "beta" -o \
"$MOZ_UPDATE_CHANNEL" = "release"; then
if ! test "$MOZ_DEBUG"; then
if ! test "$USE_STUB_INSTALLER"; then
# Expect USE_STUB_INSTALLER from taskcluster for downstream task consistency
echo "ERROR: STUB installer expected to be enabled but"
echo "ERROR: USE_STUB_INSTALLER is not specified in the environment"
exit 1
fi
MOZ_STUB_INSTALLER=1
fi
fi
fi
fi
BROWSER_CHROME_URL=chrome://browser/content/browser.xhtml
# MOZ_APP_DISPLAYNAME will be set by branding/configure.sh
# MOZ_BRANDING_DIRECTORY is the default branding directory used when none is
# specified. It should never point to the "official" branding directory.
# For mozilla-beta, mozilla-release, or mozilla-central repositories, use
# "unofficial" branding.
# For the mozilla-aurora repository, use "aurora".
MOZ_BRANDING_DIRECTORY=browser/branding/librewolf
MOZ_OFFICIAL_BRANDING_DIRECTORY=browser/branding/librewolf
MOZ_APP_ID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
MOZ_PROFILE_MIGRATOR=1
# Include the DevTools client, not just the server (which is the default)
MOZ_DEVTOOLS=all

145
build.sh
View file

@ -65,7 +65,8 @@ fetch() {
# fetch the firefox source. # fetch the firefox source.
rm -f firefox-$pkgver.source.tar.xz rm -f firefox-$pkgver.source.tar.xz
wget https://archive.mozilla.org/pub/firefox/releases/$pkgver/source/firefox-$pkgver.source.tar.xz echo "Downloading firefox-$pkgver.source.tar.xz ..."
wget -q https://archive.mozilla.org/pub/firefox/releases/$pkgver/source/firefox-$pkgver.source.tar.xz
if [ $? -ne 0 ]; then exit 1; fi if [ $? -ne 0 ]; then exit 1; fi
if [ ! -f firefox-$pkgver.source.tar.xz ]; then exit 1; fi if [ ! -f firefox-$pkgver.source.tar.xz ]; then exit 1; fi
@ -89,33 +90,7 @@ extract() {
} }
create_mozconfig() {
do_patches() {
echo "do_patches: begin."
# get the patches
echo 'Getting patches..'
rm -f context-menu.patch megabar.patch mozilla-vpn-ad.patch remove_addons.patch unity-menubar.patch
wget -q https://gitlab.com/librewolf-community/browser/linux/-/raw/master/context-menu.patch
if [ $? -ne 0 ]; then exit 1; fi
if [ ! -f context-menu.patch ]; then exit 1; fi
wget -q https://gitlab.com/librewolf-community/browser/linux/-/raw/master/megabar.patch
if [ $? -ne 0 ]; then exit 1; fi
if [ ! -f megabar.patch ]; then exit 1; fi
wget -q https://gitlab.com/librewolf-community/browser/linux/-/raw/master/mozilla-vpn-ad.patch
if [ $? -ne 0 ]; then exit 1; fi
if [ ! -f mozilla-vpn-ad.patch ]; then exit 1; fi
wget -q https://gitlab.com/librewolf-community/browser/linux/-/raw/master/remove_addons.patch
if [ $? -ne 0 ]; then exit 1; fi
if [ ! -f remove_addons.patch ]; then exit 1; fi
# create mozconfig..
if [ ! -d firefox-$pkgver ]; then exit 1; fi
cd firefox-$pkgver
cat >../mozconfig <<END cat >../mozconfig <<END
ac_add_options --enable-application=browser ac_add_options --enable-application=browser
@ -152,6 +127,32 @@ mk_add_options MOZ_TELEMETRY_REPORTING=0
# first attempt to fix the win32 vcredist issue results in build errors.. # first attempt to fix the win32 vcredist issue results in build errors..
#WIN32_REDIST_DIR=$VCINSTALLDIR\redist\x86\Microsoft.VC141.CRT #WIN32_REDIST_DIR=$VCINSTALLDIR\redist\x86\Microsoft.VC141.CRT
END END
}
do_patches() {
echo "do_patches: begin."
# get the patches
echo 'Getting patches...'
rm -f context-menu.patch megabar.patch mozilla-vpn-ad.patch remove_addons.patch unity-menubar.patch
wget -q https://gitlab.com/librewolf-community/browser/linux/-/raw/master/context-menu.patch
if [ $? -ne 0 ]; then exit 1; fi
if [ ! -f context-menu.patch ]; then exit 1; fi
wget -q https://gitlab.com/librewolf-community/browser/linux/-/raw/master/megabar.patch
if [ $? -ne 0 ]; then exit 1; fi
if [ ! -f megabar.patch ]; then exit 1; fi
wget -q https://gitlab.com/librewolf-community/browser/linux/-/raw/master/mozilla-vpn-ad.patch
if [ $? -ne 0 ]; then exit 1; fi
if [ ! -f mozilla-vpn-ad.patch ]; then exit 1; fi
wget -q https://gitlab.com/librewolf-community/browser/linux/-/raw/master/remove_addons.patch
if [ $? -ne 0 ]; then exit 1; fi
if [ ! -f remove_addons.patch ]; then exit 1; fi
if [ ! -d firefox-$pkgver ]; then exit 1; fi
cd firefox-$pkgver
echo 'Applying patches...' echo 'Applying patches...'
@ -169,9 +170,12 @@ END
echo 'remove_addons.patch:' echo 'remove_addons.patch:'
patch -p1 -i ../remove_addons.patch patch -p1 -i ../remove_addons.patch
if [ $? -ne 0 ]; then exit 1; fi if [ $? -ne 0 ]; then exit 1; fi
#echo 'unity-menubar.patch:'
#patch -p1 -i ../unity-menubar.patch
#if [ $? -ne 0 ]; then exit 1; fi # create mozconfig..
create_mozconfig
# just a straight copy for now..
cp -v ../mozconfig .
# on freebsd we're called gsed.. # on freebsd we're called gsed..
@ -236,10 +240,13 @@ END
cp -vr ../common/source_files/* ./ cp -vr ../common/source_files/* ./
# new branding stuff # new branding stuff
cp -v ../branding_files/configure.sh browser/branding/librewolf cp -v ../branding_files/configure.sh browser/branding/librewolf
cp -v ../branding_files/confvars.sh browser/confvars.sh
# just a straight copy for now.. # local patches
cp -v ../mozconfig . echo 'Local patches...'
echo 'browser-confvars.patch:'
patch -p1 -i ../patches/browser-confvars.patch
if [ $? -ne 0 ]; then exit 1; fi
cd .. cd ..
echo "do_patches: done." echo "do_patches: done."
@ -371,6 +378,25 @@ policies_diff() {
popd > /dev/null popd > /dev/null
} }
git_init() {
echo "git_init: begin."
if [ ! -d firefox-$pkgver ]; then exit 1; fi
cd firefox-$pkgver
echo "Removing old .git folder..."
rm -rf .git
echo "Creating new .git folder..."
git init
git config core.safecrlf false
git config commit.gpgsign false
git add -f * .[a-z]*
git commit -am 'Initial commit'
cd ..
echo "git_init: done."
}
@ -396,16 +422,7 @@ fi
done_something=0 done_something=0
if [[ "$*" == *config_diff* ]]; then # various administrative actions...
config_diff
done_something=1
fi
if [[ "$*" == *policies_diff* ]]; then
policies_diff
done_something=1
fi
#
if [[ "$*" == *clean* ]]; then if [[ "$*" == *clean* ]]; then
clean clean
@ -419,8 +436,12 @@ if [[ "$*" == *rustup* ]]; then
rustup rustup
done_something=1 done_something=1
fi fi
if [[ "$*" == *mach_env* ]]; then
mach_env
done_something=1
fi
# # dependencies on various platforms...
if [[ "$*" == *deps_deb* ]]; then if [[ "$*" == *deps_deb* ]]; then
deps_deb deps_deb
@ -435,7 +456,7 @@ if [[ "$*" == *deps_pkg* ]]; then
done_something=1 done_something=1
fi fi
# # main building actions...
if [[ "$*" == *fetch* ]]; then if [[ "$*" == *fetch* ]]; then
fetch fetch
@ -449,8 +470,8 @@ if [[ "$*" == *do_patches* ]]; then
do_patches do_patches
done_something=1 done_something=1
fi fi
if [[ "$*" == *mach_env* ]]; then if [[ "$*" == *git_init* ]]; then
mach_env git_init
done_something=1 done_something=1
fi fi
if [[ "$*" == *build* ]]; then if [[ "$*" == *build* ]]; then
@ -458,7 +479,7 @@ if [[ "$*" == *build* ]]; then
done_something=1 done_something=1
fi fi
# # creating the artifacts...
if [[ "$*" == *artifacts_exp* ]]; then if [[ "$*" == *artifacts_exp* ]]; then
experimental=experimental experimental=experimental
@ -491,18 +512,34 @@ else
fi fi
fi fi
# librewolf.cfg and policies.json differences
if [[ "$*" == *config_diff* ]]; then
config_diff
done_something=1
fi
if [[ "$*" == *policies_diff* ]]; then
policies_diff
done_something=1
fi
if [[ "$*" == *mach_run_config* ]]; then
cp -r settings/* $(echo firefox-$pkgver/obj-*)/dist/bin
done_something=1
fi
# by default, give help.. # by default, give help..
if (( done_something == 0 )); then if (( done_something == 0 )); then
cat << EOF cat << EOF
Use: ./build.sh fetch extract do_patches build package artifacts_win Use: ./build.sh fetch extract do_patches build artifacts_win
fetch - fetch the tarball. fetch - fetch the tarball.
extract - extract the tarball. extract - extract the tarball.
do_patches - create a mozconfig, and patch the source. do_patches - create a mozconfig, and patch the source.
build - the actual build. build - the actual build.
artifacts_win - apply .cfg, build the zip file and NSIS setup.exe installer. artifacts_win - apply .cfg, build the zip file and NSIS setup.exe installer.
artifacts_exp - same as above, but also build with experimental config/policy. artifacts_exp - package as above, but use the experimental config/policies.
Linux related functions: Linux related functions:
@ -510,9 +547,9 @@ Linux related functions:
deps_rpm - install dependencies with dnf. deps_rpm - install dependencies with dnf.
deps_pkg - install dependencies with pkg. deps_pkg - install dependencies with pkg.
artifacts_deb - apply .cfg, create a dist zip file (for debian10). artifacts_deb - apply .cfg, create a dist zip file (for debian10).
artifacts_deb_exp - include experimental build artifacts_deb_exp - include experimental build.
artifacts_rpm - apply .cfg, create a dist zip file (for fedora33). artifacts_rpm - apply .cfg, create a dist zip file (for fedora33).
artifacts_rpm_exp - include experimental build artifacts_rpm_exp - include experimental build.
Generic utility functionality: Generic utility functionality:
@ -523,6 +560,8 @@ Generic utility functionality:
git_subs - update git submodules. git_subs - update git submodules.
config_diff - diff between my .cfg and dist .cfg file. (win10) config_diff - diff between my .cfg and dist .cfg file. (win10)
policies_diff - diff between my policies and the dist policies. (win10) policies_diff - diff between my policies and the dist policies. (win10)
git_init - create .git folder in firefox-$pkgver for creating patches.
mach_run_config - copy librewolf config/policies to enable 'mach run'.
Examples: Examples:

View file

@ -0,0 +1,28 @@
diff --git a/browser/confvars.sh b/browser/confvars.sh
index 92871c9516..1e151180dd 100644
--- a/browser/confvars.sh
+++ b/browser/confvars.sh
@@ -3,8 +3,10 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-MOZ_APP_VENDOR=Mozilla
-MOZ_UPDATER=1
+MOZ_APP_BASENAME=LibreWolf
+MOZ_APP_VENDOR="LibreWolf Community"
+
+MOZ_UPDATER=0
if test "$OS_ARCH" = "WINNT"; then
if ! test "$HAVE_64BIT_BUILD"; then
@@ -34,8 +36,8 @@ BROWSER_CHROME_URL=chrome://browser/content/browser.xhtml
# For mozilla-beta, mozilla-release, or mozilla-central repositories, use
# "unofficial" branding.
# For the mozilla-aurora repository, use "aurora".
-MOZ_BRANDING_DIRECTORY=browser/branding/unofficial
-MOZ_OFFICIAL_BRANDING_DIRECTORY=browser/branding/official
+MOZ_BRANDING_DIRECTORY=browser/branding/librewolf
+MOZ_OFFICIAL_BRANDING_DIRECTORY=browser/branding/librewolf
MOZ_APP_ID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
MOZ_PROFILE_MIGRATOR=1