my-guix/wip/arcticfox.scm

264 lines
12 KiB
Scheme
Raw Normal View History

2021-03-09 22:40:05 +01:00
;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is an addendum to GNU Guix.
;;;
;;; GNU Guix 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.
;;;
;;; GNU Guix 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 GNU Guix. If not, see <http://www.gnu.org/licenses/>.
2022-01-02 09:27:26 +01:00
(define-module (wip arcticfox)
2021-03-09 22:40:05 +01:00
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build utils)
#:use-module (guix git-download)
#:use-module (guix utils)
#:use-module (guix packages)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
#:use-module (gnu packages assembly)
#:use-module (gnu packages autotools)
2022-01-02 09:27:26 +01:00
#:use-module (gnu packages bash)
2021-03-09 22:40:05 +01:00
#:use-module (gnu packages compression)
2021-05-03 11:38:30 +02:00
#:use-module (gnu packages gcc)
2021-03-21 13:58:39 +01:00
#:use-module (gnu packages gl)
2021-03-09 22:40:05 +01:00
#:use-module (gnu packages glib)
#:use-module (gnu packages gtk)
2021-05-04 08:38:44 +02:00
#:use-module (gnu packages icu4c)
2021-03-09 22:40:05 +01:00
#:use-module (gnu packages image)
#:use-module (gnu packages libevent)
#:use-module (gnu packages libffi)
2021-03-21 13:58:39 +01:00
#:use-module (gnu packages libreoffice)
2021-03-09 22:40:05 +01:00
#:use-module (gnu packages linux)
#: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)
2021-03-21 13:58:39 +01:00
#:use-module (gnu packages sqlite)
2021-03-09 22:40:05 +01:00
#:use-module (gnu packages video)
2021-05-04 08:38:44 +02:00
#:use-module (gnu packages xdisorg)
2021-04-01 16:16:39 +02:00
#:use-module (gnu packages xorg))
2021-03-09 22:40:05 +01:00
(define-public arcticfox
(let ((commit "0be1cbd77b3c44a6f2d7368cec1b818e6778e018") ; Jan 30, 2021
(revision "1"))
(package
(name "arcticfox")
2022-01-02 09:27:26 +01:00
(version "39.0")
2021-03-09 22:40:05 +01:00
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/wicknix/Arctic-Fox")
2022-01-02 09:27:26 +01:00
(commit (string-append "v" version))))
2021-03-09 22:40:05 +01:00
(file-name (git-file-name name version))
(sha256
2022-01-02 09:27:26 +01:00
(base32 "0xqdpansfha762352q0j2pd68b30jp44l2bsmbgmm5bcdlc5r2py"))
2021-05-04 08:38:44 +02:00
(modules '((guix build utils)))
(snippet
'(begin
(for-each delete-file-recursively
'(;"db/sqlite3"
"gfx/cairo"
;"gfx/graphite2"
;"gfx/harfbuzz"
;"intl/icu"
;"ipc/chromium/src/third_party" ; libevent
"media/libjpeg"
;"media/libogg"
;"media/libopus"
;"media/libpng"
;"media/libvpx"
;"media/libwebp"
"memory/jemalloc"
"modules/freetype2"
"modules/libbz2"
"modules/zlib"
"js/src/ctypes/libffi"
"security/nss"
2022-01-02 09:27:26 +01:00
"security/sandbox/chromium-shim/base/third_party"))))))
2021-03-09 22:40:05 +01:00
(build-system gnu-build-system)
(arguments
2021-05-03 11:38:30 +02:00
`(#:tests? #f ; check target removed
2021-03-09 22:40:05 +01:00
#:configure-flags
(list "--disable-crashreporter"
"--disable-tests"
"--disable-debug"
"--disable-updater"
"--enable-mozril-geoloc"
"--disable-webrtc"
"--disable-safe-browsing"
"--disable-parental-controls"
"--enable-release"
"--disable-necko-wifi"
"--disable-eme"
"--disable-gamepad"
"--enable-dbus"
2021-05-03 11:38:30 +02:00
"--enable-strip"
"--enable-install-strip"
2021-03-09 22:40:05 +01:00
"--enable-application=browser"
"--with-branding=browser/branding/arcticfox"
"--enable-optimize=-O2"
"--with-distribution-id=org.gnu"
2021-05-04 08:38:44 +02:00
"--enable-default-toolkit=cairo-gtk3"
2021-03-21 13:58:39 +01:00
"--with-system-bz2"
2021-05-24 13:05:20 +02:00
;"--with-system-icu" ; linker error on i686-linux
2021-05-04 08:38:44 +02:00
"--with-system-jpeg" ; must be libjpeg-turbo
2021-03-21 13:58:39 +01:00
;"--with-system-libevent" ; seems to be incompatable
"--with-system-libvpx"
2021-03-09 22:40:05 +01:00
"--with-system-nspr"
"--with-system-nss"
"--with-system-png"
2021-05-04 08:38:44 +02:00
;"--with-system-webp" ; not picked up
2021-03-21 13:58:39 +01:00
"--with-system-zlib"
2021-05-04 08:38:44 +02:00
"--disable-debug-symbols"
2021-03-21 13:58:39 +01:00
"--enable-system-cairo"
2021-05-04 08:38:44 +02:00
"--enable-system-ffi"
2021-03-21 13:58:39 +01:00
"--enable-system-hunspell"
"--enable-system-pixman"
2021-05-06 15:36:44 +02:00
"--enable-system-sqlite") ; lacking SQLITE_THREADSAFE?
2021-03-09 22:40:05 +01:00
#:phases
(modify-phases %standard-phases
2021-03-19 16:15:15 +01:00
(delete 'bootstrap)
2021-05-06 15:36:44 +02:00
(add-after 'unpack 'link-ffmpeg
(lambda* (#:key inputs #:allow-other-keys)
(let ((ffmpeg (assoc-ref inputs "ffmpeg")))
(substitute* "dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp"
(("libavcodec\\.so" all)
2022-01-02 09:27:26 +01:00
(string-append ffmpeg "/lib/" all))))))
2021-03-09 22:40:05 +01:00
(replace 'configure
;; configure does not work followed by both "SHELL=..." and
;; "CONFIG_SHELL=..."; set environment variables instead
2021-05-03 11:38:30 +02:00
(lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
2021-03-09 22:40:05 +01:00
(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)))
2021-03-19 16:15:15 +01:00
;; Write the configure-flags to .mozconfig for use with ./mach
(with-output-to-file ".mozconfig"
(lambda _
2021-05-03 11:38:30 +02:00
(format #t "export LDFLAGS=\"-Wl,-rpath=~a/lib/arcticfox-~a\"~@
2021-03-19 16:15:15 +01:00
mk_add_options MOZ_MAKE_FLAGS=\"-s -j~a\"~@
~{ac_add_options ~a\n~} ~%"
2022-01-02 09:27:26 +01:00
out ,(version-major+minor version)
2021-04-01 16:16:39 +02:00
(number->string (parallel-job-count)) flags)))
2021-03-09 22:40:05 +01:00
(setenv "SHELL" bash)
(setenv "CONFIG_SHELL" bash)
2021-05-03 11:38:30 +02:00
(setenv "AUTOCONF"
(string-append (assoc-ref inputs "autoconf")
"/bin/autoconf")) ; must be autoconf-2.13
2021-05-06 15:36:44 +02:00
(setenv "CC" ,(cc-for-target))
2021-05-03 11:38:30 +02:00
(setenv "CXX" ,(cxx-for-target))
2021-03-09 22:40:05 +01:00
(setenv "MOZ_BUILD_DATE" "20210130000000") ; avoid timestamp
(format #t "build directory: ~s~%" (getcwd))
2021-04-01 16:16:39 +02:00
(format #t "configure flags: ~s~%" flags)
(invoke "./mach" "configure"))))
2021-03-09 22:40:05 +01:00
(replace 'build
(lambda _ (invoke "./mach" "build")))
2021-04-01 16:16:39 +02:00
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
2022-01-02 09:27:26 +01:00
(invoke "./mach" "test"))))
2021-03-09 22:40:05 +01:00
(replace 'install
2021-03-19 16:15:15 +01:00
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
2022-01-02 09:27:26 +01:00
(invoke "./mach" "install"))))
2021-05-06 15:36:44 +02:00
(add-after 'install 'install-desktop-file
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(apps (string-append out "/share/applications")))
(mkdir-p apps)
(with-output-to-file (string-append apps "/arcticfox.desktop")
(lambda _
(format #t
"[Desktop Entry]~@
Name=Arcticfox~@
Version=1.0~@
Exec=~a/bin/arcticfox %u~@
Icon=arcticfox~@
Comment=Browse the World Wide Web~@
GenericName=Web Browser~@
Keywords=Internet;WWW;Browser;Web;Explorer~@
Terminal=false~@
X-MultipleArgs=false~@
Type=Application~@
Categories=Network;WebBrowser;~@
MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;~@
StartupNotify=true~@
[Desktop Action new-window]~@
Name=Open a New Window~@
Exec=~@*~a/bin/arcticfox -new-window%"
2022-01-02 09:27:26 +01:00
out))))))
2021-05-04 08:38:44 +02:00
(add-after 'install 'wrap-program
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(lib (string-append out "/lib"))
(gtk (assoc-ref inputs "gtk+"))
(gtk-share (string-append gtk "/share"))
(mesa (assoc-ref inputs "mesa"))
(mesa-lib (string-append mesa "/lib"))
(libpng (assoc-ref inputs "libpng"))
(libpng-lib (string-append libpng "/lib"))
2021-05-04 08:38:44 +02:00
(pulseaudio (assoc-ref inputs "pulseaudio"))
(pulseaudio-lib (string-append pulseaudio "/lib")))
(wrap-program (car (find-files lib "^arcticfox$"))
`("XDG_DATA_DIRS" prefix (,gtk-share))
2022-01-02 09:27:26 +01:00
`("LD_LIBRARY_PATH" prefix (,pulseaudio-lib ,mesa-lib ,libpng-lib)))))))))
2021-03-09 22:40:05 +01:00
(native-inputs
2021-04-01 16:16:39 +02:00
`(("autoconf" ,((@@ (gnu packages autotools)
make-autoconf-wrapper) autoconf-2.13))
2021-03-09 22:40:05 +01:00
("automake" ,automake)
2022-01-02 09:27:26 +01:00
;("gcc" ,gcc-6) ; not gcc-7
2021-03-09 22:40:05 +01:00
("perl" ,perl)
("pkg-config" ,pkg-config)
("python" ,python-2)
2021-05-04 08:38:44 +02:00
("unzip" ,unzip)
2021-03-09 22:40:05 +01:00
("which" ,(@ (gnu packages base) which))
2021-05-04 08:38:44 +02:00
("yasm" ,yasm)
("zip" ,zip)))
2021-03-09 22:40:05 +01:00
(inputs
2021-03-19 16:15:15 +01:00
`(("alsa-lib" ,alsa-lib)
2022-01-02 09:27:26 +01:00
("bash-minimal" ,bash-minimal)
2021-05-04 08:38:44 +02:00
("cairo" ,cairo)
2021-03-09 22:40:05 +01:00
("dbus-glib" ,dbus-glib)
2021-05-06 15:36:44 +02:00
("ffmpeg" ,ffmpeg)
2022-01-02 09:27:26 +01:00
("gdk-pixbuf" ,gdk-pixbuf)
2021-03-09 22:40:05 +01:00
("glib" ,glib)
2022-01-02 09:27:26 +01:00
("gtk+@2" ,gtk+-2)
2021-03-21 13:58:39 +01:00
("gtk+" ,gtk+)
("hunspell" ,hunspell)
2021-05-24 13:05:20 +02:00
;("icu4c" ,icu4c)
("libpng" ,libpng-apng)
2021-03-21 13:58:39 +01:00
("libjpeg-turbo" ,libjpeg-turbo)
2021-03-19 16:15:15 +01:00
;("libevent" ,libevent)
2021-05-04 08:38:44 +02:00
("libffi" ,libffi)
2022-01-02 09:27:26 +01:00
;("librsvg" ,librsvg)
2021-03-21 13:58:39 +01:00
("libvpx" ,libvpx)
2021-05-04 08:38:44 +02:00
;("libwebp" ,libwebp)
2021-03-09 22:40:05 +01:00
("libxt" ,libxt)
2021-03-21 13:58:39 +01:00
("mesa" ,mesa)
2021-03-09 22:40:05 +01:00
("nspr" ,nspr)
("nss" ,nss)
2021-05-04 08:38:44 +02:00
("pixman" ,pixman)
2021-03-09 22:40:05 +01:00
("pulseaudio" ,pulseaudio)
2021-05-04 08:38:44 +02:00
("python" ,python-2)
2021-03-21 13:58:39 +01:00
("sqlite" ,sqlite)
2021-05-03 11:38:30 +02:00
("zlib" ,zlib)))
2021-03-09 22:40:05 +01:00
(home-page "https://github.com/wicknix/Arctic-Fox")
2021-05-04 08:38:44 +02:00
(synopsis "Web Browser for older machines")
(description "Arctic Fox aims to be a desktop oriented browser for older
devices. It's goal is to implement specific security updates and bug fixes to
keep this browser as up to date as possible for aging systems.")
2021-03-09 22:40:05 +01:00
(license license:mpl2.0))))