0
Fork 0
mirror of https://codeberg.org/librewolf/source.git synced 2024-12-21 21:23:08 -05:00
LibreWolf/Makefile

248 lines
7 KiB
Makefile
Raw Permalink Normal View History

2022-12-14 06:10:43 -05:00
docker_targets=docker-build-image docker-run-build-job docker-remove-image
2023-08-17 12:56:16 -05:00
woodpecker_targets=fetch-upstream-woodpecker check-patchfail-woodpecker
testing_targets=full-test test test-linux test-macos test-windows
.PHONY : help moztree check all clean veryclean distclean patches dir bootstrap fetch build package run update setup-wasi check-patchfail check-fuzz fixfuzz $(docker_targets) $(woodpecker_targets) $(testing_targets)
2021-11-19 12:41:54 -05:00
version:=$(shell cat ./version)
release:=$(shell cat ./release)
2021-11-19 12:41:54 -05:00
2021-11-19 14:46:23 -05:00
## simplistic archive format selection
#archive_create=tar cfJ
#ext=.tar.xz
archive_create:=tar cfz
ext:=.tar.gz
2021-11-19 14:46:23 -05:00
ff_source_dir:=firefox-$(version)
ff_source_tarball:=firefox-$(version).source.tar.xz
2021-11-19 14:46:23 -05:00
lw_source_dir:=librewolf-$(version)-$(release)
lw_source_tarball:=librewolf-$(version)-$(release).source$(ext)
help :
2021-12-27 18:55:58 -05:00
@echo "use: $(MAKE) [all] [check] [clean] [veryclean] [bootstrap] [build] [package] [run]"
2021-11-19 12:41:54 -05:00
@echo ""
2022-01-13 14:34:48 -05:00
@echo " all - Make LibreWolf source archive ${version}-${release}."
@echo ""
@echo " check - Check if there is a new version of Firefox."
2022-05-04 09:29:37 -05:00
@echo " update - Update the git submodules."
2021-11-19 12:41:54 -05:00
@echo ""
@echo " clean - Clean everything except the upstream firefox tarball."
@echo " veryclean - Clean everything including the firefox tarball."
@echo ""
@echo " bootstrap - Bootstrap the build environment."
2022-02-09 07:04:18 -05:00
@echo " setup-wasi - Setup WASM sandbox libraries (required on Linux)."
2022-01-13 14:34:48 -05:00
@echo ""
@echo " fetch - fetch Firefox source archive."
@echo " dir - extract Firefox and apply the patches, creating a"
@echo " ready to build librewolf folder."
2022-02-09 07:04:18 -05:00
@echo " build - Build LibreWolf (requires bootstrapped build environment)."
@echo " package - Package LibreWolf (requires build)."
@echo " run - Run LibreWolf (requires build)."
@echo ""
2022-06-01 13:15:40 -05:00
@echo " check-patchfail - check patches for errors."
@echo " check-fuzz - check patches for fuzz."
@echo " fixfuz - fix the fuzz."
@echo ""
@echo ""
2022-12-14 06:10:43 -05:00
@echo "docker:" $(docker_targets)
@echo ""
@echo ""
@echo "Maintainer commands:"
@echo ""
@echo " patches - Just make the LibreWolf source directory (download, extract, patch)"
@echo " all - build LW tarball"
@echo ""
@echo " clean - remove all cruft except LW source tree"
@echo " veryclean - remove all except download FF tarball"
@echo " distclean - remove all including downloads"
@echo ""
@echo " moztree - show LW source tree"
@echo " check - checking for new versions of FF"
@echo " update - update settings submodule"
@echo ""
moztree :
(cd $(lw_source_dir) && ../scripts/moztree )
patches :
make veryclean
make dir
# building...
all : $(lw_source_tarball)
# cleaning up..
clean :
rm -rf *~ public_key.asc $(ff_source_dir) $(lw_source_tarball) $(lw_source_tarball).sha256sum $(lw_source_tarball).sha512sum firefox-$(version) patchfail.out patchfail-fuzz.out
veryclean : clean
rm -rf $(lw_source_dir)
distclean : veryclean
rm -f $(ff_source_tarball) $(ff_source_tarball).asc
# checking for new versions...
2021-11-19 12:41:54 -05:00
2022-05-04 09:29:37 -05:00
check :
2023-11-14 14:13:39 -05:00
-bash -c ./scripts/update-settings-module.sh
python3 scripts/update-version.py
2022-09-22 08:35:15 -05:00
cut -f1 version > version.tmp
mv -vf version.tmp version
@echo ""
@echo "Firefox version : " $$(cat version)
@echo "LibreWolf release : " $$(cat release)
@echo ""
2021-11-19 12:41:54 -05:00
2022-01-08 16:07:06 -05:00
# update settings submodule...
2021-11-19 14:46:23 -05:00
update :
-bash -c ./scripts/update-settings-module.sh
2021-11-19 14:46:23 -05:00
2022-02-05 17:27:42 -05:00
#
# The actual build stuff
#
fetch : $(ff_source_tarball)
2021-11-19 14:46:23 -05:00
$(ff_source_tarball) :
wget -qO public_key.asc "https://keys.openpgp.org/vks/v1/by-fingerprint/14F26682D0916CDD81E37B6D61B7B526D98F0353"
gpg --import public_key.asc
rm -f public_key.asc
wget -q "https://archive.mozilla.org/pub/firefox/releases/$(version)/source/firefox-$(version).source.tar.xz.asc" -O $(ff_source_tarball).asc
wget -q "https://archive.mozilla.org/pub/firefox/releases/$(version)/source/firefox-$(version).source.tar.xz" -O $(ff_source_tarball)
gpg --verify $(ff_source_tarball).asc $(ff_source_tarball)
$(lw_source_dir) : $(ff_source_tarball) ./version ./release scripts/librewolf-patches.py assets/mozconfig assets/patches.txt
rm -rf $(ff_source_dir) $(lw_source_dir)
tar xf $(ff_source_tarball)
mv $(ff_source_dir) $(lw_source_dir)
python3 scripts/librewolf-patches.py $(version) $(release)
2021-11-21 04:23:21 -05:00
$(lw_source_tarball) : $(lw_source_dir)
rm -f $(lw_source_tarball)
2023-08-17 12:56:16 -05:00
tar cf librewolf-$(version)-$(release).source.tar $(lw_source_dir)
pigz -6 librewolf-$(version)-$(release).source.tar
2022-02-05 17:27:42 -05:00
touch $(lw_source_dir)
sha256sum $(lw_source_tarball) > $(lw_source_tarball).sha256sum
cat $(lw_source_tarball).sha256sum
2023-08-17 12:56:16 -05:00
sha256sum -c $(lw_source_tarball).sha256sum
2023-11-02 07:08:07 -05:00
sha512sum $(lw_source_tarball) > $(lw_source_tarball).sha512sum
cat $(lw_source_tarball).sha512sum
sha512sum -c $(lw_source_tarball).sha512sum
2022-05-16 07:39:47 -05:00
[ "$(SIGNING_KEY)" != "" ] && cp -v $(SIGNING_KEY) pk.asc ; true
if [ -f pk.asc ]; then gpg --import pk.asc; gpg --detach-sign $(lw_source_tarball) && ls -lh $(lw_source_tarball).sig; fi
2023-08-17 12:56:16 -05:00
ls -lh $(lw_source_tarball)*
2022-02-05 17:27:42 -05:00
2021-11-25 10:24:55 -05:00
2022-02-03 05:20:10 -05:00
debs=python3 python3-dev python3-pip
rpms=python3 python3-devel
bootstrap : $(lw_source_dir)
(sudo apt-get -y install $(debs); true)
2022-02-03 05:20:10 -05:00
(sudo rpm -y install $(rpms); true)
(cd $(lw_source_dir) && MOZBUILD_STATE_PATH=$$HOME/.mozbuild ./mach --no-interactive bootstrap --application-choice=browser)
2022-02-09 07:04:18 -05:00
setup-wasi :
./scripts/setup-wasi-linux.sh
2022-02-05 17:27:42 -05:00
dir : $(lw_source_dir)
2022-02-05 17:27:42 -05:00
build : $(lw_source_dir)
(cd $(lw_source_dir) && ./mach build)
2022-01-13 14:34:48 -05:00
package :
2022-05-03 15:53:46 -05:00
(cd $(lw_source_dir) && cat browser/locales/shipped-locales | xargs ./mach package-multi-locale --locales)
cp -v $(lw_source_dir)/obj-*/dist/librewolf-$(version)-$(release).en-US.*.tar.bz2 .
2022-01-13 14:34:48 -05:00
run :
(cd $(lw_source_dir) && ./mach run)
2022-06-01 13:15:40 -05:00
2023-08-17 12:56:16 -05:00
2022-06-01 13:15:40 -05:00
check-patchfail:
sh -c "./scripts/check-patchfail.sh" > patchfail.out
2023-08-17 12:56:16 -05:00
2022-06-01 13:15:40 -05:00
check-fuzz:
-sh -c "./scripts/check-patchfail.sh --fuzz=0" > patchfail-fuzz.out
fixfuzz :
sh -c "./scripts/fuzzfail.sh"
2022-12-14 06:10:43 -05:00
#
# docker
#
build_image=librewolf-build-image
docker-build-image :
2022-12-14 06:14:47 -05:00
docker build --no-cache -t $(build_image) - < assets/Dockerfile
2022-12-14 06:10:43 -05:00
docker-run-build-job :
docker run -v $$(pwd):/output --rm $(build_image) sh -c "git pull && make fetch && make build package && cp -v ./*.bz2 /output"
2022-12-14 06:10:43 -05:00
docker-remove-image :
docker rmi $(build_image)
setup-debian :
apt-get -y install mercurial python3 python3-dev python3-pip curl wget dpkg-sig libssl-dev zstd libxml2-dev
setup-fedora :
dnf -y install python3 curl wget zstd python3-devel python3-pip mercurial openssl-devel libxml2-devel
2023-08-17 12:56:16 -05:00
#
# for .woodpecker.yml
#
check-patchfail-woodpecker :
( sh -c "./scripts/check-patchfail.sh" > patchfail.out ; exit_code=$$? ; \
cat patchfail.out ; rm -f patchfail.out ; exit $$exit_code )
fetch-upstream-woodpecker : fetch
2023-11-04 05:34:24 -05:00
#
# testing_targets=full-test test
#
test : full-test
# full-test: produce the bz2 artifact using bsys6 from scratch
full-test : $(lw_source_tarball)
${MAKE} -f assets/testing.mk bsys6_x86_64_linux_bz2_artifact
test-linux : full-test
test-macos : $(lw_source_tarball)
${MAKE} -f assets/testing.mk bsys6_x86_64_macos_dmg_artifact
test-windows : $(lw_source_tarball)
${MAKE} -f assets/testing.mk bsys6_x86_64_windows_zip_artifact