summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/patches/netsurf-system-utf8proc.patch64
-rw-r--r--gnu/packages/web.scm54
3 files changed, 93 insertions, 26 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 20fe3a2f25..0e79b6762f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -772,6 +772,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/net-tools-bitrot.patch			\
   %D%/packages/patches/netcdf-date-time.patch			\
   %D%/packages/patches/netcdf-tst_h_par.patch			\
+  %D%/packages/patches/netsurf-system-utf8proc.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-system-utf8proc.patch b/gnu/packages/patches/netsurf-system-utf8proc.patch
new file mode 100644
index 0000000000..254bf52c93
--- /dev/null
+++ b/gnu/packages/patches/netsurf-system-utf8proc.patch
@@ -0,0 +1,64 @@
+Use upstream utf8proc package, as suggested in
+http://source.netsurf-browser.org/libutf8proc.git/commit/?id=770e329cceaf0620c7b482589a9b17ed1d19c16d
+
+Work around upstream's lack of a pkg-config file and update API.
+
+--- netsurf-3.6/Makefile
++++ netsurf-3.6/Makefile
+@@ -527,10 +527,9 @@
+ $(eval $(call pkg_config_find_and_add,libcss,CSS))
+ $(eval $(call pkg_config_find_and_add,libdom,DOM))
+ $(eval $(call pkg_config_find_and_add,libnsutils,nsutils))
+-$(eval $(call pkg_config_find_and_add,libutf8proc,utf8proc))
+ 
+ # Common libraries without pkg-config support
+-LDFLAGS += -lz
++LDFLAGS += -lz -lutf8proc
+ 
+ # Optional libraries with pkgconfig
+ 
+--- netsurf-3.6/utils/idna.c
++++ netsurf-3.6/utils/idna.c
+@@ -26,7 +26,7 @@
+ #include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <libutf8proc/utf8proc.h>
++#include <utf8proc.h>
+ 
+ #include "utils/errors.h"
+ #include "utils/idna.h"
+@@ -250,7 +250,7 @@
+ 		return NSERROR_NOMEM;
+ 	}
+ 
+-	nfc_size = utf8proc_normalise(nfc_label, nfc_size,
++	nfc_size = utf8proc_normalize_utf32(nfc_label, nfc_size,
+ 		UTF8PROC_STABLE | UTF8PROC_COMPOSE);
+ 	if (nfc_size < 0) {
+ 		return NSERROR_NOMEM;
+@@ -565,7 +565,7 @@
+ 	}
+ 
+ 	/* Perform NFC normalisation */
+-	ucs4_len = utf8proc_normalise(ucs4, u_ucs4_len,
++	ucs4_len = utf8proc_normalize_utf32(ucs4, u_ucs4_len,
+ 		UTF8PROC_STABLE | UTF8PROC_COMPOSE);
+ 	if (ucs4_len < 0) {
+ 		free(ucs4);
+--- netsurf-3.6/test/Makefile
++++ netsurf-3.6/test/Makefile
+@@ -112,11 +112,11 @@
+ 		-D_XOPEN_SOURCE=600 \
+ 		-Itest -Iinclude -Icontent/handlers -Ifrontends -I. -I.. \
+ 		-Dnsgtk \
+-		$(shell pkg-config --cflags libcurl libparserutils libwapcaplet libdom libnsutils libutf8proc libidn) \
++		$(shell pkg-config --cflags libcurl libparserutils libwapcaplet libdom libnsutils libidn) \
+ 		$(LIB_CFLAGS) \
+ 		$(COV_CFLAGS)
+ 
+-TESTLDFLAGS := $(shell pkg-config --libs libcurl libparserutils libwapcaplet libdom libnsutils libutf8proc libidn) -lz \
++TESTLDFLAGS := $(shell pkg-config --libs libcurl libparserutils libwapcaplet libdom libnsutils libidn) -lz -lutf8proc \
+ 		$(LIB_LDFLAGS)\
+ 		$(COV_LDFLAGS)
+ 
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 7d8cd29a58..1584b93beb 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -4071,32 +4071,41 @@ w3c webidl files and a binding configuration file.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "http://download.netsurf-browser.org/"
-                           "netsurf/releases/source-full/netsurf-all-"
-                           version ".tar.gz"))
+       (uri (string-append "http://download.netsurf-browser.org/netsurf/"
+                           "releases/source/netsurf-" version "-src.tar.gz"))
        (sha256
         (base32
-         "1cgq9n4nvkpih93sfpdadv3666ycsx9bnp8kwalbs8h232mr7ppx"))))
+         "174sjx0566agckwmlj4w2cip5qbxdiafyhlp185a1qprxx84pbjr"))
+       (patches (search-patches "netsurf-system-utf8proc.patch"))))
     (build-system glib-or-gtk-build-system)
     (native-inputs
-     `(("pkg-config" ,pkg-config)
+     `(("netsurf-buildsystem" ,netsurf-buildsystem)
+       ("nsgenbind" ,nsgenbind)
        ("perl" ,perl)
        ("perl-html-parser" ,perl-html-parser)
-       ("flex" ,flex)
-       ("bison" ,bison)))
+       ("pkg-config" ,pkg-config)))
     (inputs
-     `(("gtk+" ,gtk+-2)
-       ("gperf" ,gperf)
-       ("curl" ,curl)
+     `(("curl" ,curl)
+       ("gtk+" ,gtk+-2)
        ("openssl" ,openssl)
+       ("utf8proc" ,utf8proc)
        ("libpng" ,libpng)
        ("libjpeg" ,libjpeg)
-       ("expat" ,expat)))
+       ("libcss" ,libcss)
+       ("libdom" ,libdom)
+       ("libnsbmp" ,libnsbmp)
+       ("libnsgif" ,libnsgif)
+       ("libnspsl" ,libnspsl)
+       ("libnsutils" ,libnsutils)
+       ("libsvgtiny" ,libsvgtiny)))
     (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
+                      ,(string-append "PREFIX=" %output)
+                      ,(string-append "NSSHARED="
+                                      (assoc-ref %build-inputs
+                                                 "netsurf-buildsystem")
+                                      "/share/netsurf-buildsystem"))
+       #:tests? #f
        #:modules ((ice-9 rdelim)
                   (ice-9 match)
                   (srfi srfi-1)
@@ -4104,18 +4113,11 @@ w3c webidl files and a binding configuration file.")
                   ,@%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))
+         (delete 'configure)
          (add-after 'build 'adjust-welcome
            (lambda _
              ;; First, fix some unended tags and simple substitutions
-             (substitute* "netsurf/frontends/gtk/res/welcome.html"
+             (substitute* "frontends/gtk/res/welcome.html"
                (("<(img|input)([^>]*)>" _ tag contents)
                 (string-append "<" tag contents " />"))
                (("Licence") "License") ;prefer GNU spelling
@@ -4126,7 +4128,7 @@ w3c webidl files and a binding configuration file.")
                (("Google Search") "DuckDuckGo Search")
                (("name=\"btnG\"") ""))
              ;; Remove default links so it doesn't seem we're endorsing them
-             (with-atomic-file-replacement "netsurf/frontends/gtk/res/welcome.html"
+             (with-atomic-file-replacement "frontends/gtk/res/welcome.html"
                (lambda (in out)
                  ;; Leave the DOCTYPE header as is
                  (display (read-line in 'concat) out)
@@ -4148,13 +4150,13 @@ w3c webidl files and a binding configuration file.")
                     (desktop (string-append out "/share/applications/"
                                             "netsurf.desktop")))
                (mkdir-p (dirname desktop))
-               (copy-file "netsurf/frontends/gtk/res/netsurf-gtk.desktop"
+               (copy-file "frontends/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"
+               (install-file "Docs/netsurf-gtk.1"
                              (string-append out "/share/man/man1/"))
                #t))))))
     (home-page "http://www.netsurf-browser.org")