diff --git a/.github/workflows/build-floorp.yml b/.github/workflows/build-floorp.yml new file mode 100644 index 00000000000000..40e2814f3b5d2b --- /dev/null +++ b/.github/workflows/build-floorp.yml @@ -0,0 +1,56 @@ +name: Build Floorp (from my void-packages fork) + +on: + workflow_dispatch: # Run manually from Actions tab + push: + branches: [ master, main ] + paths: + - 'srcpkgs/floorp/template' + - '.github/workflows/build-floorp.yml' + pull_request: + paths: + - 'srcpkgs/floorp/template' + +jobs: + build: + runs-on: ubuntu-latest + + # Use your own buildroot image (change if you use a different tag) + container: + image: ghcr.io/${{ github.repository_owner }}/void-buildroot-glibc:latest + + steps: + - name: Checkout your void-packages fork + uses: actions/checkout@v4 + + - name: Build Floorp package + working-directory: /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }} + run: | + # Use fakechroot (required in GitHub Actions containers) + echo 'XBPS_CHROOT_CMD=fakechroot' >> etc/xbps-src.conf + + # Bootstrap if needed (usually fast if image is good) + ./xbps-src binary-bootstrap || true + + # Build Floorp with maximum jobs + ./xbps-src -j$(nproc) pkg floorp + + - name: Collect built packages + run: | + mkdir -p ./artifacts + # Copy normal and debug packages + cp /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/hostdir/binpkgs/*/*.xbps ./artifacts/ 2>/dev/null || true + + - name: Upload Floorp .xbps artifacts + uses: actions/upload-artifact@v4 + with: + name: floorp-xbps-packages + path: ./artifacts/ + retention-days: 14 + + - name: Build summary + if: always() + run: | + echo "=== Built packages ===" + ls -lh /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/hostdir/binpkgs/*/*.xbps 2>/dev/null || echo "No .xbps files found" + echo "=== Build completed ===" diff --git a/srcpkgs/floorp/template b/srcpkgs/floorp/template new file mode 100644 index 00000000000000..77653147b86169 --- /dev/null +++ b/srcpkgs/floorp/template @@ -0,0 +1,318 @@ +# Template file for 'floorp' +pkgname=floorp +version=12.12.0 +revision=1 +archs="x86_64" +short_desc="Fast, customizable, privacy-focused Firefox-based browser (source build)" +maintainer="Your Name " +license="MPL-2.0" +homepage="https://floorp.app" + +# ── Source ──────────────────────────────────────────────────────────────────── +distfiles="https://github.com/Floorp-Projects/Floorp/releases/download/v${version}/floorp-linux-x86_64.tar.xz" +checksum="a6f61ad904e8229ca4e709a30d38f2a0e6926dc3f82ddbe24efb8e0c1ba51910" # run: xgensum -f srcpkgs/floorp/template + +# ── Build-time deps ─────────────────────────────────────────────────────────── +hostmakedepends=" + clang + lld + llvm + rust + cargo + cbindgen + python3 + nodejs + nasm + yasm + unzip + zip + pkg-config + autoconf + deno +" + +makedepends=" + gtk+3-devel + dbus-devel + libX11-devel + libXcomposite-devel + libXdamage-devel + libXext-devel + libXfixes-devel + libXrandr-devel + libXt-devel + alsa-lib-devel + nss-devel + nspr-devel + freetype-devel + fontconfig-devel + pango-devel + atk-devel + at-spi2-atk-devel + libdrm-devel + mesa-devel + libevent-devel + libvpx-devel + libwebp-devel + libpng-devel + libjpeg-turbo-devel + icu-devel + harfbuzz-devel + zlib-devel +" + +depends=" + dbus + gtk+3 + nss + nspr + alsa-lib + libX11 + libXcomposite + libXdamage + libXext + libXfixes + libXrandr + libXt + freetype + fontconfig + pango + atk + at-spi2-atk + libdrm + mesa-dri + desktop-file-utils + hicolor-icon-theme +" + +# ── Build system ────────────────────────────────────────────────────────────── +# Floorp 12 uses deno + feles-build as its build orchestrator on top of mach. +# We manually invoke mach here after writing the mozconfig for full control. + +do_configure() { + # Write the mozconfig that drives the Mozilla build system. + cat > ${wrksrc}/.mozconfig << EOF +# ── Application ────────────────────────────────────────────────────────────── +ac_add_options --enable-application=browser + +# ── Compiler — use Clang/LLD for best Mozilla-stack performance ─────────────── +# Clang produces measurably better Firefox/Floorp results than GCC on benchmarks. +export CC=clang +export CXX=clang++ +export AR=llvm-ar +export NM=llvm-nm +export RANLIB=llvm-ranlib +ac_add_options --enable-linker=lld + +# ── CPU target — tune for Zen+ (Ryzen 3 3250U = Zen+ microarch) ─────────────── +# -march=znver1 covers all Zen+ instructions safely. +# Using "native" would be more aggressive but prevents the binary from running +# on any other machine; znver1 is the safe portable choice for this CPU family. +export CFLAGS="-march=znver1 -mtune=znver1 -O2 -pipe" +export CXXFLAGS="-march=znver1 -mtune=znver1 -O2 -pipe" + +# Rust: target this CPU natively and use opt-level 3 (matches release builds) +export RUSTFLAGS="-C target-cpu=znver1 -C opt-level=3" +export RUSTC_OPT_LEVEL=2 # used by mach's own rust step + +# ── Link-Time Optimisation (LTO) ───────────────────────────────────────────── +# Thin LTO: noticeably faster than full LTO, still gives most of the gains. +# Full LTO requires 16+ GB RAM and many hours; thin LTO is the right tradeoff +# for a 4 GB build machine. +ac_add_options --enable-lto=thin + +# ── Profile-Guided Optimisation (PGO) ───────────────────────────────────────── +# PGO can improve runtime by ~15-20% on Firefox-family builds. +# It works by compiling an instrumented browser, running a training workload, +# then recompiling with the gathered profiles. +# Enable this when building in CI (where you have time); comment out for a +# quick local rebuild. +ac_add_options MOZ_PGO=1 + +# ── Release / strip ─────────────────────────────────────────────────────────── +ac_add_options --enable-release +ac_add_options --enable-strip +ac_add_options --enable-install-strip +ac_add_options --disable-debug +ac_add_options --disable-tests + +# ── Reduce binary / memory footprint ───────────────────────────────────────── +# Use system libraries where possible to reduce binary size and RAM usage +# (system libs are already in RAM, shared with other processes). +ac_add_options --with-system-nss +ac_add_options --with-system-nspr +ac_add_options --with-system-libevent +ac_add_options --with-system-libvpx +ac_add_options --with-system-webp +ac_add_options --with-system-jpeg +ac_add_options --with-system-png +ac_add_options --with-system-icu +ac_add_options --with-system-harfbuzz +ac_add_options --with-system-av1 + +# ── Wayland + X11 (keep both for the Ryzen iGPU / Void desktop variety) ────── +ac_add_options --enable-default-toolkit=cairo-gtk3-wayland-only +# Uncomment the line below instead if you ONLY use X11 (older DEs): +# ac_add_options --enable-default-toolkit=cairo-gtk3 + +# ── Disable features not needed on a low-end machine ───────────────────────── +ac_add_options --disable-crashreporter +ac_add_options --disable-updater +ac_add_options --disable-maintenance-service +ac_add_options --disable-backgroundtasks + +# ── Build dir ───────────────────────────────────────────────────────────────── +mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-floorp +mk_add_options MOZ_MAKE_FLAGS="-j${XBPS_MAKEJOBS}" +EOF +} + +do_build() { + # deno + feles-build orchestrates the Floorp-specific asset injection. + # Phase 1: build Floorp-specific JS/CSS assets (before mach) + deno task feles-build build --phase before-mach + + # Phase 2: run the Mozilla build system (./mach build) + ./mach build + + # Phase 3: inject Floorp UI patches after mach + deno task feles-build build --phase after-mach +} + +do_install() { + local appdir=/usr/lib/floorp + + # Let mach package the browser, then unpack it into DESTDIR + ./mach package + local pkg=$(ls obj-floorp/dist/floorp-*.tar.bz2 2>/dev/null | head -1) + if [ -z "$pkg" ]; then + # Fallback: directly install from the obj dir + vmkdir ${appdir} + vcopy obj-floorp/dist/floorp/\* ${appdir}/ + else + bsdtar -xf "$pkg" -C ${DESTDIR}/usr/lib/ + fi + + chmod 755 ${DESTDIR}/${appdir}/floorp + + # ── Wrapper script ──────────────────────────────────────────────────── + vmkdir usr/bin + cat > ${DESTDIR}/usr/bin/floorp << 'WRAPPER' +#!/bin/sh +# Floorp wrapper — Ryzen 3 3250U / Vega 3 low-end optimisations + +# ── Wayland (native; best with Mesa radeonsi on Vega 3) ─────────────────────── +# Comment out if you use an X11-only desktop. +export MOZ_ENABLE_WAYLAND=1 + +# ── VA-API hardware video decode via Mesa VAAPI (Vega 3 supports it) ────────── +# Enables hardware-accelerated video decoding — saves CPU on video sites. +export LIBVA_DRIVER_NAME=radeonsi +export MOZ_DISABLE_RDD_SANDBOX=1 + +# ── Misc ────────────────────────────────────────────────────────────────────── +export NO_AT_BRIDGE=1 # skip accessibility bus (~20 MB RAM) +export MOZ_DBUS_REMOTE=1 # single-instance enforcement + +exec /usr/lib/floorp/floorp "$@" +WRAPPER + chmod 755 ${DESTDIR}/usr/bin/floorp + + # ── Desktop entry ───────────────────────────────────────────────────── + vmkdir usr/share/applications + cat > ${DESTDIR}/usr/share/applications/floorp.desktop << 'EOF' +[Desktop Entry] +Version=1.0 +Name=Floorp +GenericName=Web Browser +Comment=Fast, customizable, privacy-focused web browser +Exec=floorp %u +Icon=floorp +Terminal=false +Type=Application +Categories=Network;WebBrowser; +MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https; +StartupNotify=true +StartupWMClass=floorp +Actions=new-window;new-private-window; + +[Desktop Action new-window] +Name=New Window +Exec=floorp --new-window + +[Desktop Action new-private-window] +Name=New Private Window +Exec=floorp --private-window +EOF + + # ── Icons ───────────────────────────────────────────────────────────── + for size in 16 32 48 64 128; do + local icondir="usr/share/icons/hicolor/${size}x${size}/apps" + vmkdir ${icondir} + if [ -f "${DESTDIR}/${appdir}/browser/chrome/icons/default/default${size}.png" ]; then + vinstall ${DESTDIR}/${appdir}/browser/chrome/icons/default/default${size}.png \ + 644 ${icondir} floorp.png + fi + done + + # ── Low-end user.js defaults ────────────────────────────────────────── + vmkdir ${appdir}/defaults/pref + cat > ${DESTDIR}/${appdir}/defaults/pref/lowend.js << 'EOF' +// Floorp low-end defaults — tuned for Ryzen 3 3250U + 4 GB RAM +// These apply to every new profile. Override in about:config as needed. + +// Limit content processes (biggest single RAM saving) +pref("dom.ipc.processCount", 2); // 1 saves more; 2 is smoother +pref("dom.ipc.processCount.webIsolated", 1); + +// Enable VA-API hardware video decode (Mesa radeonsi on Vega 3) +pref("media.ffmpeg.vaapi.enabled", true); +pref("media.hardware-video-decoding.force-enabled", true); + +// Reduce animation overhead +pref("ui.prefersReducedMotion", 1); +pref("toolkit.cosmeticAnimations.enabled", false); + +// No tab warming on a low-RAM machine +pref("browser.tabs.remote.warmup.enabled", false); +pref("browser.tabs.remote.warmup.maxTabs", 0); + +// Kill speculative network activity +pref("network.prefetch-next", false); +pref("network.dns.disablePrefetch", true); +pref("network.http.speculative-parallel-limit", 0); +pref("network.predictor.enabled", false); + +// Cache — favour disk, keep memory cache small +pref("browser.cache.disk.enable", true); +pref("browser.cache.memory.enable", true); +pref("browser.cache.memory.capacity", 32768); // 32 MB +pref("browser.cache.disk.capacity", 262144); // 256 MB + +// Session-restore +pref("browser.sessionstore.interval", 60000); +pref("browser.sessionstore.max_tabs_undo", 5); +pref("browser.sessionstore.max_windows_undo", 1); + +// Telemetry / privacy +pref("toolkit.telemetry.enabled", false); +pref("toolkit.telemetry.unified", false); +pref("datareporting.healthreport.uploadEnabled", false); +pref("datareporting.policy.dataSubmissionEnabled", false); +pref("breakpad.reportURL", ""); +pref("browser.crashReports.unsubmittedCheck.enabled", false); +pref("extensions.pocket.enabled", false); +pref("extensions.screenshots.disabled", true); +EOF +} + +post_install() { + update-desktop-database usr/share/applications 2>/dev/null || true + gtk-update-icon-cache -f -t usr/share/icons/hicolor 2>/dev/null || true + xbps-alternatives --group x-www-browser --add floorp:/usr/bin/floorp 2>/dev/null || true +} + +post_remove() { + update-desktop-database usr/share/applications 2>/dev/null || true + gtk-update-icon-cache -f -t usr/share/icons/hicolor 2>/dev/null || true +}