unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: Add NetSurf.
@ 2016-08-11 12:59 ericbavier
  2016-08-16  6:03 ` Eric Bavier
  0 siblings, 1 reply; 3+ messages in thread
From: ericbavier @ 2016-08-11 12:59 UTC (permalink / raw)
  To: guix-devel; +Cc: Eric Bavier

From: Eric Bavier <bavier@member.fsf.org>

* gnu/packages/web.scm (netsurf): New variable.
---
 gnu/packages/web.scm | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 111 insertions(+)

diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index fa791ff..1d0c97e 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)
@@ -3385,3 +3390,109 @@ 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)"))))))
+    (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                      ;TODO
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (call-with-output-file "netsurf/Makefile.config"
+               (lambda (port)
+                 (format port "~
+                         NETSURF_GTK_RESOURCES := $(PREFIX)/share/netsurf/~@
+                         ")))
+             #t))
+         (add-after 'build 'adjust-welcome
+           (lambda* _
+             (use-modules (sxml simple))
+             ;; 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")
+               ;; Prefer privacy-respecting default search engine
+               (("www.google.co.uk") "www.duckduckgo.com")
+               (("Google Search") "DuckDuckGo Search"))
+             ;; TODO: Are the search inputs appropriate?
+             ;; 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 #:entities '((nbsp . "\xa0")))))
+                    ;; We'd like to use sxml-match here, but it can't
+                    ;; match against generic tag symbols...
+                    (match sxml
+                      (('div ('@ ('class "links")) . rest)
+                       '())
+                      ((head tail ...)
+                       (cons (rec head) (map rec tail)))
+                      (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 web browser.  NetSurf 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+)))
-- 
2.9.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gnu: Add NetSurf.
  2016-08-11 12:59 [PATCH] gnu: Add NetSurf ericbavier
@ 2016-08-16  6:03 ` Eric Bavier
  2016-08-16  7:43   ` Alex Kost
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Bavier @ 2016-08-16  6:03 UTC (permalink / raw)
  To: guix-devel; +Cc: Eric Bavier

[-- Attachment #1: Type: text/plain, Size: 324 bytes --]

On Thu, 11 Aug 2016 07:59:15 -0500
ericbavier@openmailbox.org wrote:

> From: Eric Bavier <bavier@member.fsf.org>
> 
> * gnu/packages/web.scm (netsurf): New variable.
> ---
>  gnu/packages/web.scm | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 111 insertions(+)

Updated patch attached.

`~Eric

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-NetSurf.patch --]
[-- Type: text/x-patch, Size: 8038 bytes --]

From 3aa59b69066d8850b3f62d05020df5aae0fbded3 Mon Sep 17 00:00:00 2001
From: Eric Bavier <bavier@member.fsf.org>
Date: Thu, 7 Jul 2016 00:55:41 -0500
Subject: [PATCH] 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.
---
 gnu/local.mk                             |   1 +
 gnu/packages/patches/netsurf-about.patch |  26 +++++++
 gnu/packages/web.scm                     | 116 +++++++++++++++++++++++++++++++
 3 files changed, 143 insertions(+)
 create mode 100644 gnu/packages/patches/netsurf-about.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index b7fa1c5..989ebb8 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -671,6 +671,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 0000000..1fb8eae
--- /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 9106295..637672e 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* (#:key outputs #:allow-other-keys)
+             (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&nbsp;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+)))
-- 
2.9.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gnu: Add NetSurf.
  2016-08-16  6:03 ` Eric Bavier
@ 2016-08-16  7:43   ` Alex Kost
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Kost @ 2016-08-16  7:43 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel, Eric Bavier

Eric Bavier (2016-08-16 09:03 +0300) wrote:

Impressive work on this package, thanks!

> From 3aa59b69066d8850b3f62d05020df5aae0fbded3 Mon Sep 17 00:00:00 2001
> From: Eric Bavier <bavier@member.fsf.org>
> Date: Thu, 7 Jul 2016 00:55:41 -0500
> Subject: [PATCH] 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.
[...]
> +    (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* (#:key outputs #:allow-other-keys)

'outputs' arg is not used in this phase, so it can simply be (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* _

Just 'lambda' (without *)

> +             ;; 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&nbsp;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+)))

-- 
Alex

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-16  7:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-11 12:59 [PATCH] gnu: Add NetSurf ericbavier
2016-08-16  6:03 ` Eric Bavier
2016-08-16  7:43   ` Alex Kost

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).