0
Fork 0
mirror of https://codeberg.org/librewolf/source.git synced 2024-12-22 05:33:03 -05:00

Implemented ./release file (for triggering CI when Settings changes)

This commit is contained in:
Bert van der Weerd 2021-12-29 06:05:25 +01:00
parent a0119f4bec
commit 390948efe3
No known key found for this signature in database
GPG key ID: 4CFABB96ADE0F5B1
5 changed files with 117 additions and 23 deletions

View file

@ -1,40 +1,44 @@
.PHONY : all help clean veryclean librewolf-patches check librewolf
version_file=./version
version:=$(shell cat $(version_file))
version:=$(shell cat ./version)
release:=$(shell cat ./release)
## simplistic archive format selection
archive_create=tar cfJ
ext=.tar.xz
#archive_create=tar cfJ
#ext=.tar.xz
archive_create=tar cfz
ext=.tar.gz
#archive_create=zip -r9
#ext=.zip
help :
help : README.md
@echo "use: make [all] [check] [clean] [veryclean]"
@echo ""
@echo " all - Make librewolf source archive ${version}."
@echo " all - Make librewolf source archive ${version}-${release}."
@echo " check - Check if there is a new version of Firefox."
@echo ""
@echo " clean - Clean everything except the upstream firefox tarball."
@echo " veryclean - Clean everything and the firefox tarball."
@echo " librewolf - like 'make all' but after that extract and build it."
@echo ""
check :
check : README.md
@python3 scripts/update-version.py
all : librewolf-$(version).source$(ext)
all : librewolf-$(version)-$(release).source$(ext) README.md
clean :
rm -rf *~ firefox-$(version) librewolf-$(version) librewolf-$(version).source$(ext)
rm -rf *~ firefox-$(version) librewolf-$(version) librewolf-$(version)-$(release).source$(ext)
veryclean : clean
@ -46,19 +50,23 @@ firefox-$(version).source.tar.xz :
wget -q https://archive.mozilla.org/pub/firefox/releases/$(version)/source/firefox-$(version).source.tar.xz
librewolf-$(version).source$(ext) : firefox-$(version).source.tar.xz $(version_file) scripts/librewolf-patches.py assets/mozconfig assets/patches.txt
librewolf-$(version)-$(release).source$(ext) : firefox-$(version).source.tar.xz ./version ./release scripts/librewolf-patches.py assets/mozconfig assets/patches.txt
rm -rf firefox-$(version) librewolf-$(version)
tar xf firefox-$(version).source.tar.xz
mv firefox-$(version) librewolf-$(version)
python3 scripts/librewolf-patches.py $(version)
rm -f librewolf-$(version).source$(ext)
$(archive_create) librewolf-$(version).source$(ext) librewolf-$(version)
rm -f librewolf-$(version)-$(release).source$(ext)
$(archive_create) librewolf-$(version)-$(release).source$(ext) librewolf-$(version)
rm -rf librewolf-$(version)
librewolf-$(version) : librewolf-$(version).source$(ext)
tar xf librewolf-$(version).source$(ext)
librewolf-$(version) : librewolf-$(version)-$(release).source$(ext)
tar xf librewolf-$(version)-$(release).source$(ext)
librewolf : librewolf-$(version)
(cd librewolf-$(version) && ./mach build && ./mach package)
README.md : README.md.in ./version ./release
sed "s/__VERSION__/$(version)/g" < $< > tmp
sed "s/__RELEASE__/$(release)/g" < tmp > $@
rm -f tmp

View file

@ -1,12 +1,11 @@
## Building LibreWolf from source:
First, let's **[download the latest tarball](https://gitlab.com/librewolf-community/browser/source/-/jobs/artifacts/main/raw/librewolf-95.0.2.source.tar.gz?job=build-job)**. This tarball is the latest produced by the CI.
First, let's **[download the latest tarball](https://gitlab.com/librewolf-community/browser/source/-/jobs/artifacts/main/raw/librewolf-95.0.2-1.source.tar.gz?job=build-job)**. This tarball is the latest produced by the CI.
To download the latest from a script, use wget/curl like this:
```
export version=95.0.2 # example
wget -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
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
wget -O librewolf-95.0.2-1.source.tar.gz https://gitlab.com/librewolf-community/browser/source/-/jobs/artifacts/main/raw/librewolf-95.0.2-1.source.tar.gz?job=build-job
curl -L -o librewolf-95.0.2-1.source.tar.gz https://gitlab.com/librewolf-community/browser/source/-/jobs/artifacts/main/raw/librewolf-95.0.2-1.source.tar.gz?job=build-job
```
Next, we create ourselves a build folder and extract the tarball.
@ -14,7 +13,7 @@ Next, we create ourselves a build folder and extract the tarball.
```
mkdir build
cd build
tar xf ../librewolf-$(version).source.tar.gz
tar xf ../librewolf-$(version)-$(release).source.tar.gz
```
Next step, if you have not done so already, you must create the build environment:
```
@ -38,7 +37,7 @@ Or make a package:
## [dev info] How to use this repo instead of [Common](https://gitlab.com/librewolf-community/browser/common):
Since the dawn of time, we have used Common to get _patches_, _source_files_, including _source_files/{branding}_
Since the dawn of time, we have used **Common** to get _patches_, _source_files_, including _source_files/{branding}_
This source repo supports all that, because it uses these same things to produce the tarball. As far as I can tell, the mapping from Common to Source would be:
@ -69,7 +68,9 @@ 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
git commit -am v$(cat version)-$(cat release) && git push
# or use this, which does the same as above:
make trigger-ci
```
To build the source archive:
```

83
README.md.in Normal file
View file

@ -0,0 +1,83 @@
## Building LibreWolf from source:
First, let's **[download the latest tarball](https://gitlab.com/librewolf-community/browser/source/-/jobs/artifacts/main/raw/librewolf-__VERSION__-__RELEASE__.source.tar.gz?job=build-job)**. This tarball is the latest produced by the CI.
To download the latest from a script, use wget/curl like this:
```
wget -O librewolf-__VERSION__-__RELEASE__.source.tar.gz https://gitlab.com/librewolf-community/browser/source/-/jobs/artifacts/main/raw/librewolf-__VERSION__-__RELEASE__.source.tar.gz?job=build-job
curl -L -o librewolf-__VERSION__-__RELEASE__.source.tar.gz https://gitlab.com/librewolf-community/browser/source/-/jobs/artifacts/main/raw/librewolf-__VERSION__-__RELEASE__.source.tar.gz?job=build-job
```
Next, we create ourselves a build folder and extract the tarball.
```
mkdir build
cd build
tar xf ../librewolf-$(version)-$(release).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
```
## [dev info] How to use this repo instead of [Common](https://gitlab.com/librewolf-community/browser/common):
Since the dawn of time, we have used **Common** to get _patches_, _source_files_, including _source_files/{branding}_
This source repo supports all that, because it uses these same things to produce the tarball. As far as I can tell, the mapping from Common to Source would be:
* _[patches](https://gitlab.com/librewolf-community/browser/common/-/tree/master/patches)_ -> _[patches](https://gitlab.com/librewolf-community/browser/source/-/tree/main/patches)_
* _[source\_files](https://gitlab.com/librewolf-community/browser/common/-/tree/master/source_files)/search-config.json_ -> _[assets](https://gitlab.com/librewolf-community/browser/source/-/tree/main/assets)/search-config.json_
* _source\_files/browser/[branding](https://gitlab.com/librewolf-community/browser/common/-/tree/master/source_files/browser/branding)/librewolf_ -> _themes/browser/[branding](https://gitlab.com/librewolf-community/browser/source/-/tree/main/themes/browser/branding)/librewolf_
With this mapping, I hope that other builders that can't use our tarball (afterMozilla project, weird distro's), still use the same source/patches as the builders that do use it.
### Another feature
The file [assets/patches.txt](https://gitlab.com/librewolf-community/browser/source/-/blob/main/assets/patches.txt) defines what patches go in. These are not the only patches a builder will use, weird distro's etc, will use additional patches. those patches can live in the repo of that distro, or in a subfolder here. I hope this gives everybody the freedom to build anyway they please, like in Common, but with the added benefit that we produce a source tarball.
## [dev info] Building the 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)-$(cat release) && git push
# or use this, which does the same as above:
make trigger-ci
```
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
release Normal file
View file

@ -0,0 +1 @@
1

View file

@ -91,6 +91,7 @@ if s != base_version:
with open('./version', 'w') as f:
f.write(s)
exec('echo 1 > release')
else:
print('Latest Firefox release is still {}.'.format(base_version))