;;; ports - package definitions for infotropique OS/core
;;; Copyright (C) 2017, 2018 Nils Gillmann
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as
;;; published by the Free Software Foundation, either version 3 of the
;;; License, or (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program. If not, see .
;; Part of this module were originally based on the gnu/packages/gnuzilla.scm file
;; from GNU Guix which is covered by the GPL3 license. Consult the file for the
;; list of contributors.
(define-module (ports www palemoon palemoon)
#:use-module ((srfi srfi-1) #:hide (zip))
#:use-module (gnu packages)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system gnu)
#:use-module (gnu packages autotools)
#:use-module (gnu packages admin)
#:use-module (gnu packages base)
#:use-module (gnu packages databases)
#:use-module (gnu packages glib)
#:use-module (gnu packages gstreamer)
#:use-module (gnu packages gtk)
#:use-module (gnu packages gnome)
#:use-module (gnu packages gnuzilla)
#:use-module (gnu packages libcanberra)
#:use-module (gnu packages cups)
#:use-module (gnu packages kerberos)
#:use-module (gnu packages m4)
#:use-module (gnu packages linux)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages compression)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages libevent)
#:use-module (gnu packages libreoffice) ;for hunspell
#:use-module (gnu packages image)
#:use-module (gnu packages libffi)
#:use-module (gnu packages pulseaudio)
#:use-module (gnu packages python)
#:use-module (gnu packages shells)
#:use-module (gnu packages tls)
#:use-module (gnu packages xorg)
#:use-module (gnu packages gl)
#:use-module (gnu packages assembly)
#:use-module (gnu packages icu4c)
#:use-module (gnu packages video)
#:use-module (gnu packages xdisorg)
#:use-module (gnu packages xorg)
#:use-module (gnu packages bash))
(define-public newmoon
(package
(name "newmoon")
(version "28.0.1")
(source
(origin
(method url-fetch)
(uri (string-append "https://github.com/MoonchildProductions/"
"UXP/archive/" version "_Release.tar.gz"))
;; https://github.com/MoonchildProductions/UXP/archive/PM28.0.1_Release.tar.gz
(file-name (string-append name "-" version ".tar.gz"))
(sha256
(base32
"0xfkbxa8618zb379m3aaycmbz0lj1s5f2mlwgykp8d5qyvd35bdj"))))
(build-system gnu-build-system)
(inputs
`(("alsa-lib" ,alsa-lib)
("mit-krb5" ,mit-krb5)
("bzip2" ,bzip2)
("cairo" ,cairo)
("cups" ,cups)
("libgnome" ,libgnome)
("libcanberra" ,libcanberra)
("dbus-glib" ,dbus-glib)
("dbus" ,dbus)
("glib" ,glib)
("gstreamer" ,gstreamer)
("gst-plugins-base" ,gst-plugins-base)
("gtk+-2" ,gtk+-2)
("gobject-introspection" ,gobject-introspection)
("freetype" ,freetype)
("hunspell" ,hunspell)
("libxt" ,libxt)
("libffi" ,libffi)
("libvpx" ,libvpx)
("libxt" ,libxt)
("libxcomposite" ,libxcomposite)
("libidl" ,libidl)
("libwebp" ,libwebp)
("libpng-apng" ,libpng-apng)
("libjpeg-turbo" ,libjpeg-turbo)
("libxscrnsaver" ,libxscrnsaver)
("libx11" ,libx11)
("libxext" ,libxext)
("libxft" ,libxft)
("libxi" ,libxi)
("libxrender" ,libxrender)
("xextproto" ,xextproto)
("libevent" ,libevent)
("libnotify" ,libnotify)
("mesa" ,mesa)
;; ("mozjs" ,mozjs)
("nspr" ,nspr)
;; ("nss" ,nss)
;; ("openssl" ,openssl)
("python-2" ,python-2)
("python-ply" ,python-ply)
("pixman" ,pixman)
("pulseaudio" ,pulseaudio)
("startup-notification" ,startup-notification)
("sqlite" ,sqlite)
("tcsh" ,tcsh)
("unzip" ,unzip)
("yasm" ,yasm)
("zip" ,zip)
("zlib" ,zlib)
("inetutils" ,inetutils))) ; Native-input?
(native-inputs
`(("autoconf-2.13" ,autoconf-2.13)
("fontconfig" ,fontconfig)
("perl" ,perl)
("pkg-config" ,pkg-config)
("m4" ,m4)
("which" ,which)
("bash" ,bash)))
(arguments
`(#:modules ((ice-9 ftw)
(ice-9 rdelim)
(ice-9 match)
,@%gnu-build-system-modules)
;; #:validate-runpath? #f
#:phases
(modify-phases %standard-phases
(replace 'configure
;; According to
;; the only way to set configure options is in the .mozconfig file
;; (or the file set by variable MOZCONFIG). If you try to use
;; our configure-flags, the configuration will break in unexpected
;; ways. This includes breaking the mach build system detection
;; of --host, --build, and --arch, and carrying flags recursively
;; on to parts used later in the build system.
;; The palemoon.org link describes an MS Windows build, but at
;; least for Gentoo it is done comparable:
;; .
(lambda* (#:key outputs configure-flags #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bash (which "bash"))
(abs-srcdir (getcwd))
(srcdir (string-append "../" (basename abs-srcdir)))
(flags `(,(string-append "--prefix=" out)
,@configure-flags))
(mozconfig (string-append (getcwd) "/.mozconfig")))
(setenv "SHELL" bash)
(setenv "AUTOCONF"
(string-append (assoc-ref %build-inputs
"autoconf-2.13")
"/bin/autoconf"))
(setenv "BUILD_OBJ_DIR" (string-append (getcwd) "/o"))
(setenv "CONFIG_SHELL" bash)
(setenv "QA_CONFIGURE_OPTIONS" ".*")
(setenv "MOZBUILD_STATE_PATH"
(string-append (getcwd) "/mach_state"))
(setenv "MOZCONFIG"
(string-append (getcwd) "/.mozconfig"))
(setenv "MOZ_NOSPAM" "1")
(mkdir-p (string-append (getcwd) "/builddir"))
(with-output-to-file mozconfig
(lambda ()
(display
(string-append
"ac_add_options --enable-application=browser\n"
"mk_add_options MOZ_OBJDIR=" (getenv "BUILD_OBJ_DIR") "\n" ;new
"ac_add_options --prefix=" out "\n"
"ac_add_options --disable-debug\n"
"ac_add_options --disable-debug-symbols\n"
"ac_add_options --disable-accessibility\n" ;There is no such option?
"ac_add_options --disable-updater\n"
"ac_add_options --disable-installer\n"
"ac_add_options --disable-parental-controls\n" ;Yes? No?
"ac_add_options --disable-install-strip"
"ac_add_options --disable-tests\n"
"ac_add_options --with-system-ply\n"
"ac_add_options --with-system-libevent\n"
"ac_add_options --with-system-zlib\n"
"ac_add_options --with-system-bz2\n"
"ac_add_options --with-system-webp\n"
"ac_add_options --with-system-libvpx\n"
"ac_add_options --enable-system-hunspell\n"
"ac_add_options --enable-system-ffi\n"
"ac_add_options --enable-system-sqlite\n" ;Needs >= sqlite-3.21.0
"ac_add_options --enable-system-cairo\n"
"ac_add_options --enable-system-pixman\n"
"ac_add_options --enable-shared-js\n"
"ac_add_options --disable-valgrind\n"
"ac_add_options --with-pthreads\n"
"ac_add_options --disable-optimize\n"
"ac_add_options --enable-gstreamer\n"
"ac_add_options --enable-default-toolkit=\"cairo-gtk2\"\n"
"ac_add_options --disable-alsa\n"
"ac_add_options --enable-strip\n"
"ac_add_options --disable-codesighs\n"
"ac_add_options --disable-gamepad\n"
"ac_add_options --disable-logging\n"
"ac_add_options --disable-websms-backend\n"
"ac_add_options --enable-chrome-format=omni\n"
"ac_add_options --enable-startup-notification\n"
"ac_add_options --enable-shared-js\n"
"ac_add_options --enable-devtools\n"
;; XXX!
"ac_add_options --with-system-png\n"
"ac_add_options --enable-pulseaudio\n"
"ac_add_options --disable-necko-wifi\n"
"ac_add_options --with-system-jpeg\n"
"ac_add_options --disable-official-branding\n" ; Trademarks apply for official branding
"mk_add_options PYTHON=\"python2\"\n"
"mk_add_options AUTOCONF=\"autoconf\"\n"
"ac_add_options --with-system-nspr\n"
"ac_add_options --enable-sandbox\n"
"ac_add_options --enable-content-sandbox\n"
"ac_add_options --enable-skia\n"
"ac_add_options --enable-jemalloc\n"
"ac_add_options --with-system-icu\n"
"ac_add_options --with-intl-api\n"))))
(display "mach configure, this is expected to \"crash\"")
(zero? (system* "./mach" "configure"))
(display "mach, and another round.")
(zero? (system* "./mach")))))
(add-after 'patch-source-shebangs 'setenvs
(lambda _
(substitute* (list "build/autoconf/config.guess"
"client.mk"
"js/src/configure.in"
"intl/icu/source/configure")
(("/bin/sh") (which "sh")))
#t))
(add-before 'build 'patch-clientmk
(lambda _
(substitute* "client.mk"
(("/bin/sh") (which "sh")))
#t))
(replace 'build
(lambda _
(chdir "build")
(display "mach build, the real build now")
(system* "../mach" "build")
#t))
(add-after
'unpack 'arrange-to-link-libxul-with-libraries-it-might-dlopen
(lambda _
;; libxul.so dynamically opens libraries, so here we explicitly
;; link them into libxul.so instead.
;;
;; TODO: It might be preferable to patch in absolute file names in
;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
;; work. More investigation is needed.
(substitute* "toolkit/library/moz.build"
(("^# This needs to be last")
"OS_LIBS += [
'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
'gstreamer-1.0', 'gstapp-1.0', 'gstvideo-1.0', 'png' ]\n\n"))
#t))
(add-after 'unpack 'privacy-patch-branding
(lambda _
(substitute* "browser/branding/unofficial/pref/palemoon-branding.js"
(("http://www.palemoon.org/unofficial.shtml")
"https://gnu.org/s/guix"))
(substitute* "browser/branding/shared/pref/preferences.inc"
(("http://www.palemoon.org/firstrun.shtml")
"https://gnu.org"))
(substitute* "browser/branding/shared/locales/browserconfig.properties"
(("http://start.palemoon.org/")
"https://gnu.org/s/guix"))
#t))
(replace 'install
(lambda* (#:key name outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin"))
(lib (string-append out "/lib"))
(palemoon (string-append
out "/lib/palemoon/palemoon"))
;; Use one objectdirectory for all architectures.
(objdir "o")
;; (prefsfile (string-append objdir "/dist/bin/browser"
;; "/defaults/profile"
;; "/prefs.js"))
(tarfile (string-append objdir "/dist/palemoon-"
,version ".linux-x86_64"
".tar.bz2")))
;; We skip this for now.
;; (substitute* prefsfile
;; (("# Mozilla User Preferences")
;; "# Mozilla User Preferences\n
;; pref(\"app.update.enabled\", false);\n
;; pref(\"browser.backspace_action\", 0);\n
;; pref(\"browser.ctrlTab.previews\", false);\n
;; pref(\"intl.locale.matchOS\", true);\n
;; pref(\"general.useragent.locale\", \"chrome://global/locale/intl.properties\");\n
;; pref(\"browser.display.use_system_colors\", true);"))
;; Create the package, unpack it, manually install
;; the files from there to not miss anything.
(zero? (system* "../mach" "package"))
(display (getcwd))
(chdir (string-append "../" objdir "/dist"))
(zero? (system* "tar" "xjpf"
"palemoon-" ,version ".linux-x86_64.tar.bz2"))
(mkdir-p (string-append out "/lib/palemoon"))
(copy-recursively "palemoon"
(string-append out "/lib/palemoon"))
(mkdir-p bin)
(symlink (string-append out "/lib/palemoon/palemoon")
(string-append bin "/newmoon"))
;; Avoid duplicate binaries.
;; https://bugzilla.mozilla.org/show_bug.cgi?id=658850 for
(delete-file (string-append out "/lib/palemoon/palemoon-bin")))))
;; swap check and install phases and set paths to installed binaries
(add-before 'check 'set-path-for-check
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(setenv "PATH" (string-append (getenv "PATH") ":" out "/bin")))
#t))
(add-after 'install 'check
;;(assoc-ref %standard-phases 'check))
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin/newmoon")))
(invoke bin "--version"))))
(delete 'check)
(delete 'bootstrap)
;; (replace 'check
;; (lambda* (#:key outputs #:allow-other-keys)
;; (let* ((out (assoc-ref outputs "out"))
;; (bin (string-append out "/bin/newmoon")))
;; (invoke bin "--version"))))
(add-after 'install 'install-icons
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")))
(display (getcwd))
(with-directory-excursion "../../browser/branding/unofficial"
(for-each
(lambda (file)
(let* ((size (string-filter char-numeric? file))
(icons (string-append out "/share/icons/hicolor/"
size "x" size "/apps")))
(mkdir-p icons)
(copy-file file (string-append icons "/newmoon.png"))))
'("default16.png" "default32.png" "default48.png"
"mozicon128.png"))))))
(add-after 'install 'install-desktop-file
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(apps (string-append out "/share/applications")))
(display (getcwd))
(with-directory-excursion "../../browser/branding/official"
(substitute* "palemoon.desktop"
(("Pale Moon")
"New Moon")
(("Exec=palemoon -new-tab https://start.palemoon.org")
"Exec=newmoon -new-tab https://gnu.org/s/guix")
(("Exec=palemoon -new-window")
"Exec=newmoon -new-window")
(("Exec=palemoon -private-window")
"Exec=newmoon -private-window")
(("palemoon")
"newmoon"))
(install-file "palemoon.desktop"
(string-append apps
"/newmoon.desktop")))))))))
(home-page "https://www.palemoon.org/")
(synopsis "Web Browser compiled from Pale Moon sources")
(description
"New Moon is a web browser compiled from Pale Moon sourcecode. New Moon
is an independent browser derived from Firefox. Among its features are:
Replaces the Gecko layout engine with the Goanna fork Uses the pre-Australis
Firefox user interface Continues add-on support for XUL, XPCOM, and NPAPI
plugins[9] Supports extensions and themes exclusive to Pale Moon, such as
Adblock Latitude[ Defaults to a customizable start page in cooperation with
start.me Defaults to DuckDuckGo as the search engine instead of Google or
Yahoo! Uses the IP-API service instead of Google's for geolocation Fully
customizable user interface
NOTE: Please note that in this work-in-progress version it points to the start
page which promotes some services and needs cookies, and has some other
issues. IMPORTANT: This version is based on the old Pale Moon codebase which
is in maintenance mode, but continues to receive security patches and
updates.")
(properties '((upstream-name . "Pale-Moon")))
;; The exception clause of the Palemoon license states that
;; New Moon builds can be redistributed freely.
(license (list license:mpl2.0 ;and others, see toolkit/content/license.html
license:gpl2+
license:lgpl2.1))))
(define-public newmoon
(package
(name "newmoon")
(version "27.9.4")
(source
(origin
(method url-fetch)
(uri (string-append "https://github.com/MoonchildProductions/"
"Pale-Moon/archive/" version "_Release.tar.gz"))
(file-name (string-append name "-" version ".tar.gz"))
(sha256
(base32
"0xfkbxa8618zb379m3aaycmbz0lj1s5f2mlwgykp8d5qyvd35bdj"))))
(build-system gnu-build-system)
(inputs
`(("alsa-lib" ,alsa-lib)
("mit-krb5" ,mit-krb5)
("bzip2" ,bzip2)
("cairo" ,cairo)
("cups" ,cups)
("libgnome" ,libgnome)
("libcanberra" ,libcanberra)
("dbus-glib" ,dbus-glib)
("dbus" ,dbus)
("glib" ,glib)
("gstreamer" ,gstreamer)
("gst-plugins-base" ,gst-plugins-base)
("gtk+-2" ,gtk+-2)
("gobject-introspection" ,gobject-introspection)
("freetype" ,freetype)
("hunspell" ,hunspell)
("libxt" ,libxt)
("libffi" ,libffi)
("libvpx" ,libvpx)
("libxt" ,libxt)
("libxcomposite" ,libxcomposite)
("libidl" ,libidl)
("libwebp" ,libwebp)
("libpng-apng" ,libpng-apng)
("libjpeg-turbo" ,libjpeg-turbo)
("libxscrnsaver" ,libxscrnsaver)
("libx11" ,libx11)
("libxext" ,libxext)
("libxft" ,libxft)
("libxi" ,libxi)
("libxrender" ,libxrender)
("xextproto" ,xextproto)
("libevent" ,libevent)
("libnotify" ,libnotify)
("mesa" ,mesa)
;; ("mozjs" ,mozjs)
("nspr" ,nspr)
;; ("nss" ,nss)
;; ("openssl" ,openssl)
("python-2" ,python-2)
("python-ply" ,python-ply)
("pixman" ,pixman)
("pulseaudio" ,pulseaudio)
("startup-notification" ,startup-notification)
("sqlite" ,sqlite)
("tcsh" ,tcsh)
("unzip" ,unzip)
("yasm" ,yasm)
("zip" ,zip)
("zlib" ,zlib)
("inetutils" ,inetutils))) ; Native-input?
(native-inputs
`(("autoconf-2.13" ,autoconf-2.13)
("fontconfig" ,fontconfig)
("perl" ,perl)
("pkg-config" ,pkg-config)
("m4" ,m4)
("which" ,which)
("bash" ,bash)))
;; Only processors with SSE2 are supported.
(supported-systems '("x86_64-linux" "i686-linux"))
(arguments
`(#:modules ((ice-9 ftw)
(ice-9 rdelim)
(ice-9 match)
,@%gnu-build-system-modules)
;; We encounter runpath issues, looks harmless in practice.
;; But nevertheless: FIXME!!!!!!
#:validate-runpath? #f
#:phases
(modify-phases %standard-phases
(replace 'configure
;; According to
;; the only way to set configure options is in the .mozconfig file
;; (or the file set by variable MOZCONFIG). If you try to use
;; our configure-flags, the configuration will break in unexpected
;; ways. This includes breaking the mach build system detection
;; of --host, --build, and --arch, and carrying flags recursively
;; on to parts used later in the build system.
;; The palemoon.org link describes an MS Windows build, but at
;; least for Gentoo it is done comparable:
;; .
(lambda* (#:key outputs configure-flags #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bash (which "bash"))
(abs-srcdir (getcwd))
(srcdir (string-append "../" (basename abs-srcdir)))
(flags `(,(string-append "--prefix=" out)
,@configure-flags))
(mozconfig (string-append (getcwd) "/.mozconfig")))
(setenv "SHELL" bash)
(setenv "AUTOCONF"
(string-append (assoc-ref %build-inputs
"autoconf-2.13")
"/bin/autoconf"))
(setenv "BUILD_OBJ_DIR" (string-append (getcwd) "/o"))
(setenv "CONFIG_SHELL" bash)
(setenv "QA_CONFIGURE_OPTIONS" ".*")
(setenv "MOZBUILD_STATE_PATH"
(string-append (getcwd) "/mach_state"))
(setenv "MOZCONFIG"
(string-append (getcwd) "/.mozconfig"))
(setenv "MOZ_NOSPAM" "1")
(mkdir-p (string-append (getcwd) "/builddir"))
(with-output-to-file mozconfig
(lambda ()
(display
(string-append
"ac_add_options --enable-application=browser\n"
"mk_add_options MOZ_OBJDIR=" (getenv "BUILD_OBJ_DIR") "\n" ;new
"ac_add_options --prefix=" out "\n"
"ac_add_options --disable-debug\n"
"ac_add_options --disable-debug-symbols\n"
"ac_add_options --disable-accessibility\n" ;There is no such option?
"ac_add_options --disable-updater\n"
"ac_add_options --disable-installer\n"
"ac_add_options --disable-parental-controls\n" ;Yes? No?
"ac_add_options --disable-install-strip"
"ac_add_options --disable-tests\n"
"ac_add_options --with-system-ply\n"
"ac_add_options --with-system-libevent\n"
"ac_add_options --with-system-zlib\n"
"ac_add_options --with-system-bz2\n"
"ac_add_options --with-system-webp\n"
"ac_add_options --with-system-libvpx\n"
"ac_add_options --enable-system-hunspell\n"
"ac_add_options --enable-system-ffi\n"
"ac_add_options --enable-system-sqlite\n" ;Needs >= sqlite-3.21.0
"ac_add_options --enable-system-cairo\n"
"ac_add_options --enable-system-pixman\n"
"ac_add_options --enable-shared-js\n"
"ac_add_options --disable-valgrind\n"
"ac_add_options --with-pthreads\n"
"ac_add_options --disable-optimize\n"
"ac_add_options --enable-gstreamer\n"
"ac_add_options --enable-default-toolkit=\"cairo-gtk2\"\n"
"ac_add_options --disable-alsa\n"
"ac_add_options --enable-strip\n"
"ac_add_options --disable-codesighs\n"
"ac_add_options --disable-gamepad\n"
"ac_add_options --disable-logging\n"
"ac_add_options --disable-websms-backend\n"
"ac_add_options --enable-chrome-format=omni\n"
"ac_add_options --enable-startup-notification\n"
"ac_add_options --enable-shared-js\n"
"ac_add_options --enable-devtools\n"
;; XXX!
"ac_add_options --with-system-png\n"
"ac_add_options --enable-pulseaudio\n"
"ac_add_options --disable-necko-wifi\n"
"ac_add_options --with-system-jpeg\n"
"ac_add_options --disable-official-branding\n" ; Trademarks apply for official branding
"mk_add_options PYTHON=\"python2\"\n"
"mk_add_options AUTOCONF=\"autoconf\"\n"
"ac_add_options --with-system-nspr\n"
"ac_add_options --enable-sandbox\n"
"ac_add_options --enable-content-sandbox\n"
"ac_add_options --enable-skia\n"
"ac_add_options --enable-jemalloc\n"
"ac_add_options --with-system-icu\n"
"ac_add_options --with-intl-api\n"))))
(display "mach configure, this is expected to \"crash\"")
(zero? (system* "./mach" "configure"))
(display "mach, and another round.")
(zero? (system* "./mach")))))
(add-after 'patch-source-shebangs 'setenvs
(lambda _
(substitute* (list "build/autoconf/config.guess"
"client.mk"
"js/src/configure.in"
"intl/icu/source/configure")
(("/bin/sh") (which "sh")))
#t))
(add-before 'build 'patch-clientmk
(lambda _
(substitute* "client.mk"
(("/bin/sh") (which "sh")))
#t))
(replace 'build
(lambda _
(chdir "build")
(display "mach build, the real build now")
(system* "../mach" "build")
#t))
(add-after
'unpack 'arrange-to-link-libxul-with-libraries-it-might-dlopen
(lambda _
;; libxul.so dynamically opens libraries, so here we explicitly
;; link them into libxul.so instead.
;;
;; TODO: It might be preferable to patch in absolute file names in
;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
;; work. More investigation is needed.
(substitute* "toolkit/library/moz.build"
(("^# This needs to be last")
"OS_LIBS += [
'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
'gstreamer-1.0', 'gstapp-1.0', 'gstvideo-1.0', 'png' ]\n\n"))
#t))
(add-after 'unpack 'privacy-patch-branding
(lambda _
(substitute* "browser/branding/unofficial/pref/palemoon-branding.js"
(("http://www.palemoon.org/unofficial.shtml")
"https://gnu.org/s/guix"))
(substitute* "browser/branding/shared/pref/preferences.inc"
(("http://www.palemoon.org/firstrun.shtml")
"https://gnu.org"))
(substitute* "browser/branding/shared/locales/browserconfig.properties"
(("http://start.palemoon.org/")
"https://gnu.org/s/guix"))
#t))
(add-after 'unpack 'add-vendor-options
(lambda _
(substitute* "browser/branding/unofficial/pref/palemoon-branding.js"
(("pref(\"app.update.url\", \"\")")
"pref(\"app.update.url\", \"\");\n
pref(\"browser.backspace_action\", 0);\n
pref(\"browser.ctrlTab.previews\", false);\n
pref(\"intl.locale.matchOS\", true);\n
pref(\"extensions.blocklist.enabled\", false);\n
pref(\"geo.enabled\", false);\n
pref(\"services.sync.prefs.sync.security.OCSP.enabled\", false);\n
pref(\"security.OCSP.GET.enabled\", false);\n
pref(\"security.OCSP.require\", false);\n
pref(\"general.useragent.locale\", \"chrome://global/locale/intl.properties\");\n
pref(\"browser.display.use_system_colors\", true);"))
#t))
(replace 'install
(lambda* (#:key name outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin"))
(lib (string-append out "/lib"))
(palemoon (string-append
out "/lib/palemoon/palemoon"))
;; Use one objectdirectory for all architectures.
(objdir "o")
;; (prefsfile (string-append objdir "/dist/bin/browser"
;; "/defaults/preferences/"
;; "/palemoon-branding.js"))
(tarfile (string-append objdir "/dist/palemoon-"
,version ".linux-x86_64"
".tar.bz2")))
;; Create the package, unpack it, manually install
;; the files from there to not miss anything.
(zero? (system* "../mach" "package"))
(display (getcwd))
(chdir (string-append "../" objdir "/dist"))
(zero? (system* "tar" "xjpf"
"palemoon-" ,version ".linux-x86_64.tar.bz2"))
(mkdir-p (string-append out "/lib/palemoon"))
(copy-recursively "palemoon"
(string-append out "/lib/palemoon"))
(mkdir-p bin)
(symlink (string-append out "/lib/palemoon/palemoon")
(string-append bin "/newmoon"))
;; Avoid duplicate binaries.
;; https://bugzilla.mozilla.org/show_bug.cgi?id=658850 for
(delete-file (string-append out "/lib/palemoon/palemoon-bin")))))
;; swap check and install phases and set paths to installed binaries
(add-before 'check 'set-path-for-check
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(setenv "PATH" (string-append (getenv "PATH") ":" out "/bin")))
#t))
(add-after 'install 'check
;;(assoc-ref %standard-phases 'check))
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin/newmoon")))
(invoke bin "--version"))))
(delete 'check)
(delete 'bootstrap)
;; (replace 'check
;; (lambda* (#:key outputs #:allow-other-keys)
;; (let* ((out (assoc-ref outputs "out"))
;; (bin (string-append out "/bin/newmoon")))
;; (invoke bin "--version"))))
(add-after 'install 'install-icons
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")))
(display (getcwd))
(with-directory-excursion "../../browser/branding/unofficial"
(for-each
(lambda (file)
(let* ((size (string-filter char-numeric? file))
(icons (string-append out "/share/icons/hicolor/"
size "x" size "/apps")))
(mkdir-p icons)
(copy-file file (string-append icons "/newmoon.png"))))
'("default16.png" "default32.png" "default48.png"
"mozicon128.png"))))))
(add-after 'install 'install-desktop-file
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(apps (string-append out "/share/applications")))
(display (getcwd))
(with-directory-excursion "../../browser/branding/official"
(substitute* "palemoon.desktop"
(("Pale Moon")
"New Moon")
(("Exec=palemoon -new-tab https://start.palemoon.org")
"Exec=newmoon -new-tab https://gnu.org/s/guix")
(("Exec=palemoon -new-window")
"Exec=newmoon -new-window")
(("Exec=palemoon -private-window")
"Exec=newmoon -private-window")
(("palemoon")
"newmoon"))
(install-file "palemoon.desktop"
(string-append apps
"/newmoon.desktop")))))))))
(home-page "https://www.palemoon.org/")
(synopsis "Web Browser compiled from Pale Moon sources")
(description
"New Moon is a web browser compiled from Pale Moon sourcecode. New Moon
is an independent browser derived from Firefox. Among its features are:
Replaces the Gecko layout engine with the Goanna fork Uses the pre-Australis
Firefox user interface Continues add-on support for XUL, XPCOM, and NPAPI
plugins[9] Supports extensions and themes exclusive to Pale Moon, such as
Adblock Latitude[ Defaults to a customizable start page in cooperation with
start.me Defaults to DuckDuckGo as the search engine instead of Google or
Yahoo! Uses the IP-API service instead of Google's for geolocation Fully
customizable user interface
NOTE: Please note that in this work-in-progress version it points to the start
page which promotes some services and needs cookies, and has some other
issues. IMPORTANT: This version is based on the old Pale Moon codebase which
is in maintenance mode, but continues to receive security patches and
updates.")
(properties '((upstream-name . "Pale-Moon")))
;; The exception clause of the Palemoon license states that
;; New Moon builds can be redistributed freely.
(license (list license:mpl2.0 ;and others, see toolkit/content/license.html
license:gpl2+
license:lgpl2.1))))