176 lines
5.4 KiB
Makefile
176 lines
5.4 KiB
Makefile
include upstream.sh
|
|
export
|
|
|
|
of_source_dir := omegafox-$(version)-$(release)
|
|
ff_source_tarball := firefox-$(version).source.tar.xz
|
|
|
|
debs := python3 python3-dev python3-pip p7zip-full golang-go msitools wget aria2
|
|
rpms := python3 python3-devel p7zip golang msitools wget aria2
|
|
pacman := python python-pip p7zip go msitools wget aria2
|
|
|
|
.PHONY: help fetch setup setup-minimal clean set-target distclean build \
|
|
package check-arch revert edits run bootstrap mozbootstrap dir \
|
|
package-linux vcredist_arch patch unpatch workspace check-arg edit-cfg ff-dbg
|
|
|
|
help:
|
|
@echo "Available targets:"
|
|
@echo " fetch - Fetch the Firefox source code"
|
|
@echo " setup - Setup Omegafox & local git repo for development"
|
|
@echo " bootstrap - Set up build environment"
|
|
@echo " mozbootstrap - Sets up mach"
|
|
@echo " dir - Prepare Omegafox source directory with BUILD_TARGET"
|
|
@echo " revert - Kill all working changes"
|
|
@echo " edits - Omegafox developer UI"
|
|
@echo " clean - Remove build artifacts"
|
|
@echo " distclean - Remove everything including downloads"
|
|
@echo " build - Build Omegafox"
|
|
@echo " set-target - Change the build target with BUILD_TARGET"
|
|
@echo " package-linux - Package Omegafox for Linux"
|
|
@echo " run - Run Omegafox"
|
|
@echo " edit-cfg - Edit omegafox.cfg"
|
|
@echo " ff-dbg - Setup vanilla Firefox with minimal patches"
|
|
@echo " patch - Apply a patch"
|
|
@echo " unpatch - Remove a patch"
|
|
@echo " workspace - Sets the workspace to a patch, assuming its applied"
|
|
|
|
_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
|
|
$(eval $(_ARGS):;@:)
|
|
|
|
fetch:
|
|
# Fetching the Firefox source tarball...
|
|
aria2c -x16 -s16 -k1M -o $(ff_source_tarball) "https://archive.mozilla.org/pub/firefox/releases/$(version)/source/firefox-$(version).source.tar.xz"; \
|
|
|
|
setup-minimal:
|
|
if [ ! -f $(ff_source_tarball) ]; then \
|
|
make fetch; \
|
|
fi
|
|
# Create new of_source_dir
|
|
rm -rf $(of_source_dir)
|
|
mkdir -p $(of_source_dir)
|
|
tar -xJf $(ff_source_tarball) -C $(of_source_dir) --strip-components=1
|
|
# Copy settings & additions
|
|
cd $(of_source_dir) && bash ../scripts/copy-additions.sh $(version) $(release)
|
|
|
|
setup: setup-minimal
|
|
# Initialize local git repo for development
|
|
cd $(of_source_dir) && \
|
|
git init -b main && \
|
|
git add -f -A && \
|
|
git commit -m "Initial commit" && \
|
|
git tag -a unpatched -m "Initial commit"
|
|
|
|
ff-dbg: setup
|
|
# Only apply patches to help debug vanilla Firefox
|
|
make patch ./patches/chromeutil.patch
|
|
make patch ./patches/browser-init.patch
|
|
echo "LOCAL_INCLUDES += ['/omegacfg']" >> $(of_source_dir)/dom/base/moz.build
|
|
touch $(of_source_dir)/_READY
|
|
make checkpoint
|
|
make build
|
|
|
|
revert:
|
|
cd $(of_source_dir) && git reset --hard unpatched
|
|
|
|
dir:
|
|
@if [ ! -d $(of_source_dir) ]; then \
|
|
make setup; \
|
|
fi
|
|
python3 scripts/patch.py $(version) $(release)
|
|
touch $(of_source_dir)/_READY
|
|
|
|
set-target:
|
|
python3 scripts/patch.py $(version) $(release) --mozconfig-only
|
|
|
|
mozbootstrap:
|
|
cd $(of_source_dir) && MOZBUILD_STATE_PATH=$$HOME/.mozbuild ./mach --no-interactive bootstrap --application-choice=browser
|
|
|
|
bootstrap: mozbootstrap
|
|
|
|
diff:
|
|
@cd $(of_source_dir) && git diff $(_ARGS)
|
|
|
|
checkpoint:
|
|
cd $(of_source_dir) && git commit -m "Checkpoint" -a -uno
|
|
|
|
clean:
|
|
cd $(of_source_dir) && git clean -fdx && ./mach clobber
|
|
make revert
|
|
|
|
distclean:
|
|
rm -rf $(of_source_dir) $(ff_source_tarball)
|
|
|
|
build: unbusy
|
|
@if [ ! -f $(of_source_dir)/_READY ]; then \
|
|
make dir; \
|
|
fi
|
|
cd $(of_source_dir) && ./mach build $(_ARGS)
|
|
|
|
edits:
|
|
python3 ./scripts/developer.py $(version) $(release)
|
|
|
|
check-arch:
|
|
@if ! echo "x86_64 i686 arm64" | grep -qw "$(arch)"; then \
|
|
echo "Error: Invalid arch value. Must be x86_64, i686, or arm64."; \
|
|
exit 1; \
|
|
fi
|
|
|
|
package-linux:
|
|
python3 scripts/package.py linux \
|
|
--includes \
|
|
settings/properties.json \
|
|
bundle/fontconfigs \
|
|
--version $(version) \
|
|
--release $(release) \
|
|
--arch $(arch) \
|
|
--fonts linux
|
|
|
|
run:
|
|
cd $(of_source_dir) \
|
|
&& rm -rf ~/.omegafox obj-x86_64-pc-linux-gnu/tmp/profile-default \
|
|
&& CAMOU_CONFIG=$${CAMOU_CONFIG:-'{}'} \
|
|
&& CAMOU_CONFIG="$${CAMOU_CONFIG%?}, \"debug\": true}" ./mach run $(args)
|
|
|
|
edit-cfg:
|
|
@if [ ! -f $(of_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/omegafox.cfg ]; then \
|
|
echo "Error: omegafox.cfg not found. Apply config.patch first."; \
|
|
exit 1; \
|
|
fi
|
|
$(EDITOR) $(of_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/omegafox.cfg
|
|
|
|
check-arg:
|
|
@if [ -z "$(_ARGS)" ]; then \
|
|
echo "Error: No file specified. Usage: make <command> ./patches/file.patch"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
grep:
|
|
grep "$(_ARGS)" -r ./patches/*.patch
|
|
|
|
patch:
|
|
@make check-arg $(_ARGS);
|
|
cd $(of_source_dir) && patch -p1 -i ../$(_ARGS)
|
|
|
|
unpatch:
|
|
@make check-arg $(_ARGS);
|
|
cd $(of_source_dir) && patch -p1 -R -i ../$(_ARGS)
|
|
|
|
workspace:
|
|
@make check-arg $(_ARGS);
|
|
@if (cd $(of_source_dir) && patch -p1 -R --dry-run --force -i ../$(_ARGS)) > /dev/null 2>&1; then \
|
|
echo "Patch is already applied. Unapplying..."; \
|
|
make unpatch $(_ARGS); \
|
|
else \
|
|
echo "Patch is not applied. Proceeding with application..."; \
|
|
fi
|
|
make checkpoint || true
|
|
make patch $(_ARGS)
|
|
|
|
unbusy:
|
|
rm -rf $(of_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/omegafox-bin \
|
|
$(of_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/omegafox \
|
|
$(of_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/launch
|
|
|
|
path:
|
|
@realpath $(of_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/omegafox-bin
|
|
|
|
vcredist_arch := $(shell echo $(arch) | sed 's/x86_64/x64/' | sed 's/i686/x86/')
|