Gentoo Archives: gentoo-commits

From: Ionen Wolkens <ionen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: games-roguelike/dwarf-fortress/files/, games-roguelike/dwarf-fortress/
Date: Wed, 06 Jul 2022 08:39:11
Message-Id: 1657096673.97a24df3591ca7bebd0fcd189e1da5f16240715c.ionen@gentoo
1 commit: 97a24df3591ca7bebd0fcd189e1da5f16240715c
2 Author: Joshua Goins <josh <AT> redstrate <DOT> com>
3 AuthorDate: Tue Jun 28 23:57:28 2022 +0000
4 Commit: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 6 08:37:53 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=97a24df3
7
8 games-roguelike/dwarf-fortress: add 0.47.05
9
10 Signed-off-by: Joshua Goins <josh <AT> redstrate.com>
11 Co-authored-by: Sven Eusewig <sveneusewig <AT> yahoo.de>
12 Co-authored-by: Wolfgang E. Sanyer <ezzieyguywuf <AT> gmail.com>
13 Closes: https://bugs.gentoo.org/703384
14 Closes: https://bugs.gentoo.org/703386
15 Closes: https://bugs.gentoo.org/717752
16 Closes: https://bugs.gentoo.org/729002
17 Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>
18
19 games-roguelike/dwarf-fortress/Manifest | 2 +
20 .../dwarf-fortress/dwarf-fortress-0.47.05.ebuild | 97 ++++++++++++++++++++++
21 .../files/dwarf-fortress-0.47.05-fix-cmath.patch | 11 +++
22 ...warf-fortress-0.47.05-segfault-fix-729002.patch | 49 +++++++++++
23 4 files changed, 159 insertions(+)
24
25 diff --git a/games-roguelike/dwarf-fortress/Manifest b/games-roguelike/dwarf-fortress/Manifest
26 index c42a144cfc72..f7f5a8d0f1fa 100644
27 --- a/games-roguelike/dwarf-fortress/Manifest
28 +++ b/games-roguelike/dwarf-fortress/Manifest
29 @@ -1,2 +1,4 @@
30 DIST df_44_12_linux.tar.bz2 12081683 BLAKE2B 2410e8da6af6a8ced45d3e95dc06e2d0f4e31dbdcd6b8d9945a761d2278532bb24c1095418aa22639eedded256b3d485fa128984e6282a491d4dc7bd9af8671b SHA512 03cd7f6800d44873b573cc5bffb12c7a246c3aba0ee8535001372df689a5179dc02592670fd87f2fd5de82421605f34152f6241307c8f7b9fb4d7b8704aed70c
31 DIST df_44_12_linux32.tar.bz2 12686340 BLAKE2B bf1e1370930d91d2c9e72d3366bc79706092d1505853eb63c6160fea39822551d3276958ac6d2916b8f7825be0c054a037219210f0c2c18a731065a2dd1bb842 SHA512 5cd352acf310592c7e30442205b7fe590f421c5e3562959dcfd32a17d3d562347c2b32e3bc5835637c5550ce2c696c17b6dc910ee4cf766be07af306e83537db
32 +DIST df_47_05_linux.tar.bz2 12725420 BLAKE2B 80987f05de2db2796a53cc8767ee7aa5c78674dff725efc0dafe07dc4118e56c7814cbf92507fe9b76a385e182405c7d6759cb6bcc942385110df1dc1a3b3af4 SHA512 9ea46fa12a80266cd09363f1aea8cdd059a5ebeefb453c4a46ffbb1115486409003c3caca95a1b6010da4040d04b781182c59e57a6cc033cd7de4507299f7534
33 +DIST df_47_05_linux32.tar.bz2 13487455 BLAKE2B be604dd2fd480c5609da801013dfdae26964760c0a92c4b3d2d8369800eee7ca9c1b1c2313cc67357feee3c6d425bf7f9f67cab53d2e771ab59055bc4c3329d0 SHA512 e9b9cf6995c24b403347159a35cfe4b57603bdb777c78639beb2799d9bf31317edec54fb92b17dbb90df6001b905d43285a35e9446768d12a746492b2fd34fe7
34
35 diff --git a/games-roguelike/dwarf-fortress/dwarf-fortress-0.47.05.ebuild b/games-roguelike/dwarf-fortress/dwarf-fortress-0.47.05.ebuild
36 new file mode 100644
37 index 000000000000..8df73a95939f
38 --- /dev/null
39 +++ b/games-roguelike/dwarf-fortress/dwarf-fortress-0.47.05.ebuild
40 @@ -0,0 +1,97 @@
41 +# Copyright 1999-2022 Gentoo Authors
42 +# Distributed under the terms of the GNU General Public License v2
43 +
44 +EAPI=8
45 +
46 +inherit prefix optfeature toolchain-funcs desktop readme.gentoo-r1
47 +
48 +MY_PV=$(ver_rs 1- _ "$(ver_cut 2-)")
49 +MY_P=df_${MY_PV}
50 +
51 +DESCRIPTION="A single-player fantasy game"
52 +HOMEPAGE="https://www.bay12games.com/dwarves"
53 +SRC_URI="amd64? ( https://www.bay12games.com/dwarves/${MY_P}_linux.tar.bz2 )
54 + x86? ( https://www.bay12games.com/dwarves/${MY_P}_linux32.tar.bz2 )"
55 +S="${WORKDIR}"/df_linux
56 +
57 +PATCHES=(
58 + "${FILESDIR}/${P}-fix-cmath.patch"
59 + "${FILESDIR}/${P}-segfault-fix-729002.patch"
60 +)
61 +
62 +LICENSE="free-noncomm BSD BitstreamVera"
63 +SLOT="0"
64 +KEYWORDS="-* ~amd64 ~x86"
65 +IUSE="debug"
66 +
67 +RDEPEND="media-libs/glew:0=
68 + media-libs/libsdl[joystick,video]
69 + media-libs/sdl-image[png]
70 + media-libs/sdl-ttf
71 + sys-libs/zlib:=
72 + virtual/glu
73 + x11-libs/gtk+:2"
74 +# Yup, libsndfile, openal and ncurses are only needed at compile-time; the code
75 +# dlopens them at runtime if requested.
76 +DEPEND="${RDEPEND}
77 + media-libs/libsndfile
78 + media-libs/openal
79 + sys-libs/ncurses-compat:5[unicode]
80 + virtual/pkgconfig"
81 +BDEPEND="virtual/pkgconfig"
82 +
83 +QA_PREBUILT="/opt/${PN}/libs/Dwarf_Fortress"
84 +
85 +DOC_CONTENTS="Dwarf Fortress has been installed to /opt/${PN}. This is
86 + symlinked to ~/.dwarf-fortress when dwarf-fortress is run.
87 + For more information on what exactly is replaced, see ${EROOT}/usr/bin/dwarf-fortress.
88 + Note: This means that the primary entry point is ${EROOT}/usr/bin/dwarf-fortress.
89 + Do not run /opt/${PN}/libs/Dwarf_Fortress."
90 +
91 +src_prepare() {
92 + # fix line endings so the patches can apply properly
93 + sed -i \
94 + -e 's/\r$//' \
95 + g_src/ttf_manager.cpp \
96 + g_src/music_and_sound_openal.cpp \
97 + || die
98 +
99 + default
100 +
101 + # dwarf fortress includes prebuilt libraries such as libstdc++ we won't use
102 + rm -f libs/*.so* || die
103 +}
104 +
105 +src_configure() {
106 + hprefixify "${WORKDIR}/dwarf-fortress"
107 +
108 + CXXFLAGS+=" -D$(use debug || echo N)DEBUG"
109 +}
110 +
111 +src_compile() {
112 + tc-export CXX PKG_CONFIG
113 +
114 + emake -f "${FILESDIR}/Makefile.native"
115 +}
116 +
117 +src_install() {
118 + insinto /opt/${PN}
119 + doins -r raw data libs
120 +
121 + dobin ${FILESDIR}/dwarf-fortress
122 +
123 + readme.gentoo_create_doc
124 + dodoc README.linux *.txt
125 +
126 + fperms 755 /opt/${PN}/libs/Dwarf_Fortress
127 +
128 + make_desktop_entry dwarf-fortress "Dwarf Fortress" "dwarf-fortress" Game
129 +}
130 +
131 +pkg_postinst() {
132 + readme.gentoo_print_elog
133 +
134 + optfeature "text PRINT_MODE" sys-libs/ncurses-compat:5[unicode]
135 + optfeature "audio output" "media-libs/openal media-libs/libsndfile"
136 + optfeature "OpenGL PRINT_MODE" media-libs/libsdl[opengl]
137 +}
138
139 diff --git a/games-roguelike/dwarf-fortress/files/dwarf-fortress-0.47.05-fix-cmath.patch b/games-roguelike/dwarf-fortress/files/dwarf-fortress-0.47.05-fix-cmath.patch
140 new file mode 100644
141 index 000000000000..21017f6b41b1
142 --- /dev/null
143 +++ b/games-roguelike/dwarf-fortress/files/dwarf-fortress-0.47.05-fix-cmath.patch
144 @@ -0,0 +1,11 @@
145 +Fixes compilation due to missing <cmath> header required in this file.
146 +
147 +diff --git a/g_src/ttf_manager.cpp b/g_src/ttf_manager.cpp
148 +@@ -1,6 +1,7 @@
149 + #include "ttf_manager.hpp"
150 + #include "init.h"
151 + #include <iostream>
152 ++#include <cmath>
153 +
154 + using namespace std;
155 +
156
157 diff --git a/games-roguelike/dwarf-fortress/files/dwarf-fortress-0.47.05-segfault-fix-729002.patch b/games-roguelike/dwarf-fortress/files/dwarf-fortress-0.47.05-segfault-fix-729002.patch
158 new file mode 100644
159 index 000000000000..0f0a9a672874
160 --- /dev/null
161 +++ b/games-roguelike/dwarf-fortress/files/dwarf-fortress-0.47.05-segfault-fix-729002.patch
162 @@ -0,0 +1,49 @@
163 +Fixes a bug due to OpenAL soft crashing the game on startup: https://www.bay12games.com/dwarves/mantisbt/view.php?id=11564
164 +Fixes a bug regarding an infinite loop on anything higher than -O1: https://www.bay12games.com/dwarves/mantisbt/view.php?id=11564
165 +
166 +https://bugs.gentoo.org/729002
167 +
168 +diff --git a/g_src/enabler.cpp b/g_src/enabler.cpp
169 +--- a/g_src/enabler.cpp
170 ++++ b/g_src/enabler.cpp
171 +@@ -590,6 +590,10 @@ int enablerst::loop(string cmdline) {
172 +
173 + // Clean up graphical resources
174 + delete renderer;
175 ++
176 ++ return 0;
177 + }
178 +
179 + void enablerst::override_grid_size(int x, int y) {
180 +diff --git a/g_src/music_and_sound_openal.cpp b/g_src/music_and_sound_openal.cpp
181 +--- a/g_src/music_and_sound_openal.cpp
182 ++++ b/g_src/music_and_sound_openal.cpp
183 +@@ -250,7 +250,11 @@ void musicsoundst::deinitsound() {
184 + alDeleteBuffers(1, &buffer);
185 + }
186 + // Deinit OpenAL
187 +- alcMakeContextCurrent(NULL);
188 ++
189 ++ //alcMakeContextCurrent(NULL);
190 ++
191 + alcDestroyContext(context);
192 + alcCloseDevice(device);
193 +
194 +@@ -480,7 +484,9 @@ static bool init_openal() {
195 +
196 + void alEnable( ALenum capability ) { _alEnable(capability); }
197 + void alDisable( ALenum capability ) { _alDisable(capability); }
198 +-ALboolean alIsEnabled( ALenum capability ) { _alIsEnabled(capability); }
199 ++ALboolean alIsEnabled( ALenum capability ) { return _alIsEnabled(capability); }
200 + const ALchar* alGetString( ALenum param ) { return _alGetString(param); }
201 + void alGetBooleanv( ALenum param, ALboolean* data ) { _alGetBooleanv(param, data); }
202 + void alGetIntegerv( ALenum param, ALint* data ) { _alGetIntegerv(param, data); }
203 +@@ -490,7 +496,9 @@ ALboolean alGetBoolean( ALenum param ) { return _alGetBoolean(param); }
204 + ALint alGetInteger( ALenum param ) { return _alGetInteger(param); }
205 + ALfloat alGetFloat( ALenum param ) { return _alGetFloat(param); }
206 + ALdouble alGetDouble( ALenum param ) { return _alGetDouble(param); }
207 +-ALenum alGetError( void ) { _alGetError(); }
208 ++ALenum alGetError( void ) { return _alGetError(); }
209 + ALboolean alIsExtensionPresent( const ALchar* extname ) { return _alIsExtensionPresent(extname); }
210 + void* alGetProcAddress( const ALchar* fname ) { return _alGetProcAddress(fname); }
211 + ALenum alGetEnumValue( const ALchar* ename ) { return _alGetEnumValue(ename); }