diff options
author | Eric Bavier <bavier@member.fsf.org> | 2016-07-07 00:55:41 -0500 |
---|---|---|
committer | Eric Bavier <bavier@member.fsf.org> | 2016-08-17 22:08:32 -0500 |
commit | 22df70010aed4254e8bcf8cd8efe47cfcf87a3bd (patch) | |
tree | c51e0ff05523688a6b5e25b0ef44c00354ce6c8f | |
parent | d1cada0450fca54260fd20ab49d0586d147cbeb3 (diff) | |
download | guix-22df70010aed4254e8bcf8cd8efe47cfcf87a3bd.tar guix-22df70010aed4254e8bcf8cd8efe47cfcf87a3bd.tar.gz |
gnu: Add NetSurf.
* gnu/packages/web.scm (netsurf): New variable.
* gnu/packages/patches/netsurf-about.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Add it.
-rw-r--r-- | gnu/local.mk | 1 | ||||
-rw-r--r-- | gnu/packages/patches/netsurf-about.patch | 26 | ||||
-rw-r--r-- | gnu/packages/web.scm | 116 |
3 files changed, 143 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index d89004611b..53621d8b94 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -674,6 +674,7 @@ dist_patch_DATA = \ %D%/packages/patches/nasm-no-ps-pdf.patch \ %D%/packages/patches/net-tools-bitrot.patch \ %D%/packages/patches/netcdf-config-date.patch \ + %D%/packages/patches/netsurf-about.patch \ %D%/packages/patches/ngircd-handle-zombies.patch \ %D%/packages/patches/ngircd-no-dns-in-tests.patch \ %D%/packages/patches/ninja-tests.patch \ diff --git a/gnu/packages/patches/netsurf-about.patch b/gnu/packages/patches/netsurf-about.patch new file mode 100644 index 0000000000..1fb8eae824 --- /dev/null +++ b/gnu/packages/patches/netsurf-about.patch @@ -0,0 +1,26 @@ +--- netsurf-all-3.5/netsurf/gtk/about.c ++++ netsurf-all-3.5/netsurf/gtk/about.c +@@ -79,11 +79,11 @@ + switch (response_id) { + + case ABOUT_RESPONSE_ID_LICENCE: +- about_open("about:credits"); ++ about_open("about:licence"); + break; + + case ABOUT_RESPONSE_ID_CREDITS: +- about_open("about:licence"); ++ about_open("about:credits"); + break; + } + +--- netsurf-all-3.5/netsurf/desktop/version.c ++++ netsurf-all-3.5/netsurf/desktop/version.c +@@ -20,6 +20,6 @@ + + #include "desktop/version.h" + +-const char * const netsurf_version = "3.5 (6th April 1016)"; ++const char * const netsurf_version = "3.5 (6th April 2016)"; + const int netsurf_version_major = 3; + const int netsurf_version_minor = 5; diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm index d4b59ddece..29055c3c06 100644 --- a/gnu/packages/web.scm +++ b/gnu/packages/web.scm @@ -52,12 +52,17 @@ #:use-module (gnu packages compression) #:use-module (gnu packages cyrus-sasl) #:use-module (gnu packages databases) + #:use-module (gnu packages bison) + #:use-module (gnu packages flex) #:use-module (gnu packages mit-krb5) #:use-module (gnu packages gd) #:use-module (gnu packages gettext) #:use-module (gnu packages glib) #:use-module (gnu packages gnome) + #:use-module (gnu packages gperf) + #:use-module (gnu packages gtk) #:use-module (gnu packages icu4c) + #:use-module (gnu packages image) #:use-module (gnu packages lua) #:use-module (gnu packages base) #:use-module (gnu packages perl) @@ -3389,3 +3394,114 @@ playback of HTTP request/response traces.") can easily be invoked on a single file. Your partner can access the file with tools they trust (e.g. wget).") (license l:gpl2+))) + +(define-public netsurf + (package + (name "netsurf") + (version "3.5") + (source + (origin + (method url-fetch) + (uri (string-append "https://download.netsurf-browser.org/" + "netsurf/releases/source-full/netsurf-all-" + version ".tar.gz")) + (sha256 + (base32 + "1vdldzcv42wykajmw8vbql0f1yd44gbx30kywfrrh2x3064ly609")) + (modules '((guix build utils))) + (snippet + '(begin + (substitute* "Makefile" + ;; Do not clobber PKG_CONFIG_PATH from the environment + (("PKG_CONFIG_PATH = \\$") + "PKG_CONFIG_PATH := $(PKG_CONFIG_PATH):$") + ;; Honor make variables + (("shell cc") "shell $(CC)")))) + (patches (search-patches "netsurf-about.patch")))) + (build-system glib-or-gtk-build-system) + (native-inputs + `(("pkg-config" ,pkg-config) + ("perl" ,perl) + ("perl-html-parser" ,perl-html-parser) + ("flex" ,flex) + ("bison" ,bison))) + (inputs + `(("gtk+" ,gtk+-2) + ("gperf" ,gperf) + ("curl" ,curl) + ("openssl" ,openssl) + ("libpng" ,libpng) + ("libjpeg" ,libjpeg) + ("expat" ,expat))) + (arguments + `(#:make-flags `("CC=gcc" "BUILD_CC=gcc" + ,(string-append "PREFIX=" %output)) + #:parallel-build? #f ;parallel builds not supported + #:tests? #f ;no way to easily run from release tarball + #:modules ((ice-9 rdelim) + (ice-9 match) + (srfi srfi-1) + (sxml simple) + ,@%glib-or-gtk-build-system-modules) + #:phases + (modify-phases %standard-phases + (replace 'configure + (lambda _ + (call-with-output-file "netsurf/Makefile.config" + (lambda (port) + (format port "~ + NETSURF_GTK_RESOURCES := $(PREFIX)/share/netsurf/~@ + "))) + #t)) + (add-after 'build 'adjust-welcome + (lambda _ + ;; First, fix some unended tags and simple substitutions + (substitute* "netsurf/gtk/res/welcome.html" + (("<(img|input)([^>]*)>" _ tag contents) + (string-append "<" tag contents " />")) + (("Licence") "License") ;prefer GNU spelling + ((" open source") ", free software") + (("web site") "website") + ;; Prefer privacy-respecting default search engine + (("www.google.co.uk") "www.duckduckgo.com/html") + (("Google Search") "DuckDuckGo Search") + (("name=\"btnG\"") "")) + ;; Remove default links so it doesn't seem we're endorsing them + (with-atomic-file-replacement "netsurf/gtk/res/welcome.html" + (lambda (in out) + ;; Leave the DOCTYPE header as is + (display (read-line in 'concat) out) + (sxml->xml + (let rec ((sxml (xml->sxml in))) + ;; We'd like to use sxml-match here, but it can't + ;; match against generic tag symbols... + (match sxml + (`(div (@ (class "links")) . ,rest) + '()) + ((x ...) + (map rec x)) + (x x))) + out))) + #t)) + (add-after 'install 'install-more + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (desktop (string-append out "/share/applications/" + "netsurf.desktop"))) + (mkdir-p (dirname desktop)) + (copy-file "netsurf/gtk/res/netsurf-gtk.desktop" + desktop) + (substitute* desktop + (("netsurf-gtk") (string-append out "/bin/netsurf")) + (("netsurf.png") (string-append out "/share/netsurf/" + "netsurf.xpm"))) + (install-file "netsurf/Docs/netsurf-gtk.1" + (string-append out "/share/man/man1/")) + #t)))))) + (home-page "https://www.netsurf-browser.org") + (synopsis "Web browser") + (description + "NetSurf is a lightweight web browser that has its own layout and +rendering engine entirely written from scratch. It is small and capable of +handling many of the web standards in use today.") + (license l:gpl2+))) |