--- /dev/null
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit desktop toolchain-funcs xdg
+
+DESCRIPTION="Graphical map editor for games using the DOOM engine"
+HOMEPAGE="http://eureka-editor.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}-editor/Eureka/${PV%[a-z]}/${P}-source.tar.gz"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="+opengl"
+
+DEPEND="
+ media-libs/glu
+ sys-libs/zlib
+ x11-libs/fltk:1[opengl?]
+ opengl? ( virtual/opengl )
+"
+
+RDEPEND="
+ ${DEPEND}
+"
+
+S="${WORKDIR}/${P}-source"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-Makefile.patch
+)
+
+DOCS=(
+ AUTHORS.txt
+ CHANGES.txt
+ README.txt
+ TODO.txt
+)
+
+src_compile() {
+ emake \
+ CXX="$(tc-getCXX)" \
+ OPENGL="$(usex opengl 1 0)"
+}
+
+src_install() {
+ emake install PREFIX="${ED}/usr"
+ einstalldocs
+
+ doicon -s 32 misc/${PN}.xpm
+ domenu misc/${PN}.desktop
+}
--- /dev/null
+From faf9c604becc44135d6c5a7c8427982e203a327f Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Fri, 8 May 2020 11:26:18 +0100
+Subject: [PATCH 1/2] Allow software rendering to be easily chosen over OpenGL
+ with OPENGL=0
+
+---
+ Makefile | 17 ++++++++++++-----
+ 1 file changed, 12 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index ebbd53a4..adabaa92 100644
+--- a/Makefile
++++ b/Makefile
+@@ -26,19 +26,26 @@ CPPFLAGS ?=
+ LDFLAGS ?= $(OPTIMISE)
+ LIBS ?=
+
++# set this to 0 to use software rendering instead of OpenGL
++OPENGL = 1
++
+ # general things needed by Eureka
+ CXXFLAGS += $(CXX_DIALECT)
+-LIBS += -lGLU -lGL
+ LIBS += -lz -lm
++FLTK_CONFIG_FLAGS =
+
+-# add this for software rendering, remove '--use-gl' below, remove -lGL and -lGLU from LIBS
+-# CXXFLAGS += -DNO_OPENGL
++ifeq ($(OPENGL),1)
++LIBS += -lGLU -lGL
++FLTK_CONFIG_FLAGS += --use-gl
++else
++CXXFLAGS += -DNO_OPENGL
++endif
+
+ # FLTK flags (this assumes a system-wide FLTK installation)
+ FLTK_CONFIG ?= fltk-config
+
+-CXXFLAGS += $(shell $(FLTK_CONFIG) --use-images --use-gl --cxxflags)
+-LDFLAGS += $(shell $(FLTK_CONFIG) --use-images --use-gl --ldflags)
++CXXFLAGS += $(shell $(FLTK_CONFIG) --use-images --cxxflags $(FLTK_CONFIG_FLAGS))
++LDFLAGS += $(shell $(FLTK_CONFIG) --use-images --ldflags $(FLTK_CONFIG_FLAGS))
+
+ # NOTE: the following is commented out since it does not work as expected.
+ # the --libs option gives us static libraries, but --ldflags option
+--
+2.26.2
+
+From decee12e317e58128420771392b77c44a7c81122 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Fri, 8 May 2020 11:27:49 +0100
+Subject: [PATCH 2/2] Ensure bin directory is present before installing binary
+
+It might not be when using DESTDIR.
+---
+ Makefile | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Makefile b/Makefile
+index adabaa92..424ad4b5 100644
+--- a/Makefile
++++ b/Makefile
+@@ -158,6 +158,7 @@ stripped: all
+ INSTALL_DIR=$(DESTDIR)$(PREFIX)/share/eureka
+
+ install: all
++ install -d $(DESTDIR)$(PREFIX)/bin
+ install -m 755 $(PROGRAM) $(DESTDIR)$(PREFIX)/bin/
+ install -d $(INSTALL_DIR)/games
+ install -d $(INSTALL_DIR)/common
+--
+2.26.2
+