summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Mackdanz <stasibear@gentoo.org>2021-08-02 23:26:40 -0500
committerErik Mackdanz <stasibear@gentoo.org>2021-08-02 23:26:40 -0500
commit97a186dfbe961e0d9358f3d69ed434c365b8c730 (patch)
tree6918a38b70d30db6f8b945bd10ad8ade934c0261 /games-roguelike
parentsys-apps/util-linux: fixup cryptsetup dep for upgrades (diff)
downloadgentoo-97a186dfbe961e0d9358f3d69ed434c365b8c730.tar.gz
gentoo-97a186dfbe961e0d9358f3d69ed434c365b8c730.tar.bz2
gentoo-97a186dfbe961e0d9358f3d69ed434c365b8c730.zip
games-roguelike/stone-soup: EAPI=8, tests, no direct compiler calls
Signed-off-by: Erik Mackdanz <stasibear@gentoo.org> Package-Manager: Portage-3.0.20, Repoman-3.0.3
Diffstat (limited to 'games-roguelike')
-rw-r--r--games-roguelike/stone-soup/files/make.patch94
-rw-r--r--games-roguelike/stone-soup/files/rltiles-make.patch58
-rw-r--r--games-roguelike/stone-soup/stone-soup-0.25.1-r102.ebuild182
-rw-r--r--games-roguelike/stone-soup/stone-soup-0.26.1-r1.ebuild186
-rw-r--r--games-roguelike/stone-soup/stone-soup-0.27.0-r1.ebuild182
5 files changed, 702 insertions, 0 deletions
diff --git a/games-roguelike/stone-soup/files/make.patch b/games-roguelike/stone-soup/files/make.patch
new file mode 100644
index 000000000000..b43c9c41e8c8
--- /dev/null
+++ b/games-roguelike/stone-soup/files/make.patch
@@ -0,0 +1,94 @@
+--- a/Makefile 2021-08-02 13:54:26.603900984 -0500
++++ b/Makefile 2021-08-02 13:57:26.018910565 -0500
+@@ -186,7 +186,7 @@
+ uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
+ uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
+
+-HOST := $(shell sh -c 'cc -dumpmachine || echo unknown')
++HOST :=
+ ARCH := $(HOST)
+
+ ifdef CROSSHOST
+@@ -457,15 +457,7 @@
+ GCC_VER_SUFFIX:=-$(GCC_VER)
+ endif
+
+-# Attempt to use a full compiler name, to make
+-# distcc builds work nicely.
+-LMACH := $(shell gcc -dumpmachine)-
+-ifeq ($(LMACH),-)
+ LMACH :=
+-endif
+-ifeq ($(shell which $(LMACH)gcc$(GCC_VER_SUFFIX) > /dev/null 2> /dev/null && echo "Yes"),)
+-LMACH :=
+-endif
+
+ ifneq ($(FORCE_CC),)
+ GCC := $(FORCE_CC)
+@@ -765,7 +757,6 @@
+ FULLDEBUG=YesPlease
+ DEBUG=YesPlease
+ NO_OPTIMIZE=YesPlease
+- COVERAGE=YesPlease
+ endif
+
+ # Debug-Lite
+@@ -773,7 +764,6 @@
+ ifneq (,$(filter debug-lite,$(MAKECMDGOALS)))
+ DEBUG=YesPlease
+ NO_OPTIMIZE=YesPlease
+- COVERAGE=YesPlease
+ endif
+
+ # Profile
+@@ -781,12 +771,10 @@
+ ifneq (,$(filter profile,$(MAKECMDGOALS)))
+ FULLDEBUG=YesPlease
+ DEBUG=YesPlease
+- COVERAGE=YesPlease
+ endif
+
+ # Unit tests
+ ifneq (,$(filter catch2-tests,$(MAKECMDGOALS)))
+- COVERAGE=YesPlease
+ endif
+
+ ifdef HURRY
+@@ -938,7 +926,7 @@
+ INSTALL_FONTS += "$(PROPORTIONAL_FONT)"
+ endif
+ else
+- SYS_PROPORTIONAL_FONT = $(shell util/find_font "$(OUR_PROPORTIONAL_FONT)")
++ SYS_PROPORTIONAL_FONT = /usr/share/fonts/dejavu/DejaVuSans.ttf
+ ifneq (,$(SYS_PROPORTIONAL_FONT))
+ ifeq (,$(COPY_FONTS))
+ DEFINES += -DPROPORTIONAL_FONT=\"$(SYS_PROPORTIONAL_FONT)\"
+@@ -958,7 +946,7 @@
+ INSTALL_FONTS += "$(MONOSPACED_FONT)"
+ endif
+ else
+- SYS_MONOSPACED_FONT = $(shell util/find_font "$(OUR_MONOSPACED_FONT)")
++ SYS_MONOSPACED_FONT = /usr/share/fonts/dejavu/DejaVuSansMono.ttf
+ ifneq (,$(SYS_MONOSPACED_FONT))
+ ifeq (,$(COPY_FONTS))
+ DEFINES += -DMONOSPACED_FONT=\"$(SYS_MONOSPACED_FONT)\"
+@@ -1187,9 +1175,8 @@
+
+ LANGUAGES = $(filter-out en, $(notdir $(wildcard dat/descript/??)))
+ SRC_PKG_BASE := stone_soup
+-SRC_VERSION := $(shell git describe --tags $(MERGE_BASE) 2>/dev/null || cat util/release_ver)
++SRC_VERSION := $(shell cat util/release_ver)
+ MAJOR_VERSION = $(shell echo "$(SRC_VERSION)"|$(SED) -r 's/-.*//;s/^([^.]+\.[^.]+).*/\1/')
+-RECENT_TAG := $(shell git describe --abbrev=0 --tags $(MERGE_BASE))
+ WINARCH := $(shell $(GXX) -dumpmachine | grep -q x64_64 && echo win64 || echo win32)
+
+ export SRC_VERSION
+@@ -1523,7 +1510,7 @@
+ endif
+ endif
+
+-install: all install-data
++install: install-data
+ [ -d $(prefix_fp)/$(bin_prefix) ] || mkdir -p $(prefix_fp)/$(bin_prefix)
+ $(COPY) $(GAME) $(prefix_fp)/$(bin_prefix)/
+ $(STRIP) $(prefix_fp)/$(bin_prefix)/$(GAME)
diff --git a/games-roguelike/stone-soup/files/rltiles-make.patch b/games-roguelike/stone-soup/files/rltiles-make.patch
new file mode 100644
index 000000000000..9a43932c5989
--- /dev/null
+++ b/games-roguelike/stone-soup/files/rltiles-make.patch
@@ -0,0 +1,58 @@
+--- a/rltiles/Makefile 2021-08-02 14:03:40.106930544 -0500
++++ b/rltiles/Makefile 2021-08-02 14:03:51.145931133 -0500
+@@ -1,7 +1,7 @@
+ uname_S := $(shell uname -s)
+
+ ifneq (,$(findstring MINGW,$(uname_S)))
+-LDFLAGS += -lmingw32
++LIBS += -lmingw32
+ endif
+
+ # Note: since generation of tiles is done on the host, we don't care about
+@@ -29,7 +29,7 @@
+ endif
+
+ CFLAGS += $(PNG_INCLUDE)
+- LDFLAGS += $(PNG_LIB)
++ LIBS += $(PNG_LIB)
+
+ CFLAGS += -DUSE_TILE
+ endif
+@@ -39,26 +39,15 @@
+ endif
+
+ ifneq (,$(findstring MINGW,$(uname_S)))
+-LDFLAGS += -lgdi32 -lwinmm -lole32 -loleaut32 -limm32 -lshell32 -lversion -luuid
++LIBS += -lgdi32 -lwinmm -lole32 -loleaut32 -limm32 -lshell32 -lversion -luuid
+ endif
+ ifeq ($(uname_S),Darwin)
+-LDFLAGS += -framework AppKit -framework AudioUnit -framework CoreAudio -framework ForceFeedback -framework Carbon -framework IOKit -framework OpenGL
++LIBS += -framework AppKit -framework AudioUnit -framework CoreAudio -framework ForceFeedback -framework Carbon -framework IOKit -framework OpenGL
+ endif
+ ifeq ($(uname_S),Linux)
+-LDFLAGS += -ldl -lpthread
++LIBS += -ldl -lpthread
+ endif
+
+-# Attempt to use a full compiler name, to make
+-# distcc builds work nicely.
+-LMACH := $(shell gcc -dumpmachine)-
+-ifeq ($(LMACH),-)
+-LMACH :=
+-endif
+-ifeq ($(shell which $(LMACH)gcc > /dev/null 2> /dev/null && echo "Yes"),)
+-LMACH :=
+-endif
+-HOSTCXX ?= $(LMACH)g++
+-
+ DELETE = rm -f
+
+ TOOLDIR := tool
+@@ -134,6 +123,6 @@
+ $(QUIET_HOSTCXX)$(HOSTCXX) $(CFLAGS) -MMD -c $< -o $@
+
+ $(TILEGEN): $(OBJECTS)
+- $(QUIET_HOSTLINK)$(HOSTCXX) $(CFLAGS) $(OBJECTS) -o $@ $(LDFLAGS)
++ $(QUIET_HOSTLINK)$(HOSTCXX) $(CFLAGS) $(OBJECTS) -o $@ $(LDFLAGS) $(LIBS)
+
+ .PHONY: all clean distclean
diff --git a/games-roguelike/stone-soup/stone-soup-0.25.1-r102.ebuild b/games-roguelike/stone-soup/stone-soup-0.25.1-r102.ebuild
new file mode 100644
index 000000000000..6b3620cceb23
--- /dev/null
+++ b/games-roguelike/stone-soup/stone-soup-0.25.1-r102.ebuild
@@ -0,0 +1,182 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LUA_COMPAT=( lua5-{1..3} )
+PYTHON_COMPAT=( python3_{7,8,9} )
+VIRTUALX_REQUIRED="manual"
+inherit desktop python-any-r1 lua-single xdg-utils toolchain-funcs
+
+MY_P="stone_soup-${PV}"
+DESCRIPTION="Role-playing roguelike game of exploration and treasure-hunting in dungeons"
+HOMEPAGE="https://crawl.develz.org"
+SLOT="0.25"
+SRC_URI="
+ https://github.com/crawl/crawl/releases/download/${PV}/${PN/-/_}-${PV}.zip
+ https://dev.gentoo.org/~stasibear/distfiles/${PN}.png -> ${PN}-${SLOT}.png
+ https://dev.gentoo.org/~stasibear/distfiles/${PN}.svg -> ${PN}-${SLOT}.svg
+"
+
+# 3-clause BSD: mt19937ar.cc, MSVC/stdint.h
+# 2-clause BSD: all contributions by Steve Noonan and Jesse Luehrs
+# Public Domain|CC0: most of tiles
+# MIT: json.cc/json.h, some .js files in webserver/static/scripts/contrib/
+LICENSE="GPL-2 BSD BSD-2 public-domain CC0-1.0 MIT"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug ncurses sound +tiles"
+
+RDEPEND="
+ ${LUA_DEPS}
+ dev-db/sqlite:3
+ sys-libs/zlib
+ !ncurses? ( !tiles? ( sys-libs/ncurses:0 ) )
+ ncurses? ( sys-libs/ncurses:0 )
+ tiles? (
+ media-fonts/dejavu
+ media-libs/freetype:2
+ media-libs/libpng:0
+ sound? (
+ media-libs/libsdl2[X,opengl,sound,video]
+ media-libs/sdl2-mixer
+ )
+ !sound? ( media-libs/libsdl2[X,opengl,video] )
+ media-libs/sdl2-image[png]
+ virtual/glu
+ virtual/opengl
+ )"
+DEPEND="${RDEPEND}
+ app-arch/unzip
+ dev-lang/perl
+ ${PYTHON_DEPS}
+ $(python_gen_any_dep 'dev-python/pyyaml[${PYTHON_USEDEP}]')
+ sys-devel/flex
+ tiles? (
+ media-gfx/pngcrush
+ sys-libs/ncurses:0
+ )
+ virtual/pkgconfig
+ virtual/yacc
+ "
+
+S=${WORKDIR}/${MY_P}/source
+PATCHES=(
+ "${FILESDIR}"/make.patch
+ "${FILESDIR}"/rltiles-make.patch
+)
+
+python_check_deps() {
+ has_version "dev-python/pyyaml[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+
+ python-any-r1_pkg_setup
+
+ if use !ncurses && use !tiles ; then
+ ewarn "Neither ncurses nor tiles frontend"
+ ewarn "selected, choosing ncurses only."
+ ewarn "Note that you can also enable both."
+ fi
+
+ if use sound && use !tiles ; then
+ ewarn "Sound support is only available with tiles."
+ fi
+}
+
+src_prepare() {
+ default
+ python_fix_shebang "${S}/util/species-gen.py"
+
+ sed -i -e "s/GAME = crawl$/GAME = crawl-${SLOT}/" "${S}/Makefile" \
+ || die "Couldn't append slot to executable name"
+}
+
+src_compile() {
+
+ # Insurance that we're not using bundled lib sources
+ rm -rf contrib || die "Couldn't delete contrib directory"
+
+ myemakeargs=(
+ $(usex debug "FULLDEBUG=y DEBUG=y" "")
+ BUILD_LUA=
+ AR="$(tc-getAR)"
+ CFOPTIMIZE=''
+ CFOTHERS="${CXXFLAGS}"
+ CONTRIBS=
+ DATADIR="/usr/share/${PN}-${SLOT}"
+ FORCE_CC="$(tc-getCC)"
+ FORCE_CXX="$(tc-getCXX)"
+ LDFLAGS="${LDFLAGS}"
+ MAKEOPTS="${MAKEOPTS}"
+ PKGCONFIG="$(tc-getPKG_CONFIG)"
+ RANLIB="$(tc-getRANLIB)"
+ SAVEDIR="~/.crawl-${SLOT}"
+ SOUND=$(usex sound "y" "")
+ STRIP=touch
+ USE_LUAJIT=
+ V=1
+ prefix="/usr"
+ )
+
+ if use ncurses || (use !ncurses && use !tiles) ; then
+ emake "${myemakeargs[@]}"
+ # move it in case we build both variants
+ use tiles && { mv "crawl-${SLOT}" "${WORKDIR}"/crawl-ncurses-${SLOT} || die ;}
+ fi
+
+ if use tiles ; then
+ emake "${myemakeargs[@]}" clean
+ emake "${myemakeargs[@]}" "TILES=y"
+ fi
+}
+
+src_test() {
+ emake "${myemakeargs[@]}" \
+ $(usex tiles "TILES=y" "") \
+ catch2-tests
+}
+
+src_install() {
+ emake "${myemakeargs[@]}" \
+ $(usex tiles "TILES=y" "") \
+ DESTDIR="${D}" \
+ prefix_fp="" \
+ bin_prefix="${D}/usr/bin" \
+ install
+
+ [[ -e "${WORKDIR}/crawl-ncurses-${SLOT}" ]] && dobin "${WORKDIR}/crawl-ncurses-${SLOT}"
+
+ # don't relocate docs, needed at runtime
+ rm -rf "${D}/usr/share/${PN}-${SLOT}"/docs/license
+
+ mv "${WORKDIR}/${MY_P}"/docs/crawl.6 "${WORKDIR}/${MY_P}/docs/crawl-${SLOT}.6" \
+ || die "Couldn't append slot to man page name"
+ doman "${WORKDIR}/${MY_P}/docs/crawl-${SLOT}.6"
+
+ # icons and menu for graphical build
+ if use tiles ; then
+ doicon -s 48 "${DISTDIR}"/${PN}-${SLOT}.png
+ doicon -s scalable "${DISTDIR}"/${PN}-${SLOT}.svg
+ make_desktop_entry "crawl-${SLOT}" "crawl-${SLOT}" "crawl-${SLOT}"
+ fi
+}
+
+pkg_postinst() {
+ xdg_icon_cache_update
+
+ elog "crawl is a slotted install that supports having"
+ elog "multiple versions installed. The binary has the"
+ elog "slot appened, e.g. 'crawl-"${SLOT}"'."
+
+ if use tiles && use ncurses ; then
+ elog
+ elog "Since you have enabled both tiles and ncurses frontends"
+ elog "the ncurses binary is called 'crawl-ncurses-"${SLOT}"' and the"
+ elog "tiles binary is called 'crawl-"${SLOT}"'."
+ fi
+}
+
+pkg_postrm() {
+ xdg_icon_cache_update
+}
diff --git a/games-roguelike/stone-soup/stone-soup-0.26.1-r1.ebuild b/games-roguelike/stone-soup/stone-soup-0.26.1-r1.ebuild
new file mode 100644
index 000000000000..71060b04b353
--- /dev/null
+++ b/games-roguelike/stone-soup/stone-soup-0.26.1-r1.ebuild
@@ -0,0 +1,186 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LUA_COMPAT=( lua5-{1..3} )
+PYTHON_COMPAT=( python3_{7,8,9} )
+VIRTUALX_REQUIRED="manual"
+inherit desktop python-any-r1 lua-single xdg-utils toolchain-funcs
+
+MY_P="stone_soup-${PV}"
+DESCRIPTION="Role-playing roguelike game of exploration and treasure-hunting in dungeons"
+HOMEPAGE="https://crawl.develz.org"
+SLOT="0.26"
+SRC_URI="
+ https://github.com/crawl/crawl/releases/download/${PV}/${PN/-/_}-${PV}.zip
+ https://dev.gentoo.org/~stasibear/distfiles/${PN}.png -> ${PN}-${SLOT}.png
+ https://dev.gentoo.org/~stasibear/distfiles/${PN}.svg -> ${PN}-${SLOT}.svg
+"
+
+# 3-clause BSD: mt19937ar.cc, MSVC/stdint.h
+# 2-clause BSD: all contributions by Steve Noonan and Jesse Luehrs
+# Public Domain|CC0: most of tiles
+# MIT: json.cc/json.h, some .js files in webserver/static/scripts/contrib/
+LICENSE="GPL-2 BSD BSD-2 public-domain CC0-1.0 MIT"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug ncurses sound +tiles"
+
+RDEPEND="
+ ${LUA_DEPS}
+ dev-db/sqlite:3
+ sys-libs/zlib
+ !ncurses? ( !tiles? ( sys-libs/ncurses:0 ) )
+ ncurses? ( sys-libs/ncurses:0 )
+ tiles? (
+ media-fonts/dejavu
+ media-libs/freetype:2
+ media-libs/libpng:0
+ sound? (
+ media-libs/libsdl2[X,opengl,sound,video]
+ media-libs/sdl2-mixer
+ )
+ !sound? ( media-libs/libsdl2[X,opengl,video] )
+ media-libs/sdl2-image[png]
+ virtual/glu
+ virtual/opengl
+ )"
+DEPEND="${RDEPEND}
+ app-arch/unzip
+ dev-lang/perl
+ ${PYTHON_DEPS}
+ $(python_gen_any_dep 'dev-python/pyyaml[${PYTHON_USEDEP}]')
+ sys-devel/flex
+ tiles? (
+ media-gfx/pngcrush
+ sys-libs/ncurses:0
+ )
+ virtual/pkgconfig
+ virtual/yacc
+ "
+
+S=${WORKDIR}/${MY_P}/source
+PATCHES=(
+ "${FILESDIR}"/make.patch
+ "${FILESDIR}"/rltiles-make.patch
+)
+
+python_check_deps() {
+ has_version "dev-python/pyyaml[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+
+ python-any-r1_pkg_setup
+
+ if use !ncurses && use !tiles ; then
+ ewarn "Neither ncurses nor tiles frontend"
+ ewarn "selected, choosing ncurses only."
+ ewarn "Note that you can also enable both."
+ fi
+
+ if use sound && use !tiles ; then
+ ewarn "Sound support is only available with tiles."
+ fi
+}
+
+src_prepare() {
+ default
+ python_fix_shebang "${S}/util/species-gen.py"
+
+ sed -i -e "s/GAME = crawl$/GAME = crawl-${SLOT}/" "${S}/Makefile" \
+ || die "Couldn't append slot to executable name"
+}
+
+src_compile() {
+
+ # Insurance that we're not using bundled lib sources
+ rm -rf contrib || die "Couldn't delete contrib directory"
+
+ myemakeargs=(
+ $(usex debug "FULLDEBUG=y DEBUG=y" "")
+ BUILD_LUA=
+ AR="$(tc-getAR)"
+ CFOPTIMIZE=''
+ CFOTHERS="${CXXFLAGS}"
+ CONTRIBS=
+ DATADIR="/usr/share/${PN}-${SLOT}"
+ FORCE_CC="$(tc-getCC)"
+ FORCE_CXX="$(tc-getCXX)"
+ LDFLAGS="${LDFLAGS}"
+ MAKEOPTS="${MAKEOPTS}"
+ PKGCONFIG="$(tc-getPKG_CONFIG)"
+ RANLIB="$(tc-getRANLIB)"
+ SAVEDIR="~/.crawl-${SLOT}"
+ SOUND=$(usex sound "y" "")
+ STRIP=touch
+ USE_LUAJIT=
+ V=1
+ prefix="/usr"
+ )
+
+ if use ncurses || (use !ncurses && use !tiles) ; then
+ emake "${myemakeargs[@]}"
+ # move it in case we build both variants
+ use tiles && { mv "crawl-${SLOT}" "${WORKDIR}"/crawl-ncurses-${SLOT} || die ;}
+ fi
+
+ if use tiles ; then
+ emake "${myemakeargs[@]}" clean
+ emake "${myemakeargs[@]}" "TILES=y"
+ fi
+}
+
+src_test() {
+ emake "${myemakeargs[@]}" \
+ $(usex tiles "TILES=y" "") \
+ catch2-tests
+}
+
+src_install() {
+ emake "${myemakeargs[@]}" \
+ $(usex tiles "TILES=y" "") \
+ DESTDIR="${D}" \
+ prefix_fp="" \
+ bin_prefix="${D}/usr/bin" \
+ install
+
+ [[ -e "${WORKDIR}/crawl-ncurses-${SLOT}" ]] && dobin "${WORKDIR}/crawl-ncurses-${SLOT}"
+
+ # don't relocate docs, needed at runtime
+ rm -rf "${D}/usr/share/${PN}-${SLOT}"/docs/license
+
+ mv "${WORKDIR}/${MY_P}"/docs/crawl.6 "${WORKDIR}/${MY_P}/docs/crawl-${SLOT}.6" \
+ || die "Couldn't append slot to man page name"
+ doman "${WORKDIR}/${MY_P}/docs/crawl-${SLOT}.6"
+
+ # icons and menu for graphical build
+ if use tiles ; then
+ doicon -s 48 "${DISTDIR}"/${PN}-${SLOT}.png
+ doicon -s scalable "${DISTDIR}"/${PN}-${SLOT}.svg
+ make_desktop_entry "crawl-${SLOT}" "crawl-${SLOT}" "crawl-${SLOT}"
+ fi
+}
+
+pkg_postinst() {
+ xdg_icon_cache_update
+
+ elog "Since version 0.25.1-r101, crawl is a slotted install"
+ elog "that supports having multiple versions installed. The"
+ elog "binary has the slot appened, e.g. 'crawl-"${SLOT}"'."
+ elog
+ elog "The local save directory also has the slot appended."
+ elog "If you have saved games from 0.25 but before 0.25.1-r101"
+ elog "you can 'mv ~/.crawl ~/.crawl-0.25' to fix it"
+
+ if use tiles && use ncurses ; then
+ elog
+ elog "Since you have enabled both tiles and ncurses frontends"
+ elog "the ncurses binary is called 'crawl-ncurses-"${SLOT}"' and the"
+ elog "tiles binary is called 'crawl-"${SLOT}"'."
+ fi
+}
+
+pkg_postrm() {
+ xdg_icon_cache_update
+}
diff --git a/games-roguelike/stone-soup/stone-soup-0.27.0-r1.ebuild b/games-roguelike/stone-soup/stone-soup-0.27.0-r1.ebuild
new file mode 100644
index 000000000000..8c3f2a14c8cf
--- /dev/null
+++ b/games-roguelike/stone-soup/stone-soup-0.27.0-r1.ebuild
@@ -0,0 +1,182 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LUA_COMPAT=( lua5-{1..3} )
+PYTHON_COMPAT=( python3_{7,8,9} )
+VIRTUALX_REQUIRED="manual"
+inherit desktop python-any-r1 lua-single xdg-utils toolchain-funcs
+
+MY_P="stone_soup-${PV}"
+DESCRIPTION="Role-playing roguelike game of exploration and treasure-hunting in dungeons"
+HOMEPAGE="https://crawl.develz.org"
+SLOT="0.27"
+SRC_URI="
+ https://github.com/crawl/crawl/releases/download/${PV}/${PN/-/_}-${PV}.zip
+ https://dev.gentoo.org/~stasibear/distfiles/${PN}.png -> ${PN}-${SLOT}.png
+ https://dev.gentoo.org/~stasibear/distfiles/${PN}.svg -> ${PN}-${SLOT}.svg
+"
+
+# 3-clause BSD: mt19937ar.cc, MSVC/stdint.h
+# 2-clause BSD: all contributions by Steve Noonan and Jesse Luehrs
+# Public Domain|CC0: most of tiles
+# MIT: json.cc/json.h, some .js files in webserver/static/scripts/contrib/
+LICENSE="GPL-2 BSD BSD-2 public-domain CC0-1.0 MIT"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug ncurses sound +tiles"
+
+RDEPEND="
+ ${LUA_DEPS}
+ dev-db/sqlite:3
+ sys-libs/zlib
+ !ncurses? ( !tiles? ( sys-libs/ncurses:0 ) )
+ ncurses? ( sys-libs/ncurses:0 )
+ tiles? (
+ media-fonts/dejavu
+ media-libs/freetype:2
+ media-libs/libpng:0
+ sound? (
+ media-libs/libsdl2[X,opengl,sound,video]
+ media-libs/sdl2-mixer
+ )
+ !sound? ( media-libs/libsdl2[X,opengl,video] )
+ media-libs/sdl2-image[png]
+ virtual/glu
+ virtual/opengl
+ )"
+DEPEND="${RDEPEND}
+ app-arch/unzip
+ dev-lang/perl
+ ${PYTHON_DEPS}
+ $(python_gen_any_dep 'dev-python/pyyaml[${PYTHON_USEDEP}]')
+ sys-devel/flex
+ tiles? (
+ media-gfx/pngcrush
+ sys-libs/ncurses:0
+ )
+ virtual/pkgconfig
+ virtual/yacc
+ "
+
+S=${WORKDIR}/${MY_P}/source
+PATCHES=(
+ "${FILESDIR}"/make.patch
+ "${FILESDIR}"/rltiles-make.patch
+)
+
+python_check_deps() {
+ has_version "dev-python/pyyaml[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+
+ python-any-r1_pkg_setup
+
+ if use !ncurses && use !tiles ; then
+ ewarn "Neither ncurses nor tiles frontend"
+ ewarn "selected, choosing ncurses only."
+ ewarn "Note that you can also enable both."
+ fi
+
+ if use sound && use !tiles ; then
+ ewarn "Sound support is only available with tiles."
+ fi
+}
+
+src_prepare() {
+ default
+ python_fix_shebang "${S}/util/species-gen.py"
+
+ sed -i -e "s/GAME = crawl$/GAME = crawl-${SLOT}/" "${S}/Makefile" \
+ || die "Couldn't append slot to executable name"
+}
+
+src_compile() {
+
+ # Insurance that we're not using bundled lib sources
+ rm -rf contrib || die "Couldn't delete contrib directory"
+
+ myemakeargs=(
+ $(usex debug "FULLDEBUG=y DEBUG=y" "")
+ BUILD_LUA=
+ AR="$(tc-getAR)"
+ CFOPTIMIZE=''
+ CFOTHERS="${CXXFLAGS}"
+ CONTRIBS=
+ DATADIR="/usr/share/${PN}-${SLOT}"
+ FORCE_CC="$(tc-getCC)"
+ FORCE_CXX="$(tc-getCXX)"
+ LDFLAGS="${LDFLAGS}"
+ MAKEOPTS="${MAKEOPTS}"
+ PKGCONFIG="$(tc-getPKG_CONFIG)"
+ RANLIB="$(tc-getRANLIB)"
+ SAVEDIR="~/.crawl-${SLOT}"
+ SOUND=$(usex sound "y" "")
+ STRIP=touch
+ USE_LUAJIT=
+ V=1
+ prefix="/usr"
+ )
+
+ if use ncurses || (use !ncurses && use !tiles) ; then
+ emake "${myemakeargs[@]}"
+ # move it in case we build both variants
+ use tiles && { mv "crawl-${SLOT}" "${WORKDIR}"/crawl-ncurses-${SLOT} || die ;}
+ fi
+
+ if use tiles ; then
+ emake "${myemakeargs[@]}" clean
+ emake "${myemakeargs[@]}" "TILES=y"
+ fi
+}
+
+src_test() {
+ emake "${myemakeargs[@]}" \
+ $(usex tiles "TILES=y" "") \
+ catch2-tests
+}
+
+src_install() {
+ emake "${myemakeargs[@]}" \
+ $(usex tiles "TILES=y" "") \
+ DESTDIR="${D}" \
+ prefix_fp="" \
+ bin_prefix="${D}/usr/bin" \
+ install
+
+ [[ -e "${WORKDIR}/crawl-ncurses-${SLOT}" ]] && dobin "${WORKDIR}/crawl-ncurses-${SLOT}"
+
+ # don't relocate docs, needed at runtime
+ rm -rf "${D}/usr/share/${PN}-${SLOT}"/docs/license
+
+ mv "${WORKDIR}/${MY_P}"/docs/crawl.6 "${WORKDIR}/${MY_P}/docs/crawl-${SLOT}.6" \
+ || die "Couldn't append slot to man page name"
+ doman "${WORKDIR}/${MY_P}/docs/crawl-${SLOT}.6"
+
+ # icons and menu for graphical build
+ if use tiles ; then
+ doicon -s 48 "${DISTDIR}"/${PN}-${SLOT}.png
+ doicon -s scalable "${DISTDIR}"/${PN}-${SLOT}.svg
+ make_desktop_entry "crawl-${SLOT}" "crawl-${SLOT}" "crawl-${SLOT}"
+ fi
+}
+
+pkg_postinst() {
+ xdg_icon_cache_update
+
+ elog "crawl is a slotted install that supports having"
+ elog "multiple versions installed. The binary has the"
+ elog "slot appened, e.g. 'crawl-"${SLOT}"'."
+
+ if use tiles && use ncurses ; then
+ elog
+ elog "Since you have enabled both tiles and ncurses frontends"
+ elog "the ncurses binary is called 'crawl-ncurses-"${SLOT}"' and the"
+ elog "tiles binary is called 'crawl-"${SLOT}"'."
+ fi
+}
+
+pkg_postrm() {
+ xdg_icon_cache_update
+}