From 5014c8cfe36400fec383784be2cd2830c743a392 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Fri, 23 Feb 2018 20:36:47 +0000
Subject: lynx: update to 2.2.8

---
 abs/extra/lynx/PKGBUILD                 | 38 ++++++++++------
 abs/extra/lynx/__changelog              |  2 +
 abs/extra/lynx/lynx-2.8.8-openssl.patch | 11 +++++
 abs/extra/lynx/ncurses.patch            | 78 +++++++++++++++++++++++++++++++++
 4 files changed, 116 insertions(+), 13 deletions(-)
 create mode 100644 abs/extra/lynx/__changelog
 create mode 100644 abs/extra/lynx/lynx-2.8.8-openssl.patch
 create mode 100644 abs/extra/lynx/ncurses.patch

diff --git a/abs/extra/lynx/PKGBUILD b/abs/extra/lynx/PKGBUILD
index a793fff..c2b4c44 100644
--- a/abs/extra/lynx/PKGBUILD
+++ b/abs/extra/lynx/PKGBUILD
@@ -1,26 +1,38 @@
-# $Id: PKGBUILD 162749 2012-06-29 12:15:20Z pierre $
-# Maintainer:
+# $Id$
+# Maintainer: Pierre Schmitz <pierre@archlinux.de>
 # Contributor: Douglas Soares de Andrade <douglas@archlinux.org>
 # Contributor: Tom Newsom <Jeepster@gmx.co.uk>
 
 pkgname=lynx
-pkgver=2.8.7
-_pkgver=2-8-7
-pkgrel=6
+pkgver=2.8.8
+_relver=${pkgver}rel.2
+pkgrel=5
 pkgdesc="A text browser for the World Wide Web"
-url="http://lynx.isc.org/"
-arch=('i686' 'x86_64')
+url="http://lynx.browser.org/"
+arch=('x86_64')
 license=('GPL')
-depends=('ncurses' 'openssl')
+depends=('openssl' 'libidn')
 backup=('etc/lynx.cfg')
-source=("http://lynx.isc.org/release/${pkgname}${pkgver}.tar.gz")
-md5sums=('e36d70f3f09b2d502055ca67f09e363c')
+source=(http://invisible-mirror.net/archives/lynx/tarballs/${pkgname}${_relver}.tar.bz2{,.asc}
+        lynx-2.8.8-openssl.patch
+        ncurses.patch)
+sha256sums=('6980e75cf0d677fd52c116e2e0dfd3884e360970c88c8356a114338500d5bee7'
+            'SKIP'
+            '08a331c9fc07547f5a59c9b83077bf18ece0a6012d77a6f3e0dff2be27a07769'
+            '06d1a968cd7eed0711683ed055c67118f52ef7ea22fcb7995447d3d7a9297f1d')
+validpgpkeys=('0AFD1FFEEA2EA063B959ACDA5DDF8FB7688E31A6')
 
+prepare() {
+  cd ${srcdir}/${pkgname}${pkgver//./-}
+  patch -Np1 -i ../lynx-2.8.8-openssl.patch
+  patch -Np1 -i ../ncurses.patch
+}
+  
 build() {
-  cd ${srcdir}/${pkgname}${_pkgver}
+  cd ${srcdir}/${pkgname}${pkgver//./-}
   ./configure --prefix=/usr \
     --sysconfdir=/etc \
-    --with-ssl \
+    --with-ssl=/usr \
     --enable-nls \
     --enable-ipv6 \
     --mandir=/usr/share/man
@@ -28,7 +40,7 @@ build() {
 }
 
 package() {
-  cd ${srcdir}/${pkgname}${_pkgver}
+  cd ${srcdir}/${pkgname}${pkgver//./-}
   make DESTDIR=${pkgdir} install
 
   # FS#20404 - points to local help
diff --git a/abs/extra/lynx/__changelog b/abs/extra/lynx/__changelog
new file mode 100644
index 0000000..06e79aa
--- /dev/null
+++ b/abs/extra/lynx/__changelog
@@ -0,0 +1,2 @@
+PKGGBUILD: add ncurses.patch
+ncurses.patch from https://git.alpinelinux.org/cgit/aports/plain/main/lynx/ncurses.patch
diff --git a/abs/extra/lynx/lynx-2.8.8-openssl.patch b/abs/extra/lynx/lynx-2.8.8-openssl.patch
new file mode 100644
index 0000000..7ab0fb8
--- /dev/null
+++ b/abs/extra/lynx/lynx-2.8.8-openssl.patch
@@ -0,0 +1,11 @@
+--- lynx2-8-8/WWW/Library/Implementation/HTTP.c.orig	2017-03-16 09:24:30.608537810 +0000
++++ lynx2-8-8/WWW/Library/Implementation/HTTP.c	2017-03-16 09:25:21.728457895 +0000
+@@ -720,7 +720,7 @@
+ #elif SSLEAY_VERSION_NUMBER >= 0x0900
+ #ifndef USE_NSS_COMPAT_INCL
+ 	if (!try_tls) {
+-	    handle->options |= SSL_OP_NO_TLSv1;
++	    SSL_set_options(handle, SSL_OP_NO_TLSv1);
+ #if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT)
+ 	} else {
+ 	    int ret = (int) SSL_set_tlsext_host_name(handle, ssl_host);
diff --git a/abs/extra/lynx/ncurses.patch b/abs/extra/lynx/ncurses.patch
new file mode 100644
index 0000000..5acab0c
--- /dev/null
+++ b/abs/extra/lynx/ncurses.patch
@@ -0,0 +1,78 @@
+From f0b064b47bfa046da941f5029cdc1b4c851553ce Mon Sep 17 00:00:00 2001
+From: "Thomas E. Dickey" <dickey@invisible-island.net>
+Date: Sat, 18 Mar 2017 21:44:28 +0000
+Subject: [PATCH] snapshot of project "lynx", label v2-8-9dev_11m
+
+---
+ CHANGES         |  5 +++--
+ src/LYCurses.c  | 18 ++++++++++++------
+ src/LYStrings.c |  7 ++++---
+ 3 files changed, 19 insertions(+), 11 deletions(-)
+
+diff --git a/src/LYCurses.c b/src/LYCurses.c
+index 6b839c28..63b73ece 100644
+--- a/src/LYCurses.c
++++ b/src/LYCurses.c
+@@ -1696,7 +1696,7 @@ void lynx_enable_mouse(int state)
+ void lynx_nl2crlf(int normal GCC_UNUSED)
+ {
+ #if defined(NCURSES_VERSION_PATCH) && defined(SET_TTY) && defined(TERMIOS) && defined(ONLCR)
+-    static TTY saved_tty;
++    static struct termios saved_tty;
+     static int did_save = FALSE;
+     static int waiting = FALSE;
+     static int can_fix = TRUE;
+@@ -1705,8 +1705,10 @@ void lynx_nl2crlf(int normal GCC_UNUSED)
+ 	if (cur_term == 0) {
+ 	    can_fix = FALSE;
+ 	} else {
+-	    saved_tty = cur_term->Nttyb;
++	    tcgetattr(fileno(stdout), &saved_tty);
+ 	    did_save = TRUE;
++	    if ((saved_tty.c_oflag & ONLCR))
++		can_fix = FALSE;
+ #if NCURSES_VERSION_PATCH < 20010529
+ 	    /* workaround for optimizer bug with nonl() */
+ 	    if ((tigetstr("cud1") != 0 && *tigetstr("cud1") == '\n')
+@@ -1718,14 +1720,18 @@ void lynx_nl2crlf(int normal GCC_UNUSED)
+     if (can_fix) {
+ 	if (normal) {
+ 	    if (!waiting) {
+-		cur_term->Nttyb.c_oflag |= ONLCR;
++		struct termios alter_tty = saved_tty;
++
++		alter_tty.c_oflag |= ONLCR;
++		tcsetattr(fileno(stdout), TCSAFLUSH, &alter_tty);
++		def_prog_mode();
+ 		waiting = TRUE;
+ 		nonl();
+ 	    }
+ 	} else {
+ 	    if (waiting) {
+-		cur_term->Nttyb = saved_tty;
+-		SET_TTY(fileno(stdout), &saved_tty);
++		tcsetattr(fileno(stdout), TCSAFLUSH, &saved_tty);
++		def_prog_mode();
+ 		waiting = FALSE;
+ 		nl();
+ 		LYrefresh();
+diff --git a/src/LYStrings.c b/src/LYStrings.c
+index e97481c2..02b1286d 100644
+--- a/src/LYStrings.c
++++ b/src/LYStrings.c
+@@ -1004,12 +1004,13 @@ static const char *expand_tiname(const char *first, size_t len, char **result, c
+ {
+     char name[BUFSIZ];
+     int code;
++    TERMTYPE *tp = (TERMTYPE *) (cur_term);
+ 
+     LYStrNCpy(name, first, len);
+     if ((code = lookup_tiname(name, strnames)) >= 0
+ 	|| (code = lookup_tiname(name, strfnames)) >= 0) {
+-	if (cur_term->type.Strings[code] != 0) {
+-	    LYStrNCpy(*result, cur_term->type.Strings[code], (final - *result));
++	if (tp->Strings[code] != 0) {
++	    LYStrNCpy(*result, tp->Strings[code], (final - *result));
+ 	    (*result) += strlen(*result);
+ 	}
+     }
-- 
cgit v0.12

