diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..94f480d --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a3c9d82 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM python:3.11-slim-bullseye + +WORKDIR /app + +# Copy the current directory contents into the container at /app +COPY . /app + +# Install necessary packages +RUN apt-get update && apt-get install -y \ + # Makefile utils + build-essential make git msitools wget unzip \ + # Camoufox build system utils + p7zip-full golang-go + +RUN make fetch && make mozbootstrap + +ENTRYPOINT ["python3", "./multibuild.py"] diff --git a/Makefile b/Makefile index d933424..0848672 100644 --- a/Makefile +++ b/Makefile @@ -4,16 +4,17 @@ export ff_source_dir := firefox-$(version) lw_source_dir := camoufox-$(version)-$(release) -debs := python3 python3-dev python3-pip p7zip-full golang-go -rpms := python3 python3-devel p7zip golang -pacman := python python-pip p7zip go +debs := python3 python3-dev python3-pip p7zip-full golang-go msitools wget +rpms := python3 python3-devel p7zip golang msitools wget +pacman := python python-pip p7zip go msitools wget -.PHONY: help fetch clean distclean build package build-launcher check-arch edits run bootstrap dir package-common package-linux package-macos package-windows +.PHONY: help fetch clean distclean build package build-launcher check-arch edits run bootstrap mozbootstrap dir package-common package-linux package-macos package-windows help: @echo "Available targets:" @echo " fetch - Clone Firefox source code" @echo " bootstrap - Set up build environment" + @echo " mozbootstrap - Sets up mach" @echo " dir - Prepare Camoufox source directory" @echo " edits - Camoufox developer UI" @echo " build-launcher - Build launcher" @@ -37,9 +38,12 @@ dir: cp -r $(ff_source_dir) $(lw_source_dir) python3 scripts/patch.py $(version) $(release) +mozbootstrap: + cd $(ff_source_dir) && MOZBUILD_STATE_PATH=$$HOME/.mozbuild ./mach --no-interactive bootstrap --application-choice=browser + bootstrap: dir (sudo apt-get -y install $(debs) || sudo dnf -y install $(rpms) || sudo pacman -Sy $(pacman)) - cd $(lw_source_dir) && MOZBUILD_STATE_PATH=$$HOME/.mozbuild ./mach --no-interactive bootstrap --application-choice=browser + make mozbootstrap clean: rm -rf $(lw_source_dir) diff --git a/README.md b/README.md index 151e456..7ddf5ec 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@

Camoufox

-

A stealthy, minimalistic Firefox fork for web scraping 🦊

+

A stealthy, minimalistic, custom build of Firefox for web scraping 🦊

-Camoufox aims to be a minimalistic browser that for robust fingerprint injection & anti-bot evasion. +Camoufox aims to be a minimalistic browser for robust fingerprint injection & anti-bot evasion.

@@ -22,6 +22,7 @@ Camoufox aims to be a minimalistic browser that for robust fingerprint injection - Full integration of Playwright's Juggler ✅ - Patches from LibreWolf & Ghostery to remove Mozilla services ✅ - Optimized for memory and speed ✅ +- Stays up to date with the latest Firefox version ⌚ #### What's planned? @@ -295,7 +296,9 @@ graph TD end ``` -### Build CLI +This was originally forked from the LibreWolf build system. + +## Build CLI > [!WARNING] > Camoufox's build system is designed to be used in Linux. WSL will not work! @@ -329,6 +332,49 @@ make package-windows arch=x86 make package-macos arch=amd64 ``` +### Using Docker + +Camoufox can be built through Docker on all platforms. + +1. Create the Docker image containing Firefox's source code: + +```bash +docker build -t camoufox-builder . +``` + +2. Build Camoufox patches to a target platform and architecture: + +```bash +docker run camoufox-builder --target --arch +# Asset files will be printed at the end +``` + +3. Download zip file assets: + +```bash +docker ps # Find container ID +docker cp :/app/.zip . +``` + +
+ +CLI Parameters + + +```bash +options: + -h, --help show this help message and exit + --target {linux,windows,macos} + Target platform for the build + --arch {x86_64,arm64,i686} + Target architecture for the build +``` + +
+ + +--- + ## Development Notes ### How to make a patch diff --git a/launcher/camoufox-launcher b/launcher/camoufox-launcher deleted file mode 100644 index c67e92d..0000000 Binary files a/launcher/camoufox-launcher and /dev/null differ diff --git a/multibuild.py b/multibuild.py index 3926fba..7b9edc7 100644 --- a/multibuild.py +++ b/multibuild.py @@ -49,7 +49,7 @@ class BSYS: return glob.glob(package_pattern) def clean(self): - exec('make veryclean') + exec('make clean') def main(): @@ -62,7 +62,7 @@ def main(): ) parser.add_argument("--bootstrap", action="store_true", help="Bootstrap the build system") parser.add_argument( - "--no-clean", action="store_true", help="Do not clean the build directory before starting" + "--clean", action="store_true", help="Clean the build directory before starting" ) args = parser.parse_args() @@ -72,7 +72,7 @@ def main(): if args.bootstrap: builder.bootstrap() # Clean if requested - if not args.no_clean: + if args.clean: builder.clean() # Run build builder.build() diff --git a/patches/window-hijacker.patch b/patches/viewport-hijacker.patch similarity index 100% rename from patches/window-hijacker.patch rename to patches/viewport-hijacker.patch diff --git a/scripts/generate-locales.sh b/scripts/generate-locales.sh index 7d3b29e..e5fa3bb 100644 --- a/scripts/generate-locales.sh +++ b/scripts/generate-locales.sh @@ -1,7 +1,7 @@ #!/usr/bin/bash if [ ! -f browser/locales/shipped-locales ]; then - echo "ERROR: Run this script from the root of the LibreWolf source code" + echo "ERROR: Run this script from the root of the Camoufox source code" exit 1 fi @@ -26,14 +26,14 @@ generate_locale() { echo_status "Downloading locale \"$1\"" wget -q -O browser/locales/l10n/$1.zip https://hg.mozilla.org/l10n-central/$1/archive/tip.zip echo_status "Extracting locale \"$1\"" - unzip -qo browser/locales/l10n/$1.zip -d browser/locales/l10n/ + 7z x -y -obrowser/locales/l10n browser/locales/l10n/$1.zip > /dev/null mv browser/locales/l10n/$1-*/ browser/locales/l10n/$1/ rm -f browser/locales/l10n/$1.zip echo_status "Generating locale \"$1\"" - mv browser/locales/l10n/$1/browser/branding/official browser/locales/l10n/$1/browser/branding/librewolf - find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Mozilla Firefox/LibreWolf/g' {} \; - find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Mozilla/LibreWolf/g' {} \; - find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Firefox/LibreWolf/g' {} \; + mv browser/locales/l10n/$1/browser/branding/official browser/locales/l10n/$1/browser/branding/camoufox + find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Mozilla Firefox/Camoufox/g' {} \; + find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Mozilla/Camoufox/g' {} \; + find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Firefox/Camoufox/g' {} \; echo_status "Done" sleep 0.3 echo_status @@ -46,4 +46,4 @@ done < browser/locales/shipped-locales wait -printf "\033[$(($N))A\rGenerated $total locales %-40s\n" +printf "\033[$(($N))A\rGenerated $total locales %-40s\n" \ No newline at end of file