commit:     40d19fcb0752ceae57a1fb8e5f802e05ee915b8a
Author:     Mike Skec <skec <AT> protonmail <DOT> ch>
AuthorDate: Sun May  8 01:11:01 2022 +0000
Commit:     Quentin Retornaz <gentoo <AT> retornaz <DOT> com>
CommitDate: Mon May  9 18:35:02 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=40d19fcb

www-client/netsurf: added package

Uses patches from OpenBSD ports for LibreSSL 3.5+ support.
Signed-off-by: Mike Skec <skec <AT> protonmail.ch>
Closes: https://github.com/gentoo/libressl/pull/406
Signed-off-by: Quentin Retornaz <gentoo <AT> retornaz.com>

 www-client/netsurf/Manifest                        |   1 +
 .../files/netsurf-3.10-disable-failing-tests.patch |  42 ++++++
 .../files/netsurf-3.10-gcc10-fno-common.patch      |  23 ++++
 ...rf-3.10-julia-libutf8proc-header-location.patch |  34 +++++
 .../netsurf/files/netsurf-3.10-libressl-3.5.patch  |  42 ++++++
 ...f-3.9-conditionally-include-image-headers.patch |  35 +++++
 www-client/netsurf/metadata.xml                    |  40 ++++++
 www-client/netsurf/netsurf-3.10-r6.ebuild          | 153 +++++++++++++++++++++
 8 files changed, 370 insertions(+)

diff --git a/www-client/netsurf/Manifest b/www-client/netsurf/Manifest
new file mode 100644
index 0000000..974348b
--- /dev/null
+++ b/www-client/netsurf/Manifest
@@ -0,0 +1 @@
+DIST netsurf-3.10-src.tar.gz 4084480 BLAKE2B 
267ce1811cbf11d053f721e22b8a6d484e796102a4c9baaa10580d92cc1eecfe3f126fb97456262675c962ec88a5235e48dc85f2a5168631f6c9dd5b5082b43b
 SHA512 
1b1153916438e08146271dc04200aefbdba3b2c4ca9432a43abfc3811b5418df7ed21bbd91767f12d04331a236227379d2c412fcf13f25349685a549723bf13d

diff --git a/www-client/netsurf/files/netsurf-3.10-disable-failing-tests.patch 
b/www-client/netsurf/files/netsurf-3.10-disable-failing-tests.patch
new file mode 100644
index 0000000..6ffcec0
--- /dev/null
+++ b/www-client/netsurf/files/netsurf-3.10-disable-failing-tests.patch
@@ -0,0 +1,42 @@
+From 4c3d6b10802b6747ba36b6e7c988f6b584352358 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <[email protected]>
+Date: Wed, 17 Jun 2020 17:42:34 -0400
+Subject: [PATCH 1/1] test: disable failing tests.
+
+Just cut them right out of the Makefile if they ain't gonna work.
+
+Bug: https://bugs.gentoo.org/687378
+Upstream-bug: https://bugs.netsurf-browser.org/mantis/view.php?id=2779
+---
+ test/Makefile | 8 --------
+ 1 file changed, 8 deletions(-)
+
+diff --git a/test/Makefile b/test/Makefile
+index 82ffee6..952d238 100644
+--- a/test/Makefile
++++ b/test/Makefile
+@@ -5,8 +5,6 @@ TESTS := \
+       nsurl \
+       urldbtest \
+       nsoption \
+-      bloom \
+-      hashtable \
+       hashmap \
+       urlescape \
+       utils \
+@@ -47,12 +45,6 @@ messages_SRCS := utils/messages.c utils/hashtable.c 
test/log.c test/messages.c
+ # nsoption test sources
+ nsoption_SRCS := utils/nsoption.c test/log.c test/nsoption.c
+ 
+-# Bloom filter test sources
+-bloom_SRCS := utils/bloom.c test/bloom.c
+-
+-# hash table test sources
+-hashtable_SRCS := utils/hashtable.c test/log.c test/hashtable.c
+-
+ # hashmap test sources
+ hashmap_SRCS := $(NSURL_SOURCES) utils/hashmap.c utils/corestrings.c 
test/log.c test/hashmap.c
+ hashmap_LD := -lmalloc_fig
+-- 
+2.26.2
+

diff --git a/www-client/netsurf/files/netsurf-3.10-gcc10-fno-common.patch 
b/www-client/netsurf/files/netsurf-3.10-gcc10-fno-common.patch
new file mode 100644
index 0000000..677004c
--- /dev/null
+++ b/www-client/netsurf/files/netsurf-3.10-gcc10-fno-common.patch
@@ -0,0 +1,23 @@
+Backport of upstream fix: 
https://git.netsurf-browser.org/netsurf.git/commit/?id=434f6c3fe7d1d2c6a3e6ae6338608a4a4421ab1b
+
+https://bugs.netsurf-browser.org/mantis/view.php?id=2778
+https://bugs.gentoo.org/835379
+--- a/frontends/framebuffer/convert_font.c
++++ b/frontends/framebuffer/convert_font.c
+@@ -290,14 +290,14 @@ bool generate_font_header(const char *path, struct 
font_data *data)
+ 
+ 
+       for (s = 0; s < 4; s++) {
+-              fprintf(fp, "const uint8_t *%s_section_table;\n",
++              fprintf(fp, "extern const uint8_t *%s_section_table;\n",
+                       var_lables[s]);
+-              fprintf(fp, "const uint16_t *%s_sections;\n",
++              fprintf(fp, "extern const uint16_t *%s_sections;\n",
+                       var_lables[s]);
+ 
+       }
+ 
+-      fprintf(fp, "const uint8_t *font_glyph_data;\n");
++      fprintf(fp, "extern const uint8_t *font_glyph_data;\n");
+ 
+       fprintf(fp, "\n\n");

diff --git 
a/www-client/netsurf/files/netsurf-3.10-julia-libutf8proc-header-location.patch 
b/www-client/netsurf/files/netsurf-3.10-julia-libutf8proc-header-location.patch
new file mode 100644
index 0000000..3a6ccc2
--- /dev/null
+++ 
b/www-client/netsurf/files/netsurf-3.10-julia-libutf8proc-header-location.patch
@@ -0,0 +1,34 @@
+From d585a1573819306bb3660db3f13a85b2fd254c63 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <[email protected]>
+Date: Wed, 17 Jun 2020 17:23:10 -0400
+Subject: [PATCH 1/1] utils/idna.c: adjust utf8proc.h header location.
+
+There are two upstreams for libutf8proc, and they each put utf8proc.h
+in a different location -- ostensibly as a performance art piece
+intended to remind the programmer that we as human beings are all
+slowly dying, and that our limited time here on earth should not be
+wasted. This commit switches the header location from the netsurf-
+upstream one that used to work, to the julia-upstream location that
+works now (that the Gentoo package follows the julia upstream).
+
+Bug: https://bugs.gentoo.org/721318
+---
+ utils/idna.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/utils/idna.c b/utils/idna.c
+index 628ef1f..f6e498a 100644
+--- a/utils/idna.c
++++ b/utils/idna.c
+@@ -167,7 +167,7 @@ idna__ace_to_ucs4(const char *ace_label,
+ 
+ #ifdef WITH_UTF8PROC
+ 
+-#include <libutf8proc/utf8proc.h>
++#include <utf8proc.h>
+ 
+ int32_t idna_contexto[] = {
+       /* CONTEXTO codepoints which have a rule defined */
+-- 
+2.26.2
+

diff --git a/www-client/netsurf/files/netsurf-3.10-libressl-3.5.patch 
b/www-client/netsurf/files/netsurf-3.10-libressl-3.5.patch
new file mode 100644
index 0000000..d9add88
--- /dev/null
+++ b/www-client/netsurf/files/netsurf-3.10-libressl-3.5.patch
@@ -0,0 +1,42 @@
+X509_get_signature_nid(), ASN1_STRING_get0_data(), RSA_bits() and DH_bits()
+have been available since LibreSSL 2.7.
+DSA_bits(), RSA_get0_n(), RSA_get0_e() will be available in LibreSSL 3.5.
+
+Index: content/fetchers/about.c
+--- a/content/fetchers/about.c
++++ b/content/fetchers/about.c
+@@ -538,7 +538,8 @@ static nserror free_ns_cert_info(struct ns_cert_info *
+ /* OpenSSL 1.0.x, 1.0.2, 1.1.0 and 1.1.1 API all changed
+  * LibreSSL declares its OpenSSL version as 2.1 but only supports 1.0.x API
+  */
+-#if (defined(LIBRESSL_VERSION_NUMBER) || (OPENSSL_VERSION_NUMBER < 
0x1010000fL))
++#if (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 
0x3050000fL) || \
++      (OPENSSL_VERSION_NUMBER < 0x1010000fL)
+ /* 1.0.x */
+
+ #if (defined(LIBRESSL_VERSION_NUMBER) || (OPENSSL_VERSION_NUMBER < 
0x1000200fL))
+@@ -609,7 +610,7 @@ static const BIGNUM *ns_RSA_get0_e(const RSA *r)
+ #define ns_DH_bits DH_bits
+
+ #else
+-/* 1.1.1 and later */
++/* 1.1.1 and later, LibreSSL 3.5.0 and later */
+ #define ns_X509_get_signature_nid X509_get_signature_nid
+ #define ns_ASN1_STRING_get0_data ASN1_STRING_get0_data
+ #define ns_RSA_get0_n RSA_get0_n
+
+X509_up_ref has been available since LibreSSL 2.5.
+X509_free has always been available.
+
+Index: content/fetchers/curl.c
+--- a/content/fetchers/curl.c
++++ b/content/fetchers/curl.c
+@@ -92,7 +92,7 @@
+ /* OpenSSL 1.0.x to 1.1.0 certificate reference counting changed
+  * LibreSSL declares its OpenSSL version as 2.1 but only supports the old way
+  */
+-#if (defined(LIBRESSL_VERSION_NUMBER) || (OPENSSL_VERSION_NUMBER < 
0x1010000fL))
++#if (OPENSSL_VERSION_NUMBER < 0x1010000fL)
+ static int ns_X509_up_ref(X509 *cert)
+ {
+       cert->references++;

diff --git 
a/www-client/netsurf/files/netsurf-3.9-conditionally-include-image-headers.patch
 
b/www-client/netsurf/files/netsurf-3.9-conditionally-include-image-headers.patch
new file mode 100644
index 0000000..603c209
--- /dev/null
+++ 
b/www-client/netsurf/files/netsurf-3.9-conditionally-include-image-headers.patch
@@ -0,0 +1,35 @@
+diff -rup a/content/handlers/image/image.c b/content/handlers/image/image.c
+--- a/content/handlers/image/image.c   2019-07-17 10:28:13.000000000 +0000
++++ b/content/handlers/image/image.c   2019-09-27 15:09:03.860000000 +0000
+@@ -27,15 +27,31 @@
+ #include "netsurf/content.h"
+ #include "desktop/gui_internal.h"
+
++#ifdef WITH_BMP
+ #include "image/bmp.h"
++#endif
++#ifdef WITH_GIF
+ #include "image/gif.h"
++#endif
+ #include "image/ico.h"
++#ifdef WITH_JPEG
+ #include "image/jpeg.h"
++#endif
++#ifdef WITH_NSSPRITE
+ #include "image/nssprite.h"
++#endif
++#ifdef WITH_PNG
+ #include "image/png.h"
++#endif
++#ifdef WITH_RSVG
+ #include "image/rsvg.h"
++#endif
++#ifdef WITH_NS_SVG
+ #include "image/svg.h"
++#endif
++#ifdef WITH_WEBP
+ #include "image/webp.h"
++#endif
+ #include "image/image.h"
+
+ /**

diff --git a/www-client/netsurf/metadata.xml b/www-client/netsurf/metadata.xml
new file mode 100644
index 0000000..cea4e8e
--- /dev/null
+++ b/www-client/netsurf/metadata.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+  <maintainer type="person" proxied="yes">
+    <email>[email protected]</email>
+    <name>Philipp Ammann</name>
+  </maintainer>
+  <maintainer type="project" proxied="proxy">
+    <email>[email protected]</email>
+    <name>Proxy Maintainers</name>
+  </maintainer>
+  <upstream>
+    <changelog>
+      https://download.netsurf-browser.org/netsurf/releases/ChangeLog.txt
+    </changelog>
+  </upstream>
+  <use>
+    <flag name="bmp">BMP bitmap image support (media-libs/libnsbmp)</flag>
+    <flag name="gtk">Build GTK3 GUI</flag>
+    <flag name="gtk2">Build GTK2 GUI</flag>
+    <flag name="psl">Use public suffix list via media-libs/libnspsl</flag>
+    <flag name="rosprite">
+      RISC OS Sprite bitmap image support (media-libs/librosprite)
+    </flag>
+    <flag name="svgtiny">
+      SVG image support via media-libs/svgatiny instead of gnome-base/librsvg
+    </flag>
+  </use>
+  <longdescription lang="en">
+    NetSurf is a free, open source web browser. It is written in C,
+    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.
+
+    Whether you want to check your webmail, read the news or post to
+    discussion forums, NetSurf is your lightweight gateway to the
+    world wide web. Actively developed, NetSurf is continually
+    evolving and improving.
+  </longdescription>
+</pkgmetadata>

diff --git a/www-client/netsurf/netsurf-3.10-r6.ebuild 
b/www-client/netsurf/netsurf-3.10-r6.ebuild
new file mode 100644
index 0000000..69bb6d7
--- /dev/null
+++ b/www-client/netsurf/netsurf-3.10-r6.ebuild
@@ -0,0 +1,153 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit netsurf desktop toolchain-funcs
+
+DESCRIPTION="A free, open source web browser"
+HOMEPAGE="https://www.netsurf-browser.org/";
+SRC_URI="http://download.netsurf-browser.org/netsurf/releases/source/${P}-src.tar.gz";
+
+LICENSE="GPL-2 MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86"
+IUSE="bmp fbcon truetype +gif +gtk gtk2 +javascript +jpeg mng
+       +png +psl rosprite +svg +svgtiny +webp"
+
+REQUIRED_USE="|| ( fbcon gtk gtk2 )"
+
+RDEPEND="
+       >=dev-libs/libcss-0.9
+       >=net-libs/libdom-0.4.1-r1
+       >=net-libs/libhubbub-0.3
+       >=dev-libs/libnsutils-0.1.0
+       >=dev-libs/libutf8proc-2.4
+       dev-libs/libxml2:2
+       net-misc/curl
+       bmp? ( >=media-libs/libnsbmp-0.1 )
+       fbcon? ( >=dev-libs/libnsfb-0.2.2
+               truetype? ( media-fonts/dejavu
+                       >=media-libs/freetype-2.5.0.1 )
+       )
+       gif? ( >=media-libs/libnsgif-0.1 )
+       gtk? ( dev-libs/glib:2
+               x11-libs/gtk+:3 )
+       gtk2? ( dev-libs/glib:2
+               x11-libs/gtk+:2 )
+       javascript? (
+               >=dev-libs/nsgenbind-0.7
+               dev-lang/duktape:=
+       )
+       jpeg? ( >=virtual/jpeg-0-r2:0 )
+       mng? ( >=media-libs/libmng-1.0.10-r2 )
+       png? ( >=media-libs/libpng-1.2.51:0 )
+       psl? ( media-libs/libnspsl )
+       rosprite? ( >=media-libs/librosprite-0.1.2-r1 )
+       svg? ( svgtiny? ( >=media-libs/libsvgtiny-0.1.3-r1 )
+               !svgtiny? ( gnome-base/librsvg:2 ) )
+       webp? ( >=media-libs/libwebp-0.3.0 )"
+DEPEND="${RDEPEND}"
+BDEPEND="
+       javascript? ( app-editors/vim-core )
+       dev-libs/check
+       dev-perl/HTML-Parser
+       >=dev-util/netsurf-buildsystem-1.7-r1
+       virtual/pkgconfig
+"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-3.9-conditionally-include-image-headers.patch"
+       "${FILESDIR}/${PN}-3.10-julia-libutf8proc-header-location.patch"
+       "${FILESDIR}/${PN}-3.10-disable-failing-tests.patch"
+       "${FILESDIR}/${PN}-3.10-gcc10-fno-common.patch"
+       "${FILESDIR}/${PN}-3.10-libressl-3.5.patch"
+)
+
+DOCS=( README docs/using-framebuffer.md
+       docs/ideas/{cache,css-engine,render-library}.txt )
+
+src_prepare() {
+       default
+       rm -r frontends/{amiga,atari,beos,monkey,riscos,windows} || die
+}
+
+_emake() {
+       netsurf_define_makeconf
+       local netsurf_makeconf=(
+               "${NETSURF_MAKECONF[@]}"
+               COMPONENT_TYPE=binary
+               NETSURF_USE_BMP=$(usex bmp YES NO)
+               NETSURF_USE_GIF=$(usex gif YES NO)
+               NETSURF_USE_JPEG=$(usex jpeg YES NO)
+               NETSURF_USE_PNG=$(usex png YES NO)
+               NETSURF_USE_NSPSL=$(usex psl YES NO)
+               NETSURF_USE_MNG=$(usex mng YES NO)
+               NETSURF_USE_WEBP=$(usex webp YES NO)
+               NETSURF_USE_JS=NO
+               NETSURF_USE_DUKTAPE=$(usex javascript YES NO)
+               NETSURF_USE_NSSVG=$(usex svg $(usex svgtiny YES NO) NO)
+               NETSURF_USE_RSVG=$(usex svg $(usex svgtiny NO YES) NO)
+               NETSURF_USE_ROSPRITE=$(usex rosprite YES NO)
+               PKG_CONFIG=$(tc-getPKG_CONFIG)
+               NETSURF_FB_FONTLIB=$(usex truetype freetype internal)
+               NETSURF_FB_FONTPATH="${EPREFIX}/usr/share/fonts/dejavu"
+               NETSURF_USE_VIDEO=NO
+       )
+
+       emake "${netsurf_makeconf[@]}" $@
+}
+
+src_compile() {
+       # The build system only runs pkg-config to find librsvg's include
+       # dir for the gtk targets. So if you try to build the framebuffer
+       # target with NETSURF_USE_RSVG=YES, the build crashes on failing to
+       # find rsvg.h. To work around that, we set NETSURF_USE_RSVG=NO. It
+       # might be possible to fall back to svgtiny with USE="svg -svgtiny"
+       # if svgtiny works in a framebuffer, but then our (R)DEPEND would
+       # need some mangling to ensure that svgtiny is installed.
+       use fbcon && _emake NETSURF_USE_RSVG=NO TARGET=framebuffer
+
+       use gtk2 && _emake TARGET=gtk2
+       use gtk && _emake TARGET=gtk3
+}
+
+src_test() {
+       _emake test
+}
+
+src_install() {
+       sed -e '1iexit;' \
+               -i "${WORKDIR}"/*/utils/git-testament.pl || die
+
+       if use fbcon ; then
+               # See earlier comments about rsvg.h.
+               _emake NETSURF_USE_RSVG=NO TARGET=framebuffer DESTDIR="${D}" 
install
+               elog "framebuffer binary has been installed as netsurf-fb"
+               make_desktop_entry "${EPREFIX}/usr/bin/netsurf-fb %u" \
+                                                  NetSurf-framebuffer \
+                                                  netsurf \
+                                                  "Network;WebBrowser"
+       fi
+       if use gtk2 ; then
+               _emake TARGET=gtk2 DESTDIR="${D}" install
+               elog "netsurf gtk2 version has been installed as netsurf-gtk2"
+               make_desktop_entry "${EPREFIX}/usr/bin/netsurf-gtk2 %u" \
+                                                  NetSurf-gtk2 \
+                                                  netsurf \
+                                                  "Network;WebBrowser"
+       fi
+       if use gtk ; then
+               _emake TARGET=gtk3 DESTDIR="${D}" install
+               elog "netsurf gtk3 version has been installed as netsurf-gtk3"
+               make_desktop_entry "${EPREFIX}/usr/bin/netsurf-gtk3 %u" \
+                                                  NetSurf-gtk3 \
+                                                  netsurf \
+                                                  "Network;WebBrowser"
+       fi
+
+       insinto /usr/share/pixmaps
+       doins frontends/gtk/res/netsurf.xpm
+       doman docs/netsurf-fb.1
+       doman docs/netsurf-gtk.1
+}

Reply via email to