Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/galib/files/, sci-libs/galib/
Date: Sun, 25 Sep 2016 22:24:05
Message-Id: 1474842203.7903e76836b83a49ddac62b9bc9c4aaa1238fbe2.soap@gentoo
1 commit: 7903e76836b83a49ddac62b9bc9c4aaa1238fbe2
2 Author: David Seifert <soap <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 25 22:22:40 2016 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 25 22:23:23 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7903e768
7
8 sci-libs/galib: Allow for compiling with GCC 6
9
10 Gentoo-bug: 594504
11 * Patch by Peter Levine
12 * EAPI=6
13 * [QA] Fix -Wformat-security errors
14 * Fix build system to honour CXX, AR, RANLIB properly
15
16 Package-Manager: portage-2.3.1
17
18 .../galib/files/galib-2.4.7-Wformat-security.patch | 79 ++++++++++++++++++++
19 .../galib/files/galib-2.4.7-fix-buildsystem.patch | 65 +++++++++++++++++
20 sci-libs/galib/files/galib-2.4.7-fix-c++14.patch | 85 ++++++++++++++++++++++
21 sci-libs/galib/galib-2.4.7-r1.ebuild | 55 ++++++++++++++
22 4 files changed, 284 insertions(+)
23
24 diff --git a/sci-libs/galib/files/galib-2.4.7-Wformat-security.patch b/sci-libs/galib/files/galib-2.4.7-Wformat-security.patch
25 new file mode 100644
26 index 00000000..faa7dcf
27 --- /dev/null
28 +++ b/sci-libs/galib/files/galib-2.4.7-Wformat-security.patch
29 @@ -0,0 +1,79 @@
30 +Fix -Wformat-security issues, as we do not want to install potentially
31 +dangerous example C++ files on user systems:
32 +* ex18.C: In function ‘int main(int, char**)’:
33 +* ex18.C:92:27: warning: format not a string literal and no format arguments [-Wformat-security]
34 +* sprintf(filename, argv[i]);
35 +
36 +--- a/examples/ex18.C
37 ++++ b/examples/ex18.C
38 +@@ -89,7 +89,7 @@
39 + exit(1);
40 + }
41 + else{
42 +- sprintf(filename, argv[i]);
43 ++ sprintf(filename, "%s", argv[i]);
44 + continue;
45 + }
46 + }
47 +--- a/examples/ex3.C
48 ++++ b/examples/ex3.C
49 +@@ -71,7 +71,7 @@
50 + exit(1);
51 + }
52 + else{
53 +- sprintf(filename, argv[i]);
54 ++ sprintf(filename, "%s", argv[i]);
55 + continue;
56 + }
57 + }
58 +--- a/examples/ex5.C
59 ++++ b/examples/ex5.C
60 +@@ -308,7 +308,7 @@
61 + exit(1);
62 + }
63 + else{
64 +- sprintf(filename1, argv[i]);
65 ++ sprintf(filename1, "%s", argv[i]);
66 + continue;
67 + }
68 + }
69 +@@ -318,7 +318,7 @@
70 + exit(1);
71 + }
72 + else{
73 +- sprintf(filename2, argv[i]);
74 ++ sprintf(filename2, "%s", argv[i]);
75 + continue;
76 + }
77 + }
78 +--- a/examples/ex7.C
79 ++++ b/examples/ex7.C
80 +@@ -68,7 +68,7 @@
81 + exit(1);
82 + }
83 + else{
84 +- sprintf(datafile, argv[i]);
85 ++ sprintf(datafile, "%s", argv[i]);
86 + continue;
87 + }
88 + }
89 +@@ -78,7 +78,7 @@
90 + exit(1);
91 + }
92 + else{
93 +- sprintf(parmfile, argv[i]);
94 ++ sprintf(parmfile, "%s", argv[i]);
95 + params.read(parmfile);
96 + continue;
97 + }
98 +--- a/ga/gaerror.C
99 ++++ b/ga/gaerror.C
100 +@@ -21,7 +21,7 @@
101 + static STD_OSTREAM *__gaErrStream = & STD_CERR;
102 + #endif
103 + static GABoolean __gaErrFlag = gaTrue;
104 +-static char *__gaErrStr[] = {
105 ++static const char *__gaErrStr[] = {
106 + "error reading from file: ",
107 + "error writing to file: ",
108 + "unexpected EOF encountered during read.",
109
110 diff --git a/sci-libs/galib/files/galib-2.4.7-fix-buildsystem.patch b/sci-libs/galib/files/galib-2.4.7-fix-buildsystem.patch
111 new file mode 100644
112 index 00000000..3ed7ad8
113 --- /dev/null
114 +++ b/sci-libs/galib/files/galib-2.4.7-fix-buildsystem.patch
115 @@ -0,0 +1,65 @@
116 +Fix the build system, removing hardcoded values for toolchain variables.
117 +
118 +--- a/examples/makefile
119 ++++ b/examples/makefile
120 +@@ -6,7 +6,6 @@
121 + # want to compile. See the README for a description of what each example does.
122 + # -----------------------------------------------------------------------------
123 +
124 +-include ../makevars
125 +
126 + # Set these paths to the location of the GA library and headers.
127 + #GA_INC_DIR= /usr/local/include
128 +@@ -14,8 +13,6 @@
129 + GA_INC_DIR= ..
130 + GA_LIB_DIR= ../ga
131 +
132 +-INC_DIRS= -I$(GA_INC_DIR)
133 +-LIB_DIRS= -L$(GA_LIB_DIR)
134 +
135 + EXS=randtest\
136 + ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9\
137 +@@ -24,7 +21,7 @@
138 +
139 + .SUFFIXES: .C
140 + .C.o:
141 +- $(CXX) $(CXXFLAGS) $(INC_DIRS) -c $<
142 ++ $(CXX) $(CXXFLAGS) -I.. -c $<
143 +
144 + all: $(EXS)
145 +
146 +@@ -34,7 +31,7 @@
147 +
148 + # Use this for gnu make
149 + $(EXS): %: %.o
150 +- $(CXX) $@.o -o $@ $(LIB_DIRS) -lga -lm $(CXX_LIBS)
151 ++ $(CXX) $@.o -o $@ -L../ga/ -lga -lm $(CXX_LIBS)
152 +
153 + clean:
154 + $(RM) $(EXS)
155 +--- a/ga/makefile
156 ++++ b/ga/makefile
157 +@@ -14,7 +14,7 @@
158 +
159 + $(LIB): $(OBJS)
160 + $(PRELINK)
161 +- $(AR) $(LIB) $?
162 ++ $(AR) rv $(LIB) $?
163 + $(RANLIB) $(LIB)
164 + echo "$(CXX) $(CXXFLAGS)" > BUILD
165 + @echo $(LIB) is now up-to-date
166 +--- a/makevars
167 ++++ b/makevars
168 +@@ -31,12 +31,7 @@
169 + # verified 06mar07 on linux-x86 (debian with gcc 3.3.5)
170 + # verified 06mar07 on linux-x86 (ubuntu with gcc 4.0.3)
171 + # verified 06mar07 on macosx-ppc (macosx 10.4.8 with gcc 4.0.1)
172 +-CXX = g++
173 +-CXXFLAGS = -g -Wall
174 +-LD = g++ -w
175 +-AR = ar rv
176 + INSTALL = install -c
177 +-RANLIB = echo no ranlib
178 +
179 + # gcc2
180 + # verified 28dec04 on linux-x86 (redhat 6.2 with gcc 2.95.2)
181
182 diff --git a/sci-libs/galib/files/galib-2.4.7-fix-c++14.patch b/sci-libs/galib/files/galib-2.4.7-fix-c++14.patch
183 new file mode 100644
184 index 00000000..babc84b
185 --- /dev/null
186 +++ b/sci-libs/galib/files/galib-2.4.7-fix-c++14.patch
187 @@ -0,0 +1,85 @@
188 +Fix building with C++14, which errors out due to stricter two-phase lookup.
189 +See also: https://bugs.gentoo.org/show_bug.cgi?id=594504
190 +
191 +Patch by Peter Levine
192 +
193 +--- a/ga/GA1DArrayGenome.C
194 ++++ b/ga/GA1DArrayGenome.C
195 +@@ -222,8 +222,8 @@
196 + aset = new GAAlleleSet<T>[1];
197 + aset[0] = s;
198 +
199 +- initializer(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_INITIALIZER);
200 +- mutator(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_MUTATOR);
201 ++ GAGenome::initializer(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_INITIALIZER);
202 ++ GAGenome::mutator(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_MUTATOR);
203 + comparator(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_COMPARATOR);
204 + crossover(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_CROSSOVER);
205 + }
206 +@@ -238,8 +238,8 @@
207 + for(int i=0; i<naset; i++)
208 + aset[i] = sa.set(i);
209 +
210 +- initializer(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_INITIALIZER);
211 +- mutator(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_MUTATOR);
212 ++ GAGenome::initializer(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_INITIALIZER);
213 ++ GAGenome::mutator(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_MUTATOR);
214 + comparator(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_COMPARATOR);
215 + crossover(GA1DArrayAlleleGenome<T>::DEFAULT_1DARRAY_ALLELE_CROSSOVER);
216 + }
217 +--- a/ga/GA2DArrayGenome.C
218 ++++ b/ga/GA2DArrayGenome.C
219 +@@ -269,10 +269,10 @@
220 + aset = new GAAlleleSet<T>[1];
221 + aset[0] = s;
222 +
223 +- initializer(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_INITIALIZER);
224 +- mutator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_MUTATOR);
225 +- comparator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_COMPARATOR);
226 +- crossover(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_CROSSOVER);
227 ++ GAGenome::initializer(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_INITIALIZER);
228 ++ GAGenome::mutator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_MUTATOR);
229 ++ GAGenome::comparator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_COMPARATOR);
230 ++ GAGenome::crossover(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_CROSSOVER);
231 + }
232 +
233 + template <class T>
234 +@@ -286,10 +286,10 @@
235 + for(int i=0; i<naset; i++)
236 + aset[i] = sa.set(i);
237 +
238 +- initializer(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_INITIALIZER);
239 +- mutator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_MUTATOR);
240 +- comparator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_COMPARATOR);
241 +- crossover(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_CROSSOVER);
242 ++ GAGenome::initializer(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_INITIALIZER);
243 ++ GAGenome::mutator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_MUTATOR);
244 ++ GAGenome::comparator(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_COMPARATOR);
245 ++ GAGenome::crossover(GA2DArrayAlleleGenome<T>::DEFAULT_2DARRAY_ALLELE_CROSSOVER);
246 + }
247 +
248 +
249 +--- a/ga/GA3DArrayGenome.C
250 ++++ b/ga/GA3DArrayGenome.C
251 +@@ -322,8 +322,8 @@
252 + aset = new GAAlleleSet<T>[1];
253 + aset[0] = s;
254 +
255 +- initializer(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_INITIALIZER);
256 +- mutator(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_MUTATOR);
257 ++ GAGenome::initializer(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_INITIALIZER);
258 ++ GAGenome::mutator(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_MUTATOR);
259 + comparator(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_COMPARATOR);
260 + crossover(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_CROSSOVER);
261 + }
262 +@@ -339,8 +339,8 @@
263 + for(int i=0; i<naset; i++)
264 + aset[i] = sa.set(i);
265 +
266 +- initializer(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_INITIALIZER);
267 +- mutator(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_MUTATOR);
268 ++ GAGenome::initializer(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_INITIALIZER);
269 ++ GAGenome::mutator(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_MUTATOR);
270 + comparator(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_COMPARATOR);
271 + crossover(GA3DArrayAlleleGenome<T>::DEFAULT_3DARRAY_ALLELE_CROSSOVER);
272 + }
273
274 diff --git a/sci-libs/galib/galib-2.4.7-r1.ebuild b/sci-libs/galib/galib-2.4.7-r1.ebuild
275 new file mode 100644
276 index 00000000..61d387b
277 --- /dev/null
278 +++ b/sci-libs/galib/galib-2.4.7-r1.ebuild
279 @@ -0,0 +1,55 @@
280 +# Copyright 1999-2016 Gentoo Foundation
281 +# Distributed under the terms of the GNU General Public License v2
282 +# $Id$
283 +
284 +EAPI=6
285 +
286 +inherit toolchain-funcs
287 +
288 +MY_PV="${PV//\./}"
289 +
290 +DESCRIPTION="Library for genetic algorithms in C++ programs"
291 +HOMEPAGE="http://lancet.mit.edu/ga/"
292 +SRC_URI="http://lancet.mit.edu/ga/dist/galib${MY_PV}.tgz"
293 +
294 +LICENSE="BSD examples? ( GPL-2 )"
295 +SLOT="0"
296 +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
297 +IUSE="doc examples"
298 +
299 +S="${WORKDIR}/${PN}${MY_PV}"
300 +
301 +PATCHES=(
302 + "${FILESDIR}/${PN}-2.4.7-fix-buildsystem.patch"
303 + "${FILESDIR}/${PN}-2.4.7-fix-c++14.patch"
304 + "${FILESDIR}/${PN}-2.4.7-Wformat-security.patch"
305 +)
306 +
307 +src_prepare() {
308 + default
309 + sed -e "s:/include:${EPREFIX}/usr/include:" \
310 + -e "s:/lib:${EPREFIX}/usr/$(get_libdir):" \
311 + -i makevars || die
312 +}
313 +
314 +src_compile() {
315 + emake \
316 + CXX="$(tc-getCXX)" \
317 + AR="$(tc-getAR)" \
318 + RANLIB="$(tc-getRANLIB)" \
319 + lib
320 + emake -C examples clean
321 +}
322 +
323 +src_install() {
324 + dodir /usr/$(get_libdir)
325 +
326 + use doc && HTML_DOCS+=( doc/. )
327 + if use examples; then
328 + dodoc -r examples
329 + find "${ED%/}/usr/share/doc/${PF}/examples" -iname 'makefile*' -delete || die
330 + docompress -x /usr/share/doc/${PF}/examples
331 + fi
332 +
333 + default
334 +}