mirror of
https://codeberg.org/librewolf/source.git
synced 2024-12-21 21:23:08 -05:00
Finally the xmas.patch has arrived.
This commit is contained in:
parent
0345ee85b7
commit
58e6d09f84
9 changed files with 158 additions and 232 deletions
|
@ -1,56 +0,0 @@
|
|||
## Note: this part of the build is mostly done, but still requires a patch.
|
||||
|
||||
Next, we create ourselves a build folder and extract the tarball.
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
tar xf ../librewolf-$(version).source.tar.gz
|
||||
```
|
||||
Next step, if you have not done so already, you must create the build environment:
|
||||
```
|
||||
cp librewolf-$(version)/lw-assets/bootstrap.py .
|
||||
python3 --no-interactive bootstrap.py --application-choice=browser
|
||||
```
|
||||
It takes about an hour for me to complete, but it needs to be done only once. This step might fail and cause problems. Why Mozilla has no separate 'install-buildenv.py' is a bit beyond me. I would have liked to be able to set up the build environment in one step, in a second step checkout the entire mozilla source, or in our case, use our own source.
|
||||
|
||||
Now we're ready to actually build LibreWolf:
|
||||
```
|
||||
cd librewolf-$(version)
|
||||
./mach build
|
||||
```
|
||||
Also takes me an hour. Then, we can run it:
|
||||
```
|
||||
./mach run
|
||||
```
|
||||
Or make a package:
|
||||
```
|
||||
./mach package
|
||||
```
|
||||
|
||||
## Building LibreWolf source tarball:
|
||||
|
||||
You don't need the build environment for this. If you don't have write access, just:
|
||||
```
|
||||
git clone https://gitlab.com/librewolf-community/browser/source.git
|
||||
cd source
|
||||
make all
|
||||
```
|
||||
If you **do** have write access, we're first gonna check for a newer version of Firefox:
|
||||
```
|
||||
git clone git@gitlab.com:librewolf-community/browser/source.git
|
||||
cd source
|
||||
make check
|
||||
```
|
||||
If there is a new version, it's a good time to git commit and trigger a CI build job.
|
||||
```
|
||||
git commit -am v$(cat version) && git push
|
||||
```
|
||||
To build the source archive:
|
||||
```
|
||||
make all
|
||||
```
|
||||
If you have a working build environment, you can build librewolf with:
|
||||
```
|
||||
make librewolf
|
||||
```
|
||||
This extracts the source, and then tries to `./mach build && ./mach package`.
|
16
Makefile
16
Makefile
|
@ -15,6 +15,7 @@ ext=.tar.gz
|
|||
|
||||
|
||||
help :
|
||||
|
||||
@echo "use: make [all] [check] [clean] [veryclean]"
|
||||
@echo ""
|
||||
@echo " all - Make librewolf source archive ${version}."
|
||||
|
@ -26,7 +27,7 @@ help :
|
|||
|
||||
|
||||
check :
|
||||
@python3 assets/update-version.py
|
||||
@python3 scripts/update-version.py
|
||||
|
||||
|
||||
all : librewolf-$(version).source$(ext)
|
||||
|
@ -47,25 +48,24 @@ firefox-$(version).source.tar.xz :
|
|||
|
||||
# we take this extra step seperatly because it's so important.
|
||||
librewolf-patches :
|
||||
rm -rf work && mkdir -p work
|
||||
python3 assets/librewolf-patches.py $(version)
|
||||
rm -rf work && mkdir work
|
||||
python3 scripts/librewolf-patches.py $(version)
|
||||
rm -rf work
|
||||
|
||||
|
||||
librewolf-$(version).source$(ext) : firefox-$(version).source.tar.xz $(version_file) assets/librewolf-patches.py assets/build-librewolf.py assets/mozconfig assets/patches.txt
|
||||
librewolf-$(version).source$(ext) : firefox-$(version).source.tar.xz $(version_file) scripts/librewolf-patches.py scripts/build-librewolf.py assets/mozconfig assets/patches.txt
|
||||
rm -rf firefox-$(version) librewolf-$(version)
|
||||
tar xf firefox-$(version).source.tar.xz
|
||||
mv firefox-$(version) librewolf-$(version)
|
||||
|
||||
make librewolf-patches
|
||||
|
||||
rm -f librewolf-$(version).source$(ext)
|
||||
$(archive_create) librewolf-$(version).source$(ext) librewolf-$(version)
|
||||
rm -rf librewolf-$(version)
|
||||
|
||||
librewolf-$(version) : librewolf-$(version).source$(ext)
|
||||
tar xf librewolf-$(version).source$(ext)
|
||||
#TODO: fix this when the script is obsolete
|
||||
cp -v librewolf-$(version)/lw-assets/build-librewolf.py librewolf-$(version)
|
||||
|
||||
librewolf : librewolf-$(version)
|
||||
#TODO: (cd librewolf-$(version) && ./mach build && ./mach package)
|
||||
(cd librewolf-$(version) && python3 build-librewolf.py $(version))
|
||||
(cd librewolf-$(version) && ./mach build && ./mach package)
|
||||
|
|
55
README.md
55
README.md
|
@ -9,4 +9,57 @@ wget -O librewolf-$(version).source.tar.gz https://gitlab.com/librewolf-communit
|
|||
curl -L -o librewolf-$(version).source.tar.gz https://gitlab.com/librewolf-community/browser/source/-/jobs/artifacts/main/raw/librewolf-$(version).source.tar.gz?job=build-job
|
||||
```
|
||||
|
||||
This should be enough for builders to create librewolfies, a more detailed description is in the works with documentation in: CONTRIBUTING.md
|
||||
Next, we create ourselves a build folder and extract the tarball.
|
||||
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
tar xf ../librewolf-$(version).source.tar.gz
|
||||
```
|
||||
Next step, if you have not done so already, you must create the build environment:
|
||||
```
|
||||
librewolf-$(version)/lw/mozfetch.sh
|
||||
```
|
||||
It takes about an hour for me to complete, but it needs to be done only once. This step might fail and cause problems. Hack a bit, and if that fails you can ask on our Gitter/matrix channel.
|
||||
|
||||
Now we're ready to actually build LibreWolf:
|
||||
```
|
||||
cd librewolf-$(version)
|
||||
./mach build
|
||||
```
|
||||
Also takes me an hour. Then, we can run it:
|
||||
```
|
||||
./mach run
|
||||
```
|
||||
Or make a package:
|
||||
```
|
||||
./mach package
|
||||
```
|
||||
|
||||
## Building LibreWolf source tarball:
|
||||
|
||||
Luckly, you don't need the build environment for this. If you don't have write access, just:
|
||||
```
|
||||
git clone https://gitlab.com/librewolf-community/browser/source.git
|
||||
cd source
|
||||
make all
|
||||
```
|
||||
If you **do** have write access, we're first gonna check for a newer version of Firefox:
|
||||
```
|
||||
git clone git@gitlab.com:librewolf-community/browser/source.git
|
||||
cd source
|
||||
make check
|
||||
```
|
||||
If there is a new version, it's a good time to git commit and trigger a CI build job.
|
||||
```
|
||||
git commit -am v$(cat version) && git push
|
||||
```
|
||||
To build the source archive:
|
||||
```
|
||||
make all
|
||||
```
|
||||
If you have a working build environment, you can build librewolf with:
|
||||
```
|
||||
make librewolf
|
||||
```
|
||||
This extracts the source, and then tries to `./mach build && ./mach package`.
|
||||
|
|
|
@ -1,143 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import optparse
|
||||
import time
|
||||
import glob
|
||||
|
||||
|
||||
start_time = time.time()
|
||||
|
||||
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option('-n', '--no-execute', dest='no_execute', default=False, action="store_true")
|
||||
options, args = parser.parse_args()
|
||||
|
||||
#
|
||||
# general functions
|
||||
#
|
||||
|
||||
def script_exit(statuscode):
|
||||
if (time.time() - start_time) > 60:
|
||||
# print elapsed time
|
||||
elapsed = time.strftime("%H:%M:%S", time.gmtime(time.time() - start_time))
|
||||
print(f"\n\aElapsed time: {elapsed}")
|
||||
|
||||
sys.exit(statuscode)
|
||||
|
||||
def exec(cmd, exit_on_fail = True, do_print = True):
|
||||
if cmd != '':
|
||||
if do_print:
|
||||
print(cmd)
|
||||
if not options.no_execute:
|
||||
retval = os.system(cmd)
|
||||
if retval != 0 and exit_on_fail:
|
||||
print("fatal error: command '{}' failed".format(cmd))
|
||||
script_exit(1)
|
||||
return retval
|
||||
return None
|
||||
|
||||
def patch(patchfile):
|
||||
cmd = "patch -p1 -i {}".format(patchfile)
|
||||
print("\n*** -> {}".format(cmd))
|
||||
if not options.no_execute:
|
||||
retval = os.system(cmd)
|
||||
if retval != 0:
|
||||
print("fatal error: patch '{}' failed".format(patchfile))
|
||||
script_exit(1)
|
||||
|
||||
def enter_srcdir(_dir = None):
|
||||
if _dir == None:
|
||||
dir = "librewolf-{}".format(version)
|
||||
else:
|
||||
dir = _dir
|
||||
print("cd {}".format(dir))
|
||||
if not options.no_execute:
|
||||
try:
|
||||
os.chdir(dir)
|
||||
except:
|
||||
print("fatal error: can't change to '{}' folder.".format(dir))
|
||||
script_exit(1)
|
||||
|
||||
def leave_srcdir():
|
||||
print("cd ..")
|
||||
if not options.no_execute:
|
||||
os.chdir("..")
|
||||
|
||||
|
||||
#
|
||||
# The actual script
|
||||
#
|
||||
|
||||
#
|
||||
# post_build stage:
|
||||
#
|
||||
|
||||
|
||||
def get_objdir():
|
||||
pattern = "obj-*"
|
||||
retval = glob.glob(pattern)
|
||||
if options.no_execute:
|
||||
return "obj-XXX"
|
||||
if len(retval) != 1:
|
||||
print("fatal error: in execute_lw_post_build(): cannot glob build output folder '{}'".format(pattern))
|
||||
script_exit(1)
|
||||
return retval[0]
|
||||
|
||||
_dirname = ""
|
||||
|
||||
def post_build(is_macos=False):
|
||||
print('--- post_build stage [init] ---------------------------------------')
|
||||
sys.stdout.flush();
|
||||
dirname = get_objdir()
|
||||
_dirname = dirname
|
||||
|
||||
distfolder = "dist/bin"
|
||||
if is_macos:
|
||||
distfolder = 'dist/LibreWolf.app/Contents/Resources'
|
||||
|
||||
if not options.no_execute:
|
||||
os.makedirs("{}/{}/defaults/pref".format(dirname,distfolder), exist_ok=True)
|
||||
os.makedirs("{}/{}/distribution".format(dirname,distfolder), exist_ok=True)
|
||||
|
||||
exec('git clone https://gitlab.com/librewolf-community/settings.git')
|
||||
exec("cp -v settings/defaults/pref/local-settings.js {}/{}/defaults/pref/".format(dirname,distfolder))
|
||||
exec("cp -v settings/distribution/policies.json {}/{}/distribution/".format(dirname,distfolder))
|
||||
exec("cp -v settings/librewolf.cfg {}/{}/".format(dirname,distfolder))
|
||||
exec('rm -rf settings')
|
||||
|
||||
# maybe a wget -q ?
|
||||
if not os.path.exists('package-manifest.patch'):
|
||||
exec('wget -q https://gitlab.com/librewolf-community/browser/windows/-/raw/master/patches/package-manifest.patch')
|
||||
patch('package-manifest.patch')
|
||||
|
||||
print('--- post_build stage [done] ---------------------------------------')
|
||||
sys.stdout.flush();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# my build folder will be here:
|
||||
enter_srcdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
|
||||
|
||||
|
||||
|
||||
# perform the build
|
||||
exec('MACH_USE_SYSTEM_PYTHON=1 ./mach build')
|
||||
post_build()
|
||||
exec('MACH_USE_SYSTEM_PYTHON=1 ./mach package')
|
||||
|
||||
## copy the artifact from obj-* to a friendlier location... to: /work
|
||||
version = sys.argv[1]
|
||||
_dirname = get_objdir()
|
||||
artifact = "{}/dist/librewolf-{}.en-US.linux-x86_64.tar.bz2".format(_dirname,version)
|
||||
enter_srcdir('/work')
|
||||
|
||||
enter_srcdir()
|
||||
cmd = "cp -v {} .".format(artifact)
|
||||
exec(cmd)
|
||||
leave_srcdir()
|
|
@ -1,3 +1,4 @@
|
|||
patches/xmas.patch
|
||||
patches/about-dialog.patch
|
||||
patches/allow-ubo-private-mode.patch
|
||||
patches/context-menu.patch
|
||||
|
|
43
patches/xmas.patch
Normal file
43
patches/xmas.patch
Normal file
|
@ -0,0 +1,43 @@
|
|||
diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in
|
||||
index 4d7a481..4daacdb 100644
|
||||
--- a/browser/installer/package-manifest.in
|
||||
+++ b/browser/installer/package-manifest.in
|
||||
@@ -282,6 +282,11 @@
|
||||
; gre location for now.
|
||||
@RESPATH@/defaults/pref/channel-prefs.js
|
||||
|
||||
+; LibreWolf specific files.
|
||||
+@RESPATH@/defaults/pref/local-settings.js
|
||||
+@RESPATH@/distribution/policies.json
|
||||
+@RESPATH@/librewolf.cfg
|
||||
+
|
||||
; Background tasks-specific preferences. These are in the GRE
|
||||
; location since they apply to all tasks at this time.
|
||||
#ifdef MOZ_BACKGROUNDTASKS
|
||||
diff --git a/lw/moz.build b/lw/moz.build
|
||||
index e69de29..8589aac 100644
|
||||
--- a/lw/moz.build
|
||||
+++ b/lw/moz.build
|
||||
@@ -0,0 +1,12 @@
|
||||
+FINAL_TARGET_FILES += [
|
||||
+ "librewolf.cfg",
|
||||
+]
|
||||
+
|
||||
+FINAL_TARGET_FILES.distribution += [
|
||||
+ "policies.json",
|
||||
+]
|
||||
+
|
||||
+# local-settings does not yet end up being pacakged.
|
||||
+FINAL_TARGET_FILES.defaults.pref += [
|
||||
+ "local-settings.js",
|
||||
+]
|
||||
diff --git a/moz.build b/moz.build
|
||||
index 41c9ad7..046e01b 100644
|
||||
--- a/moz.build
|
||||
+++ b/moz.build
|
||||
@@ -202,3 +202,5 @@ SPHINX_TREES["metrics"] = "docs/metrics"
|
||||
SPHINX_TREES["gtest"] = "docs/gtest"
|
||||
|
||||
include("build/templates.mozbuild")
|
||||
+
|
||||
+DIRS += ["lw"]
|
|
@ -1,5 +1,10 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
#
|
||||
# The script that patches the firefox source into the librewolf source.
|
||||
#
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
import optparse
|
||||
|
@ -7,17 +12,16 @@ import time
|
|||
import glob
|
||||
|
||||
|
||||
#
|
||||
# general functions, skip these, they are not that interesting
|
||||
#
|
||||
|
||||
start_time = time.time()
|
||||
|
||||
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option('-n', '--no-execute', dest='no_execute', default=False, action="store_true")
|
||||
parser.add_option('-P', '--no-settings-pane', dest='settings_pane', default=True, action="store_false")
|
||||
options, args = parser.parse_args()
|
||||
|
||||
#
|
||||
# general functions
|
||||
#
|
||||
|
||||
def script_exit(statuscode):
|
||||
if (time.time() - start_time) > 60:
|
||||
|
@ -75,10 +79,16 @@ def leave_srcdir():
|
|||
os.chdir("..")
|
||||
|
||||
|
||||
|
||||
#
|
||||
# This is the only interesting function in this script
|
||||
#
|
||||
|
||||
|
||||
def librewolf_patches():
|
||||
|
||||
enter_srcdir()
|
||||
|
||||
# create the right mozconfig file..
|
||||
exec('cp -v ../assets/mozconfig .')
|
||||
|
||||
|
@ -99,32 +109,43 @@ def librewolf_patches():
|
|||
|
||||
for p in patches:
|
||||
patch(p)
|
||||
|
||||
exec('mkdir -p lw-assets')
|
||||
|
||||
|
||||
#
|
||||
# Create the 'lw' folder, it contains the librewolf.cfg and policies.json files.
|
||||
#
|
||||
|
||||
exec('mkdir -p lw')
|
||||
|
||||
# insert the settings pane source (experimental)
|
||||
if options.settings_pane:
|
||||
|
||||
exec('rm -rf librewolf-pref-pane')
|
||||
exec('git clone https://gitlab.com/ohfp/librewolf-pref-pane.git')
|
||||
os.chdir('librewolf-pref-pane')
|
||||
exec('git diff 1fee314adc81000294fc0cf3196a758e4b64dace > ../lw-assets/librewolf-pref-pane.patch')
|
||||
os.chdir('..')
|
||||
patch('lw-assets/librewolf-pref-pane.patch')
|
||||
exec('rm -rf librewolf-pref-pane')
|
||||
|
||||
|
||||
# copy the build-librewolf.py script into the source folder
|
||||
exec('cp -v ../assets/build-librewolf.py lw-assets')
|
||||
exec('wget -q "https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py"')
|
||||
exec('mv -v bootstrap.py lw-assets')
|
||||
leave_srcdir()
|
||||
exec('rm -rf librewolf-pref-pane')
|
||||
exec('git clone https://gitlab.com/ohfp/librewolf-pref-pane.git')
|
||||
os.chdir('librewolf-pref-pane')
|
||||
exec('git diff 1fee314adc81000294fc0cf3196a758e4b64dace > ../lw/librewolf-pref-pane.patch')
|
||||
os.chdir('..')
|
||||
exec('rm -rf librewolf-pref-pane')
|
||||
|
||||
patch('lw/librewolf-pref-pane.patch')
|
||||
exec('rm -f lw/librewolf-pref-pane.patch')
|
||||
|
||||
|
||||
|
||||
##! This is the moment in time we grab the Settings repo HEAD revision
|
||||
exec('git clone https://gitlab.com/librewolf-community/settings.git')
|
||||
exec("cp -v settings/defaults/pref/local-settings.js lw/")
|
||||
exec("cp -v settings/distribution/policies.json lw/")
|
||||
exec("cp -v settings/librewolf.cfg lw/")
|
||||
exec('rm -rf settings')
|
||||
|
||||
# provide a script that fetches and bootstraps Nightly
|
||||
exec('cp -v ../scripts/mozfetch.sh lw')
|
||||
|
||||
leave_srcdir()
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Main functionality in this script..
|
||||
# Main functionality in this script.. which is to call librewolf_patches()
|
||||
#
|
||||
|
||||
if len(args) != 1:
|
7
scripts/mozfetch.sh
Executable file
7
scripts/mozfetch.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
rm -f bootstrap.py
|
||||
wget -q https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py
|
||||
python3 bootstrap.py --no-interactive --application-choice=browser
|
||||
rm -f bootstrap.py
|
Loading…
Reference in a new issue