Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: games-arcade/tuxdash/, games-arcade/tuxdash/files/
Date: Fri, 30 Dec 2016 17:03:08
Message-Id: 1483083323.9a523f187eb159ba514ac94ade360f25b7e68225.soap@gentoo
1 commit: 9a523f187eb159ba514ac94ade360f25b7e68225
2 Author: David Seifert <soap <AT> gentoo <DOT> org>
3 AuthorDate: Fri Dec 30 07:33:50 2016 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 30 07:35:23 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9a523f18
7
8 games-arcade/tuxdash: Fix building with GCC 6
9
10 Gentoo-bug: 600084
11 * EAPI=6
12 * Remove games.eclass
13
14 Package-Manager: Portage-2.3.3, Repoman-2.3.1
15
16 .../files/tuxdash-0.8-fix-build-system.patch | 11 +++
17 .../tuxdash/files/tuxdash-0.8-fix-c++14.patch | 101 +++++++++++++++++++++
18 .../tuxdash/files/tuxdash-0.8-fix-paths.patch | 45 +++++++++
19 games-arcade/tuxdash/tuxdash-0.8-r1.ebuild | 48 ++++++++++
20 4 files changed, 205 insertions(+)
21
22 diff --git a/games-arcade/tuxdash/files/tuxdash-0.8-fix-build-system.patch b/games-arcade/tuxdash/files/tuxdash-0.8-fix-build-system.patch
23 new file mode 100644
24 index 00000000..9f861d9
25 --- /dev/null
26 +++ b/games-arcade/tuxdash/files/tuxdash-0.8-fix-build-system.patch
27 @@ -0,0 +1,11 @@
28 +Fix build system to honour all user variables.
29 +
30 +--- a/src/Makefile
31 ++++ b/src/Makefile
32 +@@ -1,4 +1,4 @@
33 + all:
34 +- g++ main.cpp -Wall `/usr/bin/sdl-config --libs --cflags` -lSDL_ttf -o ../TuxDash
35 ++ $(CXX) main.cpp $(LDFLAGS) $(CXXFLAGS) $(CPPFLAGS) `/usr/bin/sdl-config --libs --cflags` -lSDL_ttf -o ../tuxdash
36 + static:
37 +- g++ -static main.cpp -Wall `/usr/bin/sdl-config --cflags --static-libs` -lSDL_ttf -lfreetype -lz -o ../TuxDash
38 ++ $(CXX) -static main.cpp $(LDFLAGS) $(CXXFLAGS) $(CPPFLAGS) `/usr/bin/sdl-config --cflags --static-libs` -lSDL_ttf -lfreetype -lz -o ../tuxdash
39
40 diff --git a/games-arcade/tuxdash/files/tuxdash-0.8-fix-c++14.patch b/games-arcade/tuxdash/files/tuxdash-0.8-fix-c++14.patch
41 new file mode 100644
42 index 00000000..b37f456
43 --- /dev/null
44 +++ b/games-arcade/tuxdash/files/tuxdash-0.8-fix-c++14.patch
45 @@ -0,0 +1,101 @@
46 +Modernise C++ to avoid errors in C++14 mode.
47 +See also: https://bugs.gentoo.org/show_bug.cgi?id=600084
48 +
49 +--- a/src/main.cpp
50 ++++ b/src/main.cpp
51 +@@ -66,7 +66,7 @@
52 +
53 + void writeconfig(const map& game_map) {
54 + ofstream config((ostring)TuxHomeDirectory + "/config"); // open config file
55 +- if(config == NULL) { // error check
56 ++ if(!config) { // error check
57 + cout << "Warning: Couldn't write to file " << (ostring)TuxHomeDirectory + "/config" << endl;
58 + return;
59 + }
60 +@@ -124,7 +124,7 @@
61 +
62 + void readconfig(class map& game_map) {
63 + ifstream config((ostring)TuxHomeDirectory + "/config"); // open config file
64 +- if(config==0) { // error check
65 ++ if(!config) { // error check
66 + cout << "Warning: Couldn't find configuration file " << (ostring)TuxHomeDirectory + "/config" << ". Using default values." << endl;
67 + return;
68 + }
69 +--- a/src/map.cpp
70 ++++ b/src/map.cpp
71 +@@ -346,13 +346,13 @@
72 + cout << "-- copy map --" << endl; // print status message
73 + ifstream in_file(path); // open source file
74 +
75 +- if(in_file == 0) { // error checking
76 ++ if(!in_file) { // error checking
77 + cout << "Couldn't open sourcefile \"" << filename << "\"" << endl;
78 + cout << endl << "-- error in copymap --" << endl;
79 + return 1;
80 + }
81 +
82 +- if(out_file == 0) { // error checking
83 ++ if(!out_file) { // error checking
84 + cout << "Couldn't open target file \"" << temp_path << "\" for writing " << endl;
85 + cout << endl << "-- error in copymap --" << endl;
86 + return 1;
87 +@@ -390,7 +390,7 @@
88 + path = mapfolder;
89 + path += filename;
90 + file.open(path); // open file
91 +- if(file == NULL) {
92 ++ if(!file) {
93 + cout << "map::savemap : error while saving map to file '" << path << "'" << endl;
94 + return 1;
95 + }
96 +@@ -402,7 +402,7 @@
97 + path = savefolder;
98 + path += filename;
99 + file.open(path); // open file
100 +- if(file == NULL) {
101 ++ if(!file) {
102 + cout << "map::savemap : error while saving game to file '" << path << "'" << endl;
103 + return 1;
104 + }
105 +--- a/src/menu.cpp
106 ++++ b/src/menu.cpp
107 +@@ -119,7 +119,7 @@
108 +
109 + // add a selection box
110 +
111 +-class element* menu_mgm::add_box(int x, int y, const ostring& text, const ostring& value, bool selectable, int size, int xgroup, int ygroup, int max, int width, int height, unsigned char r, unsigned char g, unsigned char b, int value_type, bool dependency, char* depend) {
112 ++class element* menu_mgm::add_box(int x, int y, const ostring& text, const ostring& value, bool selectable, int size, int xgroup, int ygroup, int max, int width, int height, unsigned char r, unsigned char g, unsigned char b, int value_type, bool dependency, const char* depend) {
113 + class element& newone = add();
114 + newone.value = value;
115 + newone.posx = x;
116 +--- a/src/menu.h
117 ++++ b/src/menu.h
118 +@@ -56,7 +56,7 @@
119 + void check_custom_parameters(); // check if parameters are okay
120 + ostring keytoa(SDLKey); // cast SDLKey to ASCII
121 + class element* add_text(int, int, const ostring&, bool, int, int =-1, int =-1, unsigned char =0, unsigned char =0, unsigned char = 0, int = -1, int = -1); // add a text element
122 +- class element* add_box(int, int, const ostring&, const ostring&, bool, int, int, int, int, int, int, unsigned char, unsigned char, unsigned char, int = 0, bool =false, char* =0); // add a box element
123 ++ class element* add_box(int, int, const ostring&, const ostring&, bool, int, int, int, int, int, int, unsigned char, unsigned char, unsigned char, int = 0, bool =false, const char* =0); // add a box element
124 + class element* add_select(int, int, const ostring&, const ostring&, bool, int, int, int, const char* oneoftwo=0); // add a select element
125 + void draw_window(); // draw the current menu screen with all elements
126 + void selection_mgm(char); // process user input for menu navigation
127 +--- a/src/surface.cpp
128 ++++ b/src/surface.cpp
129 +@@ -92,7 +92,7 @@
130 + else file_tmp = file;
131 +
132 + TTF_Font *font = TTF_OpenFont(file_tmp, size);
133 +- SDL_Color color = {r, g, b, 0};
134 ++ SDL_Color color = {(Uint8)r, (Uint8)g, (Uint8)b, 0};
135 +
136 + area = TTF_RenderText_Solid(font, text, color);
137 +
138 +@@ -118,7 +118,7 @@
139 + SDL_Surface* text_surface;
140 + SDL_Rect temp;
141 + TTF_Font *font_tmp = TTF_OpenFont(font, size);
142 +- SDL_Color farbe = {r, g, b, 0};
143 ++ SDL_Color farbe = {(Uint8)r, (Uint8)g, (Uint8)b, 0};
144 + text_surface = TTF_RenderText_Solid(font_tmp, text, farbe);
145 + TTF_CloseFont(font_tmp);
146 + temp = pos;
147
148 diff --git a/games-arcade/tuxdash/files/tuxdash-0.8-fix-paths.patch b/games-arcade/tuxdash/files/tuxdash-0.8-fix-paths.patch
149 new file mode 100644
150 index 00000000..72cde9d
151 --- /dev/null
152 +++ b/games-arcade/tuxdash/files/tuxdash-0.8-fix-paths.patch
153 @@ -0,0 +1,45 @@
154 +Change paths for Gentoo's filesystem layout.
155 +
156 +--- a/config
157 ++++ b/config
158 +@@ -1,11 +1,11 @@
159 + # Fullscreen enable/disable
160 +-Fullscreen = 0
161 ++Fullscreen = 1
162 + # Width of screen in blocks
163 + screenX = 21
164 + # Height of screen in blocks
165 + screenY = 16
166 + # Theme Folder - path to a valid theme
167 +-theme = themes/original/
168 ++theme = /usr/share/tuxdash/themes/original/
169 + # Distance in X direction, before scrolling starts
170 + scrolldistX = 3
171 + # Distance in Y direction, before scrolling starts
172 +--- a/src/main.cpp
173 ++++ b/src/main.cpp
174 +@@ -340,9 +340,7 @@
175 +
176 + // set tuxdash's config / working directory
177 + char* HomeDirectory;
178 +- char* CurrentDirectory;
179 + HomeDirectory = getenv("HOME"); // get users home directory
180 +- CurrentDirectory = getenv("PWD"); // get TuxDash's working directory
181 + TuxHomeDirectory = new char[strlen(HomeDirectory)+strlen("/.tuxdash")+1]; // align space for the string containing the path to tuxdash's config directory
182 + strcpy(TuxHomeDirectory, HomeDirectory);
183 + strcat(TuxHomeDirectory, "/.tuxdash");
184 +@@ -355,12 +353,12 @@
185 + }
186 + else {
187 + mkdir((ostring)TuxHomeDirectory + "/themes", 0711); // create the themes folder. The default themes are not copied there, but the folder is created for possible additional themes added by the player
188 +- chdir(CurrentDirectory);
189 ++ chdir("/usr/share/tuxdash");
190 + system((ostring)"cp -r maps savegames config " + TuxHomeDirectory);
191 + }
192 + }
193 + cout << endl << " Using " << TuxHomeDirectory << " for configuration, map and savegame files" << endl;
194 +- chdir(CurrentDirectory);
195 ++ chdir("/usr/share/tuxdash");
196 + // finished with check of working directory
197 +
198 + int running=1, start, stop, framestart = time(0), frames=0, frame_count = 0;
199
200 diff --git a/games-arcade/tuxdash/tuxdash-0.8-r1.ebuild b/games-arcade/tuxdash/tuxdash-0.8-r1.ebuild
201 new file mode 100644
202 index 00000000..4e237fc
203 --- /dev/null
204 +++ b/games-arcade/tuxdash/tuxdash-0.8-r1.ebuild
205 @@ -0,0 +1,48 @@
206 +# Copyright 1999-2016 Gentoo Foundation
207 +# Distributed under the terms of the GNU General Public License v2
208 +# $Id$
209 +
210 +EAPI=6
211 +
212 +inherit toolchain-funcs
213 +
214 +DESCRIPTION="A simple BoulderDash clone"
215 +HOMEPAGE="http://www.tuxdash.de/index.php?language=EN"
216 +SRC_URI="http://www.tuxdash.de/ressources/downloads/${PN}_src_${PV}.tar.bz2"
217 +
218 +LICENSE="GPL-2"
219 +SLOT="0"
220 +KEYWORDS="~amd64 ~ppc ~x86 ~x86-fbsd"
221 +IUSE=""
222 +
223 +RDEPEND="
224 + media-libs/libsdl[video]
225 + media-libs/sdl-ttf"
226 +DEPEND="${RDEPEND}"
227 +
228 +PATCHES=(
229 + "${FILESDIR}"/${PN}-0.8-fix-build-system.patch
230 + "${FILESDIR}"/${PN}-0.8-fix-c++14.patch
231 + "${FILESDIR}"/${PN}-0.8-fix-paths.patch
232 +)
233 +
234 +src_prepare() {
235 + default
236 + rm -f GPL TuxDash || die
237 +}
238 +
239 +src_configure() {
240 + tc-export CXX
241 +}
242 +
243 +src_compile() {
244 + emake -C src
245 +}
246 +
247 +src_install() {
248 + dobin tuxdash
249 + einstalldocs
250 +
251 + insinto /usr/share/${PN}
252 + doins -r themes maps fonts savegames config
253 +}