diff options
author | Hanketsu <hanketsu@egregore.fun> | 2024-10-26 18:02:15 +0200 |
---|---|---|
committer | Hanketsu <hanketsu@egregore.fun> | 2025-06-13 00:04:36 +0200 |
commit | 03838f85acb9f5055f525b7c849a0bfdbb6442c2 (patch) | |
tree | ce8043e554e2b0ced28190bb601e9af446872e5e | |
parent | 447bccbfa2951fa748a161969a2c146337ae42e5 (diff) |
battering: Add palemoon.
* battering/packages/palemoon.scm (make-palemoon): New procedure.
* battering/packages/palemoon.scm (palemoon): New variable.
-rw-r--r-- | battering/packages/palemoon.scm | 226 | ||||
-rw-r--r-- | battering/packages/patches/palemoon-vendor-basename.patch | 19 |
2 files changed, 245 insertions, 0 deletions
diff --git a/battering/packages/palemoon.scm b/battering/packages/palemoon.scm new file mode 100644 index 0000000..65d1749 --- /dev/null +++ b/battering/packages/palemoon.scm @@ -0,0 +1,226 @@ +;; -*- fill-column: 120 -*- +(define-module (battering packages palemoon) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module (guix gexp) + #:use-module (guix git-download) + #:use-module (guix build-system mozilla) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (ice-9 string-fun) + #:use-module (gnu packages) + #:use-module (gnu packages assembly) + #:use-module (gnu packages autotools) + #:use-module (gnu packages base) + #:use-module (gnu packages bash) + #:use-module (gnu packages crypto) + #:use-module (gnu packages compression) + #:use-module (gnu packages freedesktop) + #:use-module (gnu packages gl) + #:use-module (gnu packages glib) + #:use-module (gnu packages gnome) + #:use-module (gnu packages gtk) + #:use-module (gnu packages linux) + #:use-module (gnu packages m4) + #:use-module (gnu packages nss) + #:use-module (gnu packages perl) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages pulseaudio) + #:use-module (gnu packages python) + #:use-module (gnu packages sqlite) + #:use-module (gnu packages tls) + #:use-module (gnu packages video) + #:use-module (gnu packages xorg)) + + +(define* (make-palemoon #:key + (with-gtk3? #f) + (moz-app-name "moonchild_productions")) + (package + (name "palemoon") + (version "33.4.0.1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://repo.palemoon.org/MoonchildProductions/Pale-Moon.git") + (commit (string-append version "_Release")) + (recursive? #t))) + (file-name (git-file-name name version)) + (sha256 + (base32 "16h25qfvirsan8rr7rk6b4hyvn7w1gb0y9wlsxjpzqac6kl2s98c")) + (patches + (parameterize + ((%patch-path + (map (lambda (directory) + (string-append directory "/battering/packages/patches")) + %load-path))) + (search-patches "palemoon-vendor-basename.patch"))))) + (build-system mozilla-build-system) + (native-inputs + (list autoconf + libxcrypt + m4 + perl + pkg-config + python-2.7 + tar + unzip + which + yasm + zip)) + (inputs + (list bash-minimal + (if with-gtk3? + gtk+ + gtk+-2) + glib + dbus-glib + libdbusmenu + desktop-file-utils + libaom + libxt + openssl + sqlite + alsa-lib + pulseaudio + ffmpeg + mesa + gconf)) + (arguments + (let* ((gtk-version (if with-gtk3? "gtk3" "gtk2")) + (distdir + (format #f "obj-~a/dist" + (string-replace-substring + (or (%current-target-system) + %host-type) + "unknown" + "pc"))) + (dist-tarball + (format #f "~a/~a-~a.~a-~a.tar.xz" + distdir + name + version + (string-join + (reverse + (string-split + (or (%current-target-system) + (%current-system)) #\-)) "-") + gtk-version)) + (dist-branding + (format #f "~a/branding" distdir))) + (list #:tests? #f + #:configure-flags #~(list #$(string-append "--enable-application=" name) + "--enable-appcompat-guid" + "--enable-av1" + #$(string-append "--enable-default-toolkit=cairo-" gtk-version) + "--enable-devtools" + "--enable-jemalloc" + "--enable-jxl" + "--enable-more-deterministic" + "--enable-necko-wifi" + "--enable-official-branding" ;; Official branding. + "--enable-optimize=\"-O2 -w\"" + "--enable-strip" + "--enable-system-ffi" + "--enable-system-pixman" + "--disable-debug" + "--disable-debug-symbols" + "--disable-elf-hack" + "--disable-gamepad" + "--disable-gold" + "--disable-tests" + "--disable-updater" + "--disable-webrtc" + ;; "--with-gl-provider=EGL" + "--with-pthreads" + "--with-x" + #$(string-append "--with-user-appdir=" moz-app-name) + ;; Avoid bundled libraries. + ;; UNBUNDLE-ME! "--enable-system-sqlite" + ;; UNBUNDLE-ME! "--with-system-bz2" + ;; UNBUNDLE-ME! "--with-system-graphite2" + ;; UNBUNDLE-ME! "--with-system-harfbuzz" + ;; UNBUNDLE-ME! "--with-system-libevent" + ;; UNBUNDLE-ME! "--with-system-libvpx" + ;; UNBUNDLE-ME! "--with-system-nss" ; pending upgrade of 'nss' to 3.90 + ;; UNBUNDLE-ME! "--with-system-ogg" + ;; UNBUNDLE-ME! "--with-system-theora" ; wants theora-1.2, not yet released + ;; UNBUNDLE-ME! "--with-system-vorbis" + ;; UNBUNDLE-ME! "--with-system-jpeg" ;must be libjpeg-turbo + ;; UNBUNDLE-ME! "--with-system-zlib" + ;; UNBUNDLE-ME! "--with-system-icu" + ;; UNBUNDLE-ME! "--with-system-png" ;must be libpng-apng + #$(if with-gtk3? ;; NPAPI requires gtk2. It's for Adobe Flash and Silverlight. + "--disable-npapi" + "--enable-npapi") + #$(if with-gtk3? ;; TODO: find a way to link atk_bridge_adaptor_init + "--disable-accessibility" + "--enable-accessibility")) + #:phases + #~(modify-phases %standard-phases + (add-after 'patch-source-shebangs 'patch-configure-in + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "./configure.in" ;; Doesn't get patched automatically. Why ? This eludes me. + (("^#!/bin/sh") (format #f "#!~a" (search-input-file inputs "bin/sh")))))) + (add-before 'configure 'setenv + (lambda* (#:key inputs #:allow-other-keys) + (setenv "LDFLAGS" (string-append "-Wl,-rpath=" #$output "/lib/" #$name)) + (setenv "SHELL" (search-input-file inputs "/bin/bash")) + (setenv "CONFIG_SHELL" (search-input-file inputs "/bin/bash")) + (setenv "MOZILLA_OFFICIAL" "1") ;; Official branding + (setenv "MOZ_PKG_SPECIAL" #$gtk-version) + (setenv "MOZ_NOSPAM" "1"))) + (add-before 'configure 'mozconfig + (lambda* (#:key configure-flags #:allow-other-keys) + (call-with-output-file ".mozconfig" + (lambda (p) + (for-each (lambda (flag) + (format p "ac_add_options ~a~%" flag)) + configure-flags))))) + (replace 'configure + (lambda _ + (invoke "./mach" "configure"))) + (replace 'build + (lambda* (#:key (make-flags '()) (parallel-build? #t) + #:allow-other-keys) + (apply invoke "./mach" "build" + `(,(string-append + "-j" (number->string (if parallel-build? + (parallel-job-count) + 1))) + ,@make-flags)))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke "./mach" "test")))) + (add-before 'install 'set-prefs + (lambda* (#:key prefs #:allow-other-keys) + (let ((p (open-file (format #f "~a/bin/browser/defaults/preferences/~a.js" #$distdir #$name) "a"))) + (for-each (lambda (pref) + (format p "pref(~s, ~a)" (car pref) (cadr pref))) + '(("browser.backspace_action" 0)))))) + (replace 'install + (lambda* (#:key inputs outputs #:allow-other-keys) + (invoke "./mach" "package") + (let ((tar (search-input-file inputs "/bin/tar")) + (lib (string-append #$output "/lib")) + (bin (string-append #$output "/bin"))) + (mkdir-p lib) + (mkdir-p bin) + (invoke tar "xJpf" #$dist-tarball "-C" lib) + (symlink (format #f "~a/~a/~a" lib #$name #$name) + (format #f "~a/~a" bin #$name))))) + (add-after 'install 'wrap-program + (lambda* (#:key inputs #:allow-other-keys) + (let ((ld-libs '#$(map (lambda (label) + (file-append (this-package-input label) "/lib")) + '("libdbusmenu")))) + (wrap-program (format #f "~a/lib/~a/~a" #$output #$name #$name) + `("GDK_BACKEND" = ("x11")) + `("MOZ_ENABLE_WAYLAND" = ("0")))))))))) + (home-page "https://palemoon.org") + (synopsis "Independent browser derived from Firefox/Mozilla community code") + (description "Pale Moon is an Open Source, Goanna-based web browser.") + (license license:mpl2.0))) + +(define-public palemoon (make-palemoon #:with-gtk3? #f)) diff --git a/battering/packages/patches/palemoon-vendor-basename.patch b/battering/packages/patches/palemoon-vendor-basename.patch new file mode 100644 index 0000000..3b0d27c --- /dev/null +++ b/battering/packages/patches/palemoon-vendor-basename.patch @@ -0,0 +1,19 @@ +diff --git a/palemoon/app/application.ini b/palemoon/app/application.ini +index c64ed90797..e2fdab4e0b 100644 +--- a/palemoon/app/application.ini ++++ b/palemoon/app/application.ini +@@ -19,10 +19,10 @@ + #include @TOPOBJDIR@/source-repo.h + + [App] +-# Vendor=@MOZ_APP_VENDOR@ +-Vendor=Moonchild Productions +-# Name=@MOZ_APP_BASENAME@ +-Name=Pale Moon ++Vendor=@MOZ_APP_VENDOR@ ++# Vendor=Moonchild Productions ++Name=@MOZ_APP_BASENAME@ ++# Name=Pale Moon + RemotingName=@MOZ_APP_REMOTINGNAME@ + #ifdef MOZ_APP_DISPLAYNAME + CodeName=@MOZ_APP_DISPLAYNAME@ |