From 24e573b450a6498e0fb504a59b1175461fa0151d Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sun, 1 Nov 2020 05:17:55 +0000
Subject: app-editors/dav: fix build with gcc 10, compressed man

Closes: https://bugs.gentoo.org/729246
Closes: https://bugs.gentoo.org/706846
Package-Manager: Portage-3.0.8, Repoman-3.0.2
Signed-off-by: Sam James <sam@gentoo.org>
---
 app-editors/dav/dav-0.8.5-r2.ebuild                | 19 ++++++++++-------
 app-editors/dav/files/dav-0.8.5-asneeded.patch     |  5 ++---
 .../files/dav-0.8.5-davrc-buffer-overflow.patch    |  4 ++--
 app-editors/dav/files/dav-0.8.5-fno-common.patch   | 24 ++++++++++++++++++++++
 app-editors/dav/files/dav-0.8.5-makefile.patch     | 21 +++++++++++++++++++
 5 files changed, 61 insertions(+), 12 deletions(-)
 create mode 100644 app-editors/dav/files/dav-0.8.5-fno-common.patch
 create mode 100644 app-editors/dav/files/dav-0.8.5-makefile.patch

(limited to 'app-editors/dav')

diff --git a/app-editors/dav/dav-0.8.5-r2.ebuild b/app-editors/dav/dav-0.8.5-r2.ebuild
index b04dad5486e8..bab3b72d4bdf 100644
--- a/app-editors/dav/dav-0.8.5-r2.ebuild
+++ b/app-editors/dav/dav-0.8.5-r2.ebuild
@@ -1,12 +1,12 @@
 # Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI=7
+
 inherit toolchain-funcs
 
 DESCRIPTION="A minimal console text editor"
 HOMEPAGE="http://dav-text.sourceforge.net/"
-
 # The maintainer does not keep sourceforge's mirrors up-to-date,
 # so we point to the website's store of files.
 SRC_URI="http://dav-text.sourceforge.net/files/${P}.tar.gz"
@@ -15,18 +15,20 @@ LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~alpha amd64 ppc x86 ~amd64-linux ~x86-linux ~ppc-macos"
 
+BDEPEND="virtual/pkgconfig"
 RDEPEND="sys-libs/ncurses:0="
-DEPEND="
-	${RDEPEND}
-	virtual/pkgconfig
-"
+DEPEND="${RDEPEND}"
 
 PATCHES=(
 	"${FILESDIR}/${P}-asneeded.patch"
 	"${FILESDIR}/${P}-davrc-buffer-overflow.patch"
 	"${FILESDIR}/fix-Wformat-security-warnings.patch"
+	"${FILESDIR}/${PN}-0.8.5-fno-common.patch"
+	"${FILESDIR}/${PN}-0.8.5-makefile.patch"
 )
 
+DOCS=( README )
+
 # Makefile only
 src_configure() { :; }
 
@@ -37,4 +39,7 @@ src_compile() {
 		LDFLAGS="${LDFLAGS} $( $(tc-getPKG_CONFIG) --libs ncurses)"
 }
 
-DOCS=( README )
+src_install() {
+	default
+	docompress -x /usr/share/man/man1/dav.1.gz
+}
diff --git a/app-editors/dav/files/dav-0.8.5-asneeded.patch b/app-editors/dav/files/dav-0.8.5-asneeded.patch
index 75a43c67f43d..92bc6ebfdacc 100644
--- a/app-editors/dav/files/dav-0.8.5-asneeded.patch
+++ b/app-editors/dav/files/dav-0.8.5-asneeded.patch
@@ -1,6 +1,5 @@
-diff -u -r a/Makefile b/Makefile
---- a/Makefile	2004-02-22 02:04:07.000000000 +0100
-+++ b/Makefile	2008-12-30 19:31:19.000000000 +0100
+--- a/Makefile
++++ b/Makefile
 @@ -12,7 +12,7 @@
  LDFLAGS=-lncurses -O3 -Wall
  
diff --git a/app-editors/dav/files/dav-0.8.5-davrc-buffer-overflow.patch b/app-editors/dav/files/dav-0.8.5-davrc-buffer-overflow.patch
index a32e78ebc818..7287d36cc604 100644
--- a/app-editors/dav/files/dav-0.8.5-davrc-buffer-overflow.patch
+++ b/app-editors/dav/files/dav-0.8.5-davrc-buffer-overflow.patch
@@ -1,5 +1,5 @@
---- dav-0.8.5.orig/main.c	2011-01-29 14:16:53.537725568 -0500
-+++ dav-0.8.5/main.c	2011-01-29 14:20:45.139125094 -0500
+--- a/main.c
++++ b/main.c
 @@ -327,7 +327,7 @@
  void loadSettings()
  {
diff --git a/app-editors/dav/files/dav-0.8.5-fno-common.patch b/app-editors/dav/files/dav-0.8.5-fno-common.patch
new file mode 100644
index 000000000000..df58fa36098d
--- /dev/null
+++ b/app-editors/dav/files/dav-0.8.5-fno-common.patch
@@ -0,0 +1,24 @@
+https://bugs.gentoo.org/706846
+https://sources.debian.org/patches/dav-text/0.9.0-2/gcc-10.patch/
+--- a/main.c
++++ b/main.c
+@@ -58,7 +58,7 @@ char displayWholeScreen = 0;
+ struct buffer *buffers;
+ struct buffer *currentBuffer;
+ int currentBufferNum = 0;
+-
++ptrToFunction Fn_ptr[12]; //Bindings for the Fn keys; Fx = Fn_ptr[x-1]
+ 
+ int main(int argc, char *argv[])
+ {
+--- dav-text-0.9.0.orig/main.h
++++ dav-text-0.9.0/main.h
+@@ -47,7 +47,7 @@ void connectLines(struct line *baseline)
+ void determineLineNum(struct position *p);
+ void countTabs(struct line *l);
+ void determineCursX(struct position *p);
+-ptrToFunction Fn_ptr[12]; //Bindings for the Fn keys; Fx = Fn_ptr[x-1]
++extern ptrToFunction Fn_ptr[12]; //Bindings for the Fn keys; Fx = Fn_ptr[x-1]
+ 
+ extern int maxY,maxX;
+ extern int helpBarUpdate;
diff --git a/app-editors/dav/files/dav-0.8.5-makefile.patch b/app-editors/dav/files/dav-0.8.5-makefile.patch
new file mode 100644
index 000000000000..8ff62de305ee
--- /dev/null
+++ b/app-editors/dav/files/dav-0.8.5-makefile.patch
@@ -0,0 +1,21 @@
+diff --git a/Makefile b/Makefile
+index 8b1ff0a..7a57840 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,4 +1,4 @@
+-CC=gcc
++CC?=gcc
+ OBJECTS=main.o \
+         buffers.o \
+         fileIO.o \
+@@ -8,8 +8,8 @@ OBJECTS=main.o \
+         undo.o \
+         move.o
+         
+-CFLAGS=-O3 -Wall
+-LDFLAGS=-lncurses -O3 -Wall
++CFLAGS?=O3 -Wall
++LDFLAGS?=lncurses -O3 -Wall
+ 
+ dav: $(OBJECTS) 
+ 	$(CC) $(OBJECTS) $(LDFLAGS) -o dav
-- 
cgit v1.2.3-65-gdbad