diff options
author | Sisiutl <sisiutl@egregore.fun> | 2024-10-28 15:09:13 +0100 |
---|---|---|
committer | Sisiutl <sisiutl@egregore.fun> | 2024-10-28 15:09:13 +0100 |
commit | 9efe94ed7c2fc9c352c52a14d4cb375e912a7caa (patch) | |
tree | d1040afa54c5caf35d1fdda0d6172bdc0c99f3e8 | |
parent | 58dce5ea2168539306fab30d4f34a8a551b2682d (diff) |
make-uxp-browser and basilisk
-rw-r--r-- | sigils/packages/palemoon.scm | 153 |
1 files changed, 106 insertions, 47 deletions
diff --git a/sigils/packages/palemoon.scm b/sigils/packages/palemoon.scm index 9d9845b..963fcdf 100644 --- a/sigils/packages/palemoon.scm +++ b/sigils/packages/palemoon.scm @@ -4,6 +4,7 @@ #:use-module (guix utils) #:use-module (guix gexp) #:use-module (guix git-download) + #:use-module (guix build-system copy) #:use-module (guix build-system mozilla) #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu packages) @@ -28,16 +29,15 @@ #:use-module (gnu packages python) #:use-module (gnu packages sqlite) #:use-module (gnu packages tls) + #:use-module (gnu packages version-control) #:use-module (gnu packages video) - #:use-module (gnu packages xorg)) - -(define %basilisk-official-branding-commit - "63a2bff658c5dfff3b6de17fa54743078aa4eb7e") + #:use-module (gnu packages xorg) + #:autoload (ice-9 regex) (string-match)) (define* (make-uxp-browser app-name app-version #:key - (with-gtk3? #f) + with-gtk3? (branding "official")) (package (name app-name) @@ -80,18 +80,22 @@ sqlite zlib)) (arguments - (let* ((gtk-version (if with-gtk3? "gtk3" "gtk2")) + (let* ((build-by-date? (string-match "[0-9]{4}\\.[0-9]{2}\\.[0-9]{2}" version)) + (gtk-version (if with-gtk3? "gtk3" "gtk2")) (branding-dir (format #f "~a/branding/~a" name branding)) (distdir (format #f "obj-~a/dist" (string-replace-substring (or (%current-target-system) %host-type) "unknown" "pc"))) + (build-date (string-append (string-replace-substring version "." "") "000000")) (tarball-dist (format #f "~a/~a-~a.~a-~a.tar.xz" distdir name - version + (if build-by-date? + build-date + version) (string-join (reverse (string-split (or (%current-target-system) (%current-system)) #\-)) "-") gtk-version))) @@ -145,6 +149,9 @@ #$(if with-gtk3? ;; TODO: find a way to link atk_bridge_adaptor_init "--disable-accessibility" "--enable-accessibility")) + #:modules '((guix build utils) + (guix build gnu-build-system) + (ice-9 regex)) #:phases #~(modify-phases %standard-phases (add-after 'unpack 'fix-prefs @@ -175,6 +182,7 @@ (setenv "CONFIG_SHELL" (search-input-file inputs "/bin/bash")) (setenv "MOZILLA_OFFICIAL" "1") ;; Official branding (setenv "MOZ_PKG_SPECIAL" #$gtk-version) + (setenv "MOZ_BUILD_DATE" #$build-date) (setenv "MOZ_NOSPAM" "1"))) (add-before 'configure 'mozconfig (lambda* (#:key configure-flags #:allow-other-keys) @@ -207,6 +215,7 @@ (bin (string-append #$output "/bin"))) (mkdir-p lib) (mkdir-p bin) + (invoke "ls" "-la" #$distdir) (invoke tar "xJpf" #$tarball-dist "-C" lib) (symlink (format #f "~a/~a/~a" lib #$name #$name) (format #f "~a/~a" bin #$name))))) @@ -217,15 +226,17 @@ `("MOZ_ENABLE_WAYLAND" = ("0"))))) (add-after 'install 'install-branding (lambda* (#:key outputs #:allow-other-keys) - (install-file #$(format #f "~a/branding/official/~a.desktop" name name) - (string-append #$output "/share/applications/")) - (for-each (lambda (size) - (let ((dir (format #f "~a/share/icons/hicolor/~ax~a/apps" #$output size size))) + (for-each (lambda (branding-file) + (let* ((size (match:substring + (string-match + (format #f "~a/default([0-9]+)\\.png" #$branding-dir) + branding-file) 1)) + (dir (format #f "~a/share/icons/hicolor/~ax~a/apps" #$output size size))) (mkdir-p dir) (copy-file - (format #f "~a/default~a.png" #$branding-dir size) + branding-file (in-vicinity dir (format #f "~a.png" #$name))))) - '(16 32 48)) + (find-files #$branding-dir "default.*\\.png")) (let* ((dir (format #f "~a/share/icons/hicolor/128x128/apps" #$output))) (mkdir-p dir) (copy-file @@ -237,11 +248,13 @@ (home-page ""))) (define (make-palemoon . args) - (let ((palemoon (apply make-uxp-browser "palemoon" "33.4.0.1" args))) + (let ((pkg (apply make-uxp-browser "palemoon" "33.4.0.1" args))) (package - (inherit palemoon) - (name "palemoon") - (version "33.4.0.1") + (inherit pkg) + (name (package-name pkg)) + (version (package-version pkg)) + (native-inputs (modify-inputs (package-native-inputs pkg) + (append git))) (source (origin (method git-fetch) (uri (git-reference @@ -258,10 +271,10 @@ (string-append directory "/sigils/packages/patches")) %load-path))) (search-patches "palemoon-vendor-basename.patch"))))) - (arguments (substitute-keyword-arguments (package-arguments palemoon) + (arguments (substitute-keyword-arguments (package-arguments pkg) ((#:phases phases) #~(modify-phases #$phases - (add-after 'fix-prefs 'remove-spyware-home-page + (add-before 'fix-prefs 'remove-spyware-home-page (lambda _ (substitute* "palemoon/branding/shared/locales/browserconfig.properties" ;; Switch the page from the properties to something local @@ -269,47 +282,93 @@ (substitute* "palemoon/branding/official/palemoon.desktop" ;; New tab should open the user's specified "New Tab" page, not the palemoon start page. (("^Exec=palemoon -new-tab .*") - "Exec=palemoon -new-tab" )) + "Exec=palemoon -new-tab")) (substitute* '("palemoon/branding/shared/pref/preferences.inc" "palemoon/branding/unofficial/pref/palemoon-branding.js") ;; Remove the startup.homepage_welcome_url preference - (("^pref\\(\"startup\\.homepage_(welcome|override)_url\",\".*\"\\);\n$") "")))))))) + (("^pref\\(\"startup\\.homepage_(welcome|override)_url(.additional)?\",\".*\"\\);\n$") "")))) + (add-after 'install-branding 'install-desktop-file + (lambda* (#:key outputs #:allow-other-keys) + (install-file #$(format #f "~a/branding/official/~a.desktop" name name) + (string-append #$output "/share/applications/")))))))) (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 basilisk-official-branding + (package + (name "basilisk-official-branding") + (version "63a2bff658c5dfff3b6de17fa54743078aa4eb7e") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://repo.palemoon.org/Basilisk-Dev/Basilisk.git") + (commit version) + (recursive? #f))) + (file-name (git-file-name name version)) + (sha256 + (base32 "02yz9wd5k3q1cklqslyzam3ji6mh6why7zr8hfyx88k9xqvlqix2")))) + (build-system copy-build-system) + (arguments '(#:install-plan '(("basilisk/branding/official/" ".")))) + (home-page "https://www.basilisk-browser.org/") + (synopsis "Official branding distributed with the Basilisk binaries") + (description "This is a Guix recipe that extracts the official branding from the last commit before it was removed +from the Basilisk repository.") + (license #f))) + +(define (make-basilisk . args) + (let ((pkg (apply make-uxp-browser "basilisk" "2024.10.24" args))) + (package + (inherit pkg) + (name (package-name pkg)) + (version (package-version pkg)) + (native-inputs (modify-inputs (package-native-inputs pkg) + (append basilisk-official-branding))) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://repo.palemoon.org/Basilisk-Dev/Basilisk.git") + (commit (string-append "v" version)) + (recursive? #t))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1z3yspg2migsrli360iym535sns1n5lc2phh6nr0xp91fwk823j1")))) + (arguments (substitute-keyword-arguments (package-arguments pkg) + ((#:phases phases) + #~(modify-phases #$phases + (add-after 'unpack 'include-official-branding + (lambda* (#:key native-inputs #:allow-other-keys) + (let ((dir "basilisk/branding/official")) + (mkdir-p dir) + (copy-recursively #$basilisk-official-branding dir)))) + (add-after 'include-official-branding 'remove-spyware-home-page + (lambda _ + (substitute* "basilisk/branding/official/pref/basilisk-branding.js" + ;; Remove the startup.homepage_welcome_url preference + (("^pref\\(\"startup\\.homepage_(welcome|override)_url(.additional)?\",\".*\"\\);\n$") "")))))))) + (home-page "https://www.basilisk-browser.org/") + (synopsis "A XUL-based web-browser built on top of the Unified XUL Platform (UXP). This browser is a +close twin to pre-Servo Firefox in how it operates.") + (description "Basilisk is a free and Open Source XUL-based web browser, featuring the well-known Firefox-style +interface and operation. It is based on the Goanna layout and rendering engine (a fork of Gecko) and builds on the +Unified XUL Platform (UXP), which in turn is a fork of the Mozilla code base without Servo or Rust.") + (license license:mpl2.0)))) + (define-public palemoon (make-palemoon)) +(define-public basilisk + (make-basilisk)) + (define-public palemoon/gtk3 (package (inherit (make-palemoon #:with-gtk3? #t)) (name "palemoon-gtk3"))) -;; (define (make-basilisk palemoon) -;; (package -;; (inherit palemoon) -;; (name (string-replace-substring (package-name palemoon) -;; "palemoon" "basilisk")) -;; (version "2024.10.24") -;; (source -;; (origin -;; (method git-fetch) -;; (uri (git-reference -;; (url "https://repo.palemoon.org/Basilisk-Dev/Basilisk.git") -;; (commit (string-append "v" version)) -;; (recursive? #t))) -;; (file-name (git-file-name name version)) -;; (sha256 -;; (base32 "1z3yspg2migsrli360iym535sns1n5lc2phh6nr0xp91fwk823j1")))) -;; (home-page "https://www.basilisk-browser.org/") -;; (synopsis "A XUL-based web-browser built on top of the Unified XUL Platform (UXP). This browser is a -;; close twin to pre-Servo Firefox in how it operates.") -;; (description "Basilisk is a free and Open Source XUL-based web browser, featuring the well-known Firefox-style -;; interface and operation. It is based on the Goanna layout and rendering engine (a fork of Gecko) and builds on the -;; Unified XUL Platform (UXP), which in turn is a fork of the Mozilla code base without Servo or Rust.") -;; (license license:mpl2.0))) - -;; (define-public basilisk -;; (make-basilisk palemoon)) +(define-public basilisk/gtk3 + (package + (inherit (make-basilisk #:with-gtk3? #t)) + (name "basilisk-gtk3"))) |