public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/proj/guru:master commit in: games-roguelike/cataclysm-dda/, games-roguelike/cataclysm-dda/files/
@ 2024-12-12 13:06 David Roman
  0 siblings, 0 replies; only message in thread
From: David Roman @ 2024-12-12 13:06 UTC (permalink / raw
  To: gentoo-commits

commit:     a44efa67d220f8a2e0c3adacdc10b7e7526da9e9
Author:     strategictraveler <strategictraveler <AT> proton <DOT> me>
AuthorDate: Wed Dec 11 11:34:19 2024 +0000
Commit:     David Roman <davidroman96 <AT> gmail <DOT> com>
CommitDate: Wed Dec 11 12:07:03 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=a44efa67

games-roguelike/cataclysm-dda: new package, add 0h, 9999

Signed-off-by: strategictraveler <strategictraveler <AT> proton.me>
Closes: https://github.com/gentoo/guru/pull/267
Signed-off-by: Takuya Wakazono <pastalian46 <AT> gmail.com>

 games-roguelike/cataclysm-dda/Manifest             |   2 +
 .../cataclysm-dda/cataclysm-dda-0h.ebuild          | 177 +++++++++++++++++++++
 .../cataclysm-dda/cataclysm-dda-9999.ebuild        | 171 ++++++++++++++++++++
 .../files/cataclysm-dda-respect-flags.patch        |  35 ++++
 games-roguelike/cataclysm-dda/metadata.xml         |  34 ++++
 5 files changed, 419 insertions(+)

diff --git a/games-roguelike/cataclysm-dda/Manifest b/games-roguelike/cataclysm-dda/Manifest
new file mode 100644
index 000000000..f464b38fb
--- /dev/null
+++ b/games-roguelike/cataclysm-dda/Manifest
@@ -0,0 +1,2 @@
+DIST cataclysm-dda-0h.tar.gz 199269075 BLAKE2B 6ba2b3a8cb0b27269959fe631818e55fa3bec9bffa5ed3d91d63be8737ae6eac6372eb59b526ace33a91963b94b2c269ed95c00652a63794b2ca66eeb2ac11a0 SHA512 c62716ec5c327cbc6976b287fc143ef7ae60df2b06ce1042568750ed003d68f63e1489f968c27a23880a0535dddbfae89e7118c1ba420bf54ec177dfb9f3cf10
+DIST cataclysm-dda-0h-soundpack.zip 137420371 BLAKE2B cf154f0217ec123aeec1773476ece9fd1ca560917e49daa31ed8532da7e0c2778b1c64c3b8e4d7c71b57af613296c35312aad7b1f83e09413df4d8c73fccb69c SHA512 62140e76b9730e9aa28ca395900ee4addb7a2d329782117c27037f80727cb3779328b0685829df67fc97e87889318e5934d0ee267491c64131fa217095477f32

diff --git a/games-roguelike/cataclysm-dda/cataclysm-dda-0h.ebuild b/games-roguelike/cataclysm-dda/cataclysm-dda-0h.ebuild
new file mode 100644
index 000000000..512cec6e6
--- /dev/null
+++ b/games-roguelike/cataclysm-dda/cataclysm-dda-0h.ebuild
@@ -0,0 +1,177 @@
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit xdg toolchain-funcs flag-o-matic
+
+SP_VER="2024-10-27"
+
+DESCRIPTION="A turn-based survival game set in a post-apocalyptic world"
+HOMEPAGE="https://cataclysmdda.org
+	https://github.com/CleverRaven/Cataclysm-DDA"
+if [[ ${PV} == 9999 ]]; then
+	inherit git-r3
+	EGIT_REPO_URI="https://github.com/CleverRaven/Cataclysm-DDA.git"
+	SLOT="${PV}"
+else
+	v2="$(ver_cut 2)"
+	MY_PV="$(ver_cut 1).${v2^^}"
+	unset v2
+	SRC_URI="https://github.com/CleverRaven/Cataclysm-DDA/archive/${MY_PV}-RELEASE.tar.gz -> ${P}.tar.gz \
+		soundpack? ( https://github.com/Fris0uman/CDDA-Soundpacks/releases/download/${SP_VER}/CC-Sounds.zip -> ${P}-soundpack.zip )"
+	SLOT="${MY_PV}"
+	S="${WORKDIR}/Cataclysm-DDA-${MY_PV}-RELEASE"
+	KEYWORDS="~amd64"
+fi
+
+# CC-BY-SA-4.0 for soundpack
+LICENSE="Apache-2.0 CC-BY-SA-3.0 CC-BY-SA-4.0 MIT OFL-1.1 Unicode-3.0"
+IUSE="debug ncurses nls +sound +soundpack test +tiles"
+REQUIRED_USE="soundpack? ( sound ) sound? ( tiles ) \
+	|| ( tiles ncurses )"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+	sys-libs/zlib
+	ncurses? ( sys-libs/ncurses )
+	tiles? (
+		media-libs/libsdl2[video]
+		media-libs/sdl2-image[png]
+		media-libs/sdl2-ttf[harfbuzz]
+		sound? (
+			   media-libs/libsdl2[sound]
+			   media-libs/sdl2-mixer[vorbis]
+		)
+	)"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	soundpack? ( app-arch/unzip )
+	nls? ( sys-devel/gettext )
+	"
+
+src_unpack() {
+	if [[ ${PV} == 9999 ]]; then
+		git-r3_src_unpack
+
+		if use soundpack; then
+			git-r3_fetch https://github.com/Fris0uman/CDDA-Soundpacks
+			git-r3_checkout https://github.com/Fris0uman/CDDA-Soundpacks "${WORKDIR}/CDDA-Soundpacks"
+
+			mv "${WORKDIR}/CDDA-Soundpacks/sound/CC-Sounds" "${WORKDIR}/CC-Sounds" || die
+		fi
+	else
+		default
+	fi
+}
+
+src_prepare() {
+	eapply "${FILESDIR}/${PN}-respect-flags.patch"
+
+	sed -i \
+		-e "s/-Werror //" \
+		-e "s/TARGET_NAME = cataclysm/TARGET_NAME = cataclysm-${SLOT}/" \
+		-e "s/\$(TARGET_NAME)-tiles/cataclysm-tiles-${SLOT}/" \
+		-e "s/CataclysmDDA/CataclysmDDA-${SLOT}/" \
+		-e "s/${PN}/${PN}-${SLOT}/" \
+		"Makefile" || die
+
+	find "${S}" -name "Makefile" -print | \
+		xargs sed -i \
+		-e "s/cataclysm.a/cataclysm-${SLOT}.a/g" \
+		-e "s/\$(BUILD_PREFIX)//g" || die # BUILD_PREFIX is also used by portage
+
+	sed -i -e "/${PN}.mo/"'!'"s/${PN}/${PN}-${SLOT}/" \
+		"src/path_info.cpp" || die
+
+	# from upstream 1ab7d17
+	# NOTE: remove when bumping
+	sed -i -e "s/const size_type/size_type/" \
+		"src/third-party/flatbuffers/stl_emulation.h" || die
+
+	sed -i -e "s/cataclysm-tiles/cataclysm-tiles-${SLOT}/g" \
+		"data/xdg/org.cataclysmdda.CataclysmDDA.desktop" || die
+
+	local f="org.cataclysmdda.CataclysmDDA"
+
+	mv "data/xdg/${f}.desktop" "data/xdg/${f}-${SLOT}.desktop" || die
+	mv "data/xdg/${f}.svg" "data/xdg/${f}-${SLOT}.svg" || die
+	mv "data/xdg/${f}.appdata.xml" "data/xdg/${f}-${SLOT}.appdata.xml" || die
+
+	eapply_user
+}
+
+src_compile() {
+	myemakeargs=(
+		ASTYLE=0
+		CXX="$(tc-getCXX)"
+		LINTJSON=0
+		PREFIX="${EPREFIX}/usr"
+		USE_XDG_DIR=1
+	)
+
+	if use debug; then
+		append-ldflags "-rdynamic"
+		DEFINES+="-DENABLE_LOGGING"
+		DEFINES+="$(echo -DDEBUG_{INFO,WARNING,ERROR,PEDANTIC_INFO})"
+		DEFINES+="$(echo -DDEBUG_ENABLE_{MAIN,MAP,MAP_GEN,GAME})"
+		export DEFINES
+	else
+		export BACKTRACE=0
+	fi
+
+	if use ncurses; then
+		# don't build tests twice
+		if ! use tiles; then
+			emake "${myemakeargs[@]}" "RUNTESTS=$(usex test 1 0)" "TESTS=$(usex test 1 0)"
+		else
+			emake "${myemakeargs[@]}" "TESTS=0" "RUNTESTS=0"
+		fi
+		# move it when building both variants
+		use tiles && { mv "cataclysm-${SLOT}" "${WORKDIR}"/cataclysm-${SLOT} || die ;}
+	fi
+
+	if use tiles; then
+		emake clean
+		emake "${myemakeargs[@]}" \
+			"RUNTESTS=$(usex test 1 0)" \
+			"SOUND=$(usex sound 1 0)" \
+			"TESTS=$(usex test 1 0)" \
+			"TILES=$(usex tiles 1 0)"
+	fi
+
+	if use nls; then
+		emake localization
+	fi
+}
+
+src_install() {
+	emake \
+		"TILES=$(usex tiles 1 0)" \
+		"SOUND=$(usex sound 1 0)" \
+		DESTDIR="${D}" \
+		PREFIX="${EPREFIX}/usr" \
+		install
+
+	[[ -e "${WORKDIR}/cataclysm-${SLOT}" ]] && dobin "${WORKDIR}/cataclysm-${SLOT}"
+
+	if use soundpack; then
+		insinto "/usr/share/${PN}-${SLOT}/sound"
+		doins -r "${WORKDIR}/CC-Sounds"
+	fi
+}
+
+pkg_postinst() {
+	xdg_pkg_postinst
+
+	elog "cataclysm is a slotted install that supports having"
+	elog "multiple versions installed.  The binary has the"
+	elog "slot appended, e.g. 'cataclysm-"${SLOT}"'."
+
+	if use tiles && use ncurses; then
+		elog
+		elog "Since you have enabled both tiles and ncurses frontends"
+		elog "the ncurses binary is called 'cataclysm-${SLOT}' and the"
+		elog "tiles binary is called 'cataclysm-tiles-${SLOT}'."
+	fi
+}

diff --git a/games-roguelike/cataclysm-dda/cataclysm-dda-9999.ebuild b/games-roguelike/cataclysm-dda/cataclysm-dda-9999.ebuild
new file mode 100644
index 000000000..cb0c90029
--- /dev/null
+++ b/games-roguelike/cataclysm-dda/cataclysm-dda-9999.ebuild
@@ -0,0 +1,171 @@
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit xdg toolchain-funcs flag-o-matic
+
+SP_VER="2024-10-27"
+
+DESCRIPTION="A turn-based survival game set in a post-apocalyptic world"
+HOMEPAGE="https://cataclysmdda.org
+	https://github.com/CleverRaven/Cataclysm-DDA"
+if [[ ${PV} == 9999 ]]; then
+	inherit git-r3
+	EGIT_REPO_URI="https://github.com/CleverRaven/Cataclysm-DDA.git"
+	SLOT="${PV}"
+else
+	v2="$(ver_cut 2)"
+	MY_PV="$(ver_cut 1).${v2^^}"
+	unset v2
+	SRC_URI="https://github.com/CleverRaven/Cataclysm-DDA/archive/${MY_PV}-RELEASE.tar.gz -> ${P}.tar.gz \
+		soundpack? ( https://github.com/Fris0uman/CDDA-Soundpacks/releases/download/${SP_VER}/CC-Sounds.zip -> ${P}-soundpack.zip )"
+	SLOT="${MY_PV}"
+	S="${WORKDIR}/Cataclysm-DDA-${MY_PV}-RELEASE"
+	KEYWORDS="~amd64"
+fi
+
+# CC-BY-SA-4.0 for soundpack
+LICENSE="Apache-2.0 CC-BY-SA-3.0 CC-BY-SA-4.0 MIT OFL-1.1 Unicode-3.0"
+IUSE="debug ncurses nls +sound +soundpack test +tiles"
+REQUIRED_USE="soundpack? ( sound ) sound? ( tiles ) \
+	|| ( tiles ncurses )"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+	sys-libs/zlib
+	ncurses? ( sys-libs/ncurses )
+	tiles? (
+		media-libs/libsdl2[video]
+		media-libs/sdl2-image[png]
+		media-libs/sdl2-ttf[harfbuzz]
+		sound? (
+			   media-libs/libsdl2[sound]
+			   media-libs/sdl2-mixer[vorbis]
+		)
+	)"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	nls? ( sys-devel/gettext )
+	"
+
+src_unpack() {
+	if [[ ${PV} == 9999 ]]; then
+		git-r3_src_unpack
+
+		if use soundpack; then
+			git-r3_fetch https://github.com/Fris0uman/CDDA-Soundpacks
+			git-r3_checkout https://github.com/Fris0uman/CDDA-Soundpacks "${WORKDIR}/CDDA-Soundpacks"
+
+			mv "${WORKDIR}/CDDA-Soundpacks/sound/CC-Sounds" "${WORKDIR}/CC-Sounds" || die
+		fi
+	else
+		default
+	fi
+}
+
+src_prepare() {
+	eapply "${FILESDIR}/${PN}-respect-flags.patch"
+
+	sed -i \
+		-e "s/-Werror //" \
+		-e "s/TARGET_NAME = cataclysm/TARGET_NAME = cataclysm-${SLOT}/" \
+		-e "s/\$(TARGET_NAME)-tiles/cataclysm-tiles-${SLOT}/" \
+		-e "s/CataclysmDDA/CataclysmDDA-${SLOT}/" \
+		-e "s/${PN}/${PN}-${SLOT}/" \
+		"Makefile" || die
+
+	find "${S}" -name "Makefile" -print | \
+		xargs sed -i \
+		-e "s/cataclysm.a/cataclysm-${SLOT}.a/g" \
+		-e "s/\$(BUILD_PREFIX)//g" || die # BUILD_PREFIX is also used by portage
+
+	sed -i -e "/${PN}.mo/"'!'"s/${PN}/${PN}-${SLOT}/" \
+		"src/path_info.cpp" || die
+
+	sed -i -e "s/cataclysm-tiles/cataclysm-tiles-${SLOT}/g" \
+		"data/xdg/org.cataclysmdda.CataclysmDDA.desktop" || die
+
+	local f="org.cataclysmdda.CataclysmDDA"
+
+	mv "data/xdg/${f}.desktop" "data/xdg/${f}-${SLOT}.desktop" || die
+	mv "data/xdg/${f}.svg" "data/xdg/${f}-${SLOT}.svg" || die
+	mv "data/xdg/${f}.appdata.xml" "data/xdg/${f}-${SLOT}.appdata.xml" || die
+
+	eapply_user
+}
+
+src_compile() {
+	myemakeargs=(
+		ASTYLE=0
+		CXX="$(tc-getCXX)"
+		LINTJSON=0
+		PREFIX="${EPREFIX}/usr"
+		USE_XDG_DIR=1
+	)
+
+	if use debug; then
+		append-ldflags "-rdynamic"
+		DEFINES+="-DENABLE_LOGGING"
+		DEFINES+="$(echo -DDEBUG_{INFO,WARNING,ERROR,PEDANTIC_INFO})"
+		DEFINES+="$(echo -DDEBUG_ENABLE_{MAIN,MAP,MAP_GEN,GAME})"
+		export DEFINES
+	else
+		export BACKTRACE=0
+	fi
+
+	if use ncurses; then
+		# don't build tests twice
+		if ! use tiles; then
+			emake "${myemakeargs[@]}" "RUNTESTS=$(usex test 1 0)" "TESTS=$(usex test 1 0)"
+		else
+			emake "${myemakeargs[@]}" "TESTS=0" "RUNTESTS=0"
+		fi
+		# move it when building both variants
+		use tiles && { mv "cataclysm-${SLOT}" "${WORKDIR}"/cataclysm-${SLOT} || die ;}
+	fi
+
+	if use tiles; then
+		emake clean
+		emake "${myemakeargs[@]}" \
+			"RUNTESTS=$(usex test 1 0)" \
+			"SOUND=$(usex sound 1 0)" \
+			"TESTS=$(usex test 1 0)" \
+			"TILES=$(usex tiles 1 0)"
+	fi
+
+	if use nls; then
+		emake localization
+	fi
+}
+
+src_install() {
+	emake \
+		"TILES=$(usex tiles 1 0)" \
+		"SOUND=$(usex sound 1 0)" \
+		DESTDIR="${D}" \
+		PREFIX="${EPREFIX}/usr" \
+		install
+
+	[[ -e "${WORKDIR}/cataclysm-${SLOT}" ]] && dobin "${WORKDIR}/cataclysm-${SLOT}"
+
+	if use soundpack; then
+		insinto "/usr/share/${PN}-${SLOT}/sound"
+		doins -r "${WORKDIR}/CC-Sounds"
+	fi
+}
+
+pkg_postinst() {
+	xdg_pkg_postinst
+
+	elog "cataclysm is a slotted install that supports having"
+	elog "multiple versions installed.  The binary has the"
+	elog "slot appended, e.g. 'cataclysm-"${SLOT}"'."
+
+	if use tiles && use ncurses; then
+		elog
+		elog "Since you have enabled both tiles and ncurses frontends"
+		elog "the ncurses binary is called 'cataclysm-${SLOT}' and the"
+		elog "tiles binary is called 'cataclysm-tiles-${SLOT}'."
+	fi
+}

diff --git a/games-roguelike/cataclysm-dda/files/cataclysm-dda-respect-flags.patch b/games-roguelike/cataclysm-dda/files/cataclysm-dda-respect-flags.patch
new file mode 100644
index 000000000..c85f6b681
--- /dev/null
+++ b/games-roguelike/cataclysm-dda/files/cataclysm-dda-respect-flags.patch
@@ -0,0 +1,35 @@
+--- a/Makefile
++++ b/Makefile
+@@ -120,7 +120,6 @@ ifeq ($(NATIVE), emscripten)
+ endif
+ # Uncomment below to disable warnings
+ #WARNINGS = -w
+-DEBUGSYMS = -g
+ #PROFILE = -pg
+ #OTHERS = -O3
+ #DEFINES = -DNDEBUG
+@@ -388,8 +387,6 @@ LDFLAGS += $(PROFILE)
+ 
+ ifneq ($(SANITIZE),)
+   SANITIZE_FLAGS := -fsanitize=$(SANITIZE) -fno-sanitize-recover=all -fno-omit-frame-pointer
+-  CXXFLAGS += $(SANITIZE_FLAGS)
+-  LDFLAGS += $(SANITIZE_FLAGS)
+ endif
+ 
+ # enable optimizations. slow to build
+@@ -478,7 +475,6 @@ else
+       OPTLEVEL = -O0
+     endif
+   endif
+-  CXXFLAGS += $(OPTLEVEL)
+ endif
+ 
+ ifeq ($(shell sh -c 'uname -o 2>/dev/null || echo not'),Cygwin)
+@@ -911,7 +907,6 @@ ifeq ($(TARGETSYSTEM),LINUX)
+   endif
+   ifeq ($(BACKTRACE),1)
+     # -rdynamic needed for symbols in backtraces
+-    LDFLAGS += -rdynamic
+   endif
+ endif
+ 

diff --git a/games-roguelike/cataclysm-dda/metadata.xml b/games-roguelike/cataclysm-dda/metadata.xml
new file mode 100644
index 000000000..3945bc293
--- /dev/null
+++ b/games-roguelike/cataclysm-dda/metadata.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="person">
+		<email>strategictraveler@proton.me</email>
+		<name>strategictraveler</name>
+	</maintainer>
+	<upstream>
+		<maintainer>
+			<email>kevin.granade@gmail.com</email>
+			<name>Kevin Granade</name>
+		</maintainer>
+		<bugs-to>https://github.com/CleverRaven/Cataclysm-DDA/issues/</bugs-to>
+		<doc lang="en">https://docs.cataclysmdda.org</doc>
+		<remote-id type="github">CleverRaven/Cataclysm-DDA</remote-id>
+	</upstream>
+	<use>
+		<flag name="ncurses">Build console (ncurses) variant</flag>
+		<flag name="tiles">Build graphical (tiles) variant</flag>
+		<flag name="soundpack">Install complete soundpack
+			(as opposed to only menu sounds) </flag>
+	</use>
+	<longdescription lang="en">
+		Cataclysm: Dark Days Ahead is a turn-based survival game set in a
+		post-apocalyptic world. While some have described it as a "zombie game",
+		there is far more to Cataclysm than that. Struggle to survive in a harsh,
+		persistent, procedurally generated world. Scavenge the remnants of a dead
+		civilization for food, equipment, or, if you are lucky, a vehicle with a full
+		tank of gas to get you the hell out of Dodge. Fight to defeat or escape from a
+		wide variety of powerful monstrosities, from zombies to giant insects to
+		killer robots and things far stranger and deadlier, and against the others
+		like yourself, who want what you have...
+	</longdescription>
+</pkgmetadata>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-12-12 13:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12 13:06 [gentoo-commits] repo/proj/guru:master commit in: games-roguelike/cataclysm-dda/, games-roguelike/cataclysm-dda/files/ David Roman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox