From eb72148f88dcde91858b0db9b95ad7d7b1e61256 Mon Sep 17 00:00:00 2001
From: David Seifert <soap@gentoo.org>
Date: Fri, 13 Dec 2019 14:20:33 +0100
Subject: [PATCH] media-video/alevt: Port to EAPI 7

Package-Manager: Portage-2.3.81, Repoman-2.3.20
Signed-off-by: David Seifert <soap@gentoo.org>
---
 media-video/alevt/alevt-1.6.2.ebuild          | 42 ++++++++-----------
 .../alevt/files/alevt-1.6.2-libpng15.patch    |  4 +-
 .../files/alevt-1.6.2-respectflags.patch      | 23 +++++++---
 3 files changed, 38 insertions(+), 31 deletions(-)

diff --git a/media-video/alevt/alevt-1.6.2.ebuild b/media-video/alevt/alevt-1.6.2.ebuild
index d93fd6f0ccb3..efa778cbc210 100644
--- a/media-video/alevt/alevt-1.6.2.ebuild
+++ b/media-video/alevt/alevt-1.6.2.ebuild
@@ -1,8 +1,9 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=4
-inherit eutils toolchain-funcs flag-o-matic
+EAPI=7
+
+inherit desktop flag-o-matic toolchain-funcs
 
 DESCRIPTION="Teletext viewer for X11"
 HOMEPAGE="http://www.goron.de/~froese/"
@@ -11,37 +12,30 @@ SRC_URI="http://www.goron.de/~froese/alevt/${P}.tar.gz"
 LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~amd64 ~ppc ~sparc x86"
-IUSE=""
+RESTRICT="strip"
 
-RDEPEND="x11-libs/libX11
-	>=media-libs/libpng-1.4"
+RDEPEND="
+	x11-libs/libX11
+	media-libs/libpng:="
 DEPEND="${RDEPEND}
 	x11-base/xorg-proto"
 
-RESTRICT="strip"
-
-src_prepare() {
-	cp -va Makefile{,.orig}
+PATCHES=(
+	"${FILESDIR}"/${P}-respectflags.patch
+	"${FILESDIR}"/${P}-libpng15.patch
+)
 
-	epatch \
-		"${FILESDIR}"/${P}-respectflags.patch \
-		"${FILESDIR}"/${P}-libpng15.patch
-}
-
-src_compile() {
-	append-flags -fno-strict-aliasing
-	emake CC="$(tc-getCC)"
+src_configure() {
+	append-cflags -fno-strict-aliasing
+	tc-export BUILD_CC CC
 }
 
 src_install() {
 	dobin alevt alevt-cap alevt-date
 	doman alevt.1x alevt-date.1 alevt-cap.1
-	dodoc CHANGELOG README
-
-	insinto /usr/share/icons/hicolor/16x16/apps
-	newins contrib/mini-alevt.xpm alevt.xpm
-	insinto /usr/share/icons/hicolor/48x48/apps
-	newins contrib/icon48x48.xpm alevt.xpm
+	einstalldocs
 
+	newicon -s 16 contrib/mini-alevt.xpm alevt.xpm
+	newicon -s 48 contrib/icon48x48.xpm alevt.xpm
 	make_desktop_entry alevt "AleVT" alevt
 }
diff --git a/media-video/alevt/files/alevt-1.6.2-libpng15.patch b/media-video/alevt/files/alevt-1.6.2-libpng15.patch
index 337a6f7c709f..a134fd014051 100644
--- a/media-video/alevt/files/alevt-1.6.2-libpng15.patch
+++ b/media-video/alevt/files/alevt-1.6.2-libpng15.patch
@@ -1,5 +1,5 @@
---- exp-gfx.c
-+++ exp-gfx.c
+--- a/exp-gfx.c
++++ b/exp-gfx.c
 @@ -4,6 +4,8 @@
  #include <stdlib.h>
  #include <string.h>
diff --git a/media-video/alevt/files/alevt-1.6.2-respectflags.patch b/media-video/alevt/files/alevt-1.6.2-respectflags.patch
index 368b0ff614cd..62716d0e8f43 100644
--- a/media-video/alevt/files/alevt-1.6.2-respectflags.patch
+++ b/media-video/alevt/files/alevt-1.6.2-respectflags.patch
@@ -1,21 +1,25 @@
---- alevt-1.6.2/Makefile.orig	2007-12-03 06:19:54.000000000 +0100
-+++ alevt-1.6.2/Makefile	2009-05-14 10:17:39.000000000 +0200
+--- a/Makefile
++++ b/Makefile
 @@ -1,5 +1,4 @@
  VER=1.6.2
 -OPT=-O2 -s -w
  #OPT=-O -g
  DEFS=-DWITH_PNG
  FONT=vtxt
-@@ -11,7 +10,7 @@
+@@ -7,11 +6,10 @@
+ #USR_X11R6=/usr
+ MAN_DIR=man
+ #MAN_DIR=share/man
+-HOSTCC=$(CC)
  # a smaller and thinner font
  #FONT=neep9
  
 -CFLAGS=$(OPT) -DVERSION=\"$(VER)\" $(DEFS) -I$(USR_X11R6)/include
-+CFLAGS += -DVERSION=\"$(VER)\" $(DEFS) -I$(USR_X11R6)/include
++CPPFLAGS += -DVERSION=\"$(VER)\" $(DEFS) -I$(USR_X11R6)/include
  
  EXPOBJS=export.o exp-txt.o exp-html.o exp-gfx.o font.o
  OBJS=main.o ui.o xio.o fdset.o vbi.o cache.o help.o edline.o search.o edit.o misc.o hamm.o lang.o $(EXPOBJS)
-@@ -25,13 +24,13 @@
+@@ -25,13 +23,13 @@
  all: alevt alevt-date alevt-cap alevt.1x alevt-date.1 alevt-cap.1
  
  alevt: $(OBJS)
@@ -32,3 +36,12 @@
  
  font.o: font1.xbm font2.xbm
  fontsize.h: font1.xbm font2.xbm
+@@ -44,7 +42,7 @@
+ 	./bdf2xbm font2 <$(FONT)-latin-2.bdf >font2.xbm
+ 
+ bdf2xbm: bdf2xbm.c
+-	$(HOSTCC) bdf2xbm.c -o bdf2xbm
++	$(BUILD_CC) bdf2xbm.c -o bdf2xbm
+ 
+ alevt.1x: alevt.1x.in
+ 	sed s/VERSION/$(VER)/g <alevt.1x.in >alevt.1x
-- 
2.26.2