1 |
commit: fc75115e9cec3f2631140f323191232596ade9a3 |
2 |
Author: Sébastien Fabbro <bicatali <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Mar 7 21:01:33 2016 +0000 |
4 |
Commit: Sebastien Fabbro <bicatali <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Mar 7 21:02:27 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc75115e |
7 |
|
8 |
sci-astronomy/sextractor: re-added |
9 |
|
10 |
Package-Manager: portage-2.2.27 |
11 |
|
12 |
sci-astronomy/sextractor/Manifest | 1 + |
13 |
.../sextractor-2.19.5-fix-format-errors.patch | 65 +++++++++++++++++++ |
14 |
.../files/sextractor-2.19.5-have-malloc.patch | 32 ++++++++++ |
15 |
.../files/sextractor-2.19.5-have-mmap.patch | 55 ++++++++++++++++ |
16 |
.../files/sextractor-2.19.5-sigbus.patch | 26 ++++++++ |
17 |
sci-astronomy/sextractor/metadata.xml | 22 +++++++ |
18 |
sci-astronomy/sextractor/sextractor-2.19.5.ebuild | 73 ++++++++++++++++++++++ |
19 |
7 files changed, 274 insertions(+) |
20 |
|
21 |
diff --git a/sci-astronomy/sextractor/Manifest b/sci-astronomy/sextractor/Manifest |
22 |
new file mode 100644 |
23 |
index 0000000..bf33f0f |
24 |
--- /dev/null |
25 |
+++ b/sci-astronomy/sextractor/Manifest |
26 |
@@ -0,0 +1 @@ |
27 |
+DIST sextractor-2.19.5.tar.gz 4317039 SHA256 2a880e018585f905300d5919ab454b18640a5bef13deb5c4f03111ac4710b2c5 SHA512 aadd007facad983ea35bd7496a53520f987aa8e492259e428170354d262212e3c1a17c60bf6ea97b6056136b0bd02793e92e14b21cb40a0f8886245eeeac6f4d WHIRLPOOL cf499f4763ebf07d94ccb630030baa1b1e3e03972a9f214ee965c1f742548ee46fa4ce22203d1a6ee7c0817c2915d36483d1a7d7fcc04348beb559f5b5dd4464 |
28 |
|
29 |
diff --git a/sci-astronomy/sextractor/files/sextractor-2.19.5-fix-format-errors.patch b/sci-astronomy/sextractor/files/sextractor-2.19.5-fix-format-errors.patch |
30 |
new file mode 100644 |
31 |
index 0000000..c20ce31 |
32 |
--- /dev/null |
33 |
+++ b/sci-astronomy/sextractor/files/sextractor-2.19.5-fix-format-errors.patch |
34 |
@@ -0,0 +1,65 @@ |
35 |
+Author: Ole Streicher <debian@×××××××××.cx> |
36 |
+Description: Fix format security errors |
37 |
+--- a/src/catout.c |
38 |
++++ b/src/catout.c |
39 |
+@@ -999,7 +999,7 @@ |
40 |
+ break; |
41 |
+ |
42 |
+ case ASCII_SKYCAT: |
43 |
+- fprintf(ascfile, skycattail); |
44 |
++ fprintf(ascfile, "%s", skycattail); |
45 |
+ if (!prefs.pipe_flag) |
46 |
+ fclose(ascfile); |
47 |
+ break; |
48 |
+--- a/src/xml.c |
49 |
++++ b/src/xml.c |
50 |
+@@ -696,7 +696,7 @@ |
51 |
+ name, ucd); |
52 |
+ break; |
53 |
+ case P_STRING: |
54 |
+- sprintf(value, (char *)key[i].ptr); |
55 |
++ sprintf(value, "%s", (char *)key[i].ptr); |
56 |
+ fprintf(file, " <PARAM name=\"%s\" datatype=\"char\" arraysize=\"*\"" |
57 |
+ " ucd=\"%s\" value=\"%s\"/>\n", |
58 |
+ name, ucd, *value? value: " "); |
59 |
+@@ -705,13 +705,13 @@ |
60 |
+ n = *(key[i].nlistptr); |
61 |
+ if (n) |
62 |
+ { |
63 |
+- sprintf(value, ((char **)key[i].ptr)[0]); |
64 |
++ sprintf(value, "%s", ((char **)key[i].ptr)[0]); |
65 |
+ fprintf(file, " <PARAM name=\"%s\" datatype=\"char\"" |
66 |
+ " arraysize=\"*\" ucd=\"%s\" value=\"%s", |
67 |
+ name, ucd, *value? value: " "); |
68 |
+ for (j=1; j<n; j++) |
69 |
+ { |
70 |
+- sprintf(value, ((char **)key[i].ptr)[j]); |
71 |
++ sprintf(value, "%s", ((char **)key[i].ptr)[j]); |
72 |
+ fprintf(file, ",%s", *value? value: " "); |
73 |
+ } |
74 |
+ fprintf(file, "\"/>\n"); |
75 |
+@@ -722,7 +722,7 @@ |
76 |
+ name, ucd); |
77 |
+ break; |
78 |
+ case P_KEY: |
79 |
+- sprintf(value, key[i].keylist[*((int *)key[i].ptr)]); |
80 |
++ sprintf(value, "%s", key[i].keylist[*((int *)key[i].ptr)]); |
81 |
+ fprintf(file, " <PARAM name=\"%s\" datatype=\"char\" arraysize=\"*\"" |
82 |
+ " ucd=\"%s\" value=\"%s\"/>\n", |
83 |
+ name, ucd, value); |
84 |
+@@ -731,13 +731,13 @@ |
85 |
+ n = *(key[i].nlistptr); |
86 |
+ if (n) |
87 |
+ { |
88 |
+- sprintf(value, key[i].keylist[((int *)key[i].ptr)[0]]); |
89 |
++ sprintf(value, "%s", key[i].keylist[((int *)key[i].ptr)[0]]); |
90 |
+ fprintf(file, " <PARAM name=\"%s\" datatype=\"char\"" |
91 |
+ " arraysize=\"*\" ucd=\"%s\" value=\"%s", |
92 |
+ name, ucd, value); |
93 |
+ for (j=1; j<n; j++) |
94 |
+ { |
95 |
+- sprintf(value, key[i].keylist[((int *)key[i].ptr)[j]]); |
96 |
++ sprintf(value, "%s", key[i].keylist[((int *)key[i].ptr)[j]]); |
97 |
+ fprintf(file, ",%s", value); |
98 |
+ } |
99 |
+ fprintf(file, "\"/>\n"); |
100 |
|
101 |
diff --git a/sci-astronomy/sextractor/files/sextractor-2.19.5-have-malloc.patch b/sci-astronomy/sextractor/files/sextractor-2.19.5-have-malloc.patch |
102 |
new file mode 100644 |
103 |
index 0000000..dd10d4a |
104 |
--- /dev/null |
105 |
+++ b/sci-astronomy/sextractor/files/sextractor-2.19.5-have-malloc.patch |
106 |
@@ -0,0 +1,32 @@ |
107 |
+Author: Justin Pryzby <justinpryzby@××××××××.net> |
108 |
+Description: (guess) Define rpl_malloc if not there. |
109 |
+--- a/src/misc.c |
110 |
++++ b/src/misc.c |
111 |
+@@ -34,6 +34,8 @@ |
112 |
+ #include <time.h> |
113 |
+ #include <sys/time.h> |
114 |
+ |
115 |
++#include <sys/types.h> |
116 |
++ |
117 |
+ #include "define.h" |
118 |
+ #include "globals.h" |
119 |
+ |
120 |
+@@ -153,3 +155,18 @@ |
121 |
+ } |
122 |
+ |
123 |
+ |
124 |
++#if !HAVE_MALLOC |
125 |
++#undef malloc |
126 |
++ |
127 |
++// Allocate an N-byte block of memory from the heap. If N is zero, |
128 |
++// allocate a 1-byte block. |
129 |
++void *rpl_malloc(size_t n) |
130 |
++{ |
131 |
++ void *malloc(); |
132 |
++ if (0==n) { |
133 |
++ n = 1; |
134 |
++ } |
135 |
++ |
136 |
++ return malloc(n); |
137 |
++} |
138 |
++#endif |
139 |
|
140 |
diff --git a/sci-astronomy/sextractor/files/sextractor-2.19.5-have-mmap.patch b/sci-astronomy/sextractor/files/sextractor-2.19.5-have-mmap.patch |
141 |
new file mode 100644 |
142 |
index 0000000..1b65650 |
143 |
--- /dev/null |
144 |
+++ b/sci-astronomy/sextractor/files/sextractor-2.19.5-have-mmap.patch |
145 |
@@ -0,0 +1,55 @@ |
146 |
+Author: Justin Pryzby <justinpryzby@××××××××.net> |
147 |
+Description: (guess) Use mmap only if it exists. |
148 |
+--- a/src/fits/fitsbody.c |
149 |
++++ b/src/fits/fitsbody.c |
150 |
+@@ -64,9 +64,12 @@ |
151 |
+ ***/ |
152 |
+ PIXTYPE *alloc_body(tabstruct *tab, void (*func)(PIXTYPE *ptr, int npix)) |
153 |
+ { |
154 |
++#ifdef HAVE_MMAP |
155 |
+ FILE *file; |
156 |
+ PIXTYPE *buffer; |
157 |
+- size_t npix, size, sizeleft, spoonful; |
158 |
++ size_t sizeleft, spoonful; |
159 |
++#endif |
160 |
++ size_t npix, size; |
161 |
+ |
162 |
+ if (!body_ramflag) |
163 |
+ { |
164 |
+@@ -87,7 +90,9 @@ |
165 |
+ /* Decide if the data will go in physical memory or on swap-space */ |
166 |
+ npix = tab->tabsize/tab->bytepix; |
167 |
+ size = npix*sizeof(PIXTYPE); |
168 |
++#if !HAVE_MMAP |
169 |
+ if (size < body_ramleft) |
170 |
++#endif |
171 |
+ { |
172 |
+ /*-- There should be enough RAM left: try to do a malloc() */ |
173 |
+ if ((tab->bodybuf = malloc(size))) |
174 |
+@@ -105,6 +110,7 @@ |
175 |
+ tab->bodybuf = NULL; |
176 |
+ } |
177 |
+ |
178 |
++#if HAVE_MMAP |
179 |
+ if (size < body_vramleft) |
180 |
+ { |
181 |
+ /*-- Convert and copy the data to a swap file, and mmap() it */ |
182 |
+@@ -144,6 +150,7 @@ |
183 |
+ return NULL; |
184 |
+ return (PIXTYPE *)tab->bodybuf; |
185 |
+ } |
186 |
++#endif |
187 |
+ |
188 |
+ /* If no memory left at all: forget it! */ |
189 |
+ return NULL; |
190 |
+@@ -270,8 +277,10 @@ |
191 |
+ size = (tab->tabsize/tab->bytepix)*sizeof(PIXTYPE); |
192 |
+ if (tab->swapflag) |
193 |
+ { |
194 |
++#if HAVE_MMAP |
195 |
+ if (munmap(tab->bodybuf, size)) |
196 |
+ warning("Can't unmap ", tab->cat->filename); |
197 |
++#endif |
198 |
+ tab->swapflag = 0; |
199 |
+ tab->bodybuf = NULL; |
200 |
+ body_vramleft += size; |
201 |
|
202 |
diff --git a/sci-astronomy/sextractor/files/sextractor-2.19.5-sigbus.patch b/sci-astronomy/sextractor/files/sextractor-2.19.5-sigbus.patch |
203 |
new file mode 100644 |
204 |
index 0000000..2796f63 |
205 |
--- /dev/null |
206 |
+++ b/sci-astronomy/sextractor/files/sextractor-2.19.5-sigbus.patch |
207 |
@@ -0,0 +1,26 @@ |
208 |
+Author: Justin Pryzby <justinpryzby@××××××××.net> |
209 |
+Description: (guess) Handle the "sigbus" case only if it exists |
210 |
+--- a/src/fits/fitscleanup.c |
211 |
++++ b/src/fits/fitscleanup.c |
212 |
+@@ -164,7 +164,9 @@ |
213 |
+ /* Catch CTRL-Cs */ |
214 |
+ signal(SIGINT, signal_function); |
215 |
+ /* Catch bus errors */ |
216 |
++#ifdef SIGBUS // TODO: what if it is an enum? |
217 |
+ signal(SIGBUS, signal_function); |
218 |
++#endif |
219 |
+ /* Catch segmentation faults */ |
220 |
+ signal(SIGSEGV, signal_function); |
221 |
+ /* Catch floating exceptions */ |
222 |
+@@ -195,9 +197,11 @@ |
223 |
+ case SIGINT: |
224 |
+ fprintf(stderr, "^C\n"); |
225 |
+ exit(-1); |
226 |
++#ifdef SIGBUS |
227 |
+ case SIGBUS: |
228 |
+ fprintf(stderr, "bus error\n"); |
229 |
+ exit(-1); |
230 |
++#endif |
231 |
+ case SIGSEGV: |
232 |
+ fprintf(stderr, "segmentation fault\n"); |
233 |
+ exit(-1); |
234 |
|
235 |
diff --git a/sci-astronomy/sextractor/metadata.xml b/sci-astronomy/sextractor/metadata.xml |
236 |
new file mode 100644 |
237 |
index 0000000..87b74a0 |
238 |
--- /dev/null |
239 |
+++ b/sci-astronomy/sextractor/metadata.xml |
240 |
@@ -0,0 +1,22 @@ |
241 |
+<?xml version="1.0" encoding="UTF-8"?> |
242 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
243 |
+<pkgmetadata> |
244 |
+<maintainer type="project"> |
245 |
+<email>sci-astronomy@g.o</email> |
246 |
+<name>Gentoo Astronomy Project</name> |
247 |
+</maintainer> |
248 |
+<longdescription lang="en"> |
249 |
+ SExtractor (Source Extractor) is a program that builds a catalogue of |
250 |
+ objects from an astronomical image. Although it is particularly |
251 |
+ oriented towards reduction of large scale galaxy-survey data, it |
252 |
+ performs rather well on moderately crowded star fields. It has the |
253 |
+ ability to automatically separate stars and galaxy using neural |
254 |
+ networks. |
255 |
+</longdescription> |
256 |
+<use> |
257 |
+<flag name="modelfit"> |
258 |
+ Enable profile model fitting, needs <pkg>sci-libs/atlas</pkg> |
259 |
+ and <pkg>sci-libs/fftw</pkg> |
260 |
+</flag> |
261 |
+</use> |
262 |
+</pkgmetadata> |
263 |
|
264 |
diff --git a/sci-astronomy/sextractor/sextractor-2.19.5.ebuild b/sci-astronomy/sextractor/sextractor-2.19.5.ebuild |
265 |
new file mode 100644 |
266 |
index 0000000..ebd8ef3 |
267 |
--- /dev/null |
268 |
+++ b/sci-astronomy/sextractor/sextractor-2.19.5.ebuild |
269 |
@@ -0,0 +1,73 @@ |
270 |
+# Copyright 1999-2016 Gentoo Foundation |
271 |
+# Distributed under the terms of the GNU General Public License v2 |
272 |
+# $Id$ |
273 |
+ |
274 |
+EAPI=6 |
275 |
+ |
276 |
+AUTOTOOLS_AUTO_DEPEND=no |
277 |
+ |
278 |
+inherit autotools |
279 |
+ |
280 |
+DESCRIPTION="Extract catalogs of sources from astronomical FITS images" |
281 |
+HOMEPAGE="http://www.astromatic.net/software/sextractor" |
282 |
+SRC_URI="http://www.astromatic.net/download/${PN}/${P}.tar.gz" |
283 |
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" |
284 |
+ |
285 |
+LICENSE="GPL-3" |
286 |
+SLOT="0" |
287 |
+ |
288 |
+IUSE="doc modelfit test threads" |
289 |
+ |
290 |
+RDEPEND=" |
291 |
+ modelfit? ( sci-libs/atlas[lapack,threads=] sci-libs/fftw:3.0 )" |
292 |
+DEPEND="${RDEPEND} |
293 |
+ modelfit? ( ${AUTOTOOLS_DEPEND} )" |
294 |
+ |
295 |
+REQUIRED_USE="test? ( modelfit )" |
296 |
+ |
297 |
+PATCHES=( |
298 |
+ "${FILESDIR}/${P}-fix-format-errors.patch" |
299 |
+ "${FILESDIR}/${P}-have-malloc.patch" |
300 |
+ "${FILESDIR}/${P}-have-mmap.patch" |
301 |
+ "${FILESDIR}/${P}-sigbus.patch" |
302 |
+) |
303 |
+ |
304 |
+src_prepare() { |
305 |
+ default |
306 |
+ if use modelfit; then |
307 |
+ local mycblas=atlcblas myclapack=atlclapack |
308 |
+ if use threads; then |
309 |
+ [[ -e "${EPREFIX}"/usr/$(get_libdir)/libptcblas.so ]] && \ |
310 |
+ mycblas=ptcblas |
311 |
+ [[ -e "${EPREFIX}"/usr/$(get_libdir)/libptclapack.so ]] && \ |
312 |
+ myclapack=ptclapack |
313 |
+ fi |
314 |
+ sed -i \ |
315 |
+ -e "s/-lcblas/-l${mycblas}/g" \ |
316 |
+ -e "s/AC_CHECK_LIB(cblas/AC_CHECK_LIB(${mycblas}/g" \ |
317 |
+ -e "s/-llapack/-l${myclapack}/g" \ |
318 |
+ -e "s/AC_CHECK_LIB(lapack/AC_CHECK_LIB(${myclapack}/g" \ |
319 |
+ acx_atlas.m4 || die |
320 |
+ eautoreconf |
321 |
+ fi |
322 |
+} |
323 |
+ |
324 |
+src_configure() { |
325 |
+ econf \ |
326 |
+ --with-atlas-incdir="${EPREFIX}/usr/include/atlas" \ |
327 |
+ $(use_enable modelfit model-fitting) \ |
328 |
+ $(use_enable threads) |
329 |
+} |
330 |
+ |
331 |
+src_install () { |
332 |
+ default |
333 |
+ CONFDIR=/usr/share/sextractor |
334 |
+ insinto ${CONFDIR} |
335 |
+ doins config/* |
336 |
+ use doc && dodoc doc/* |
337 |
+} |
338 |
+ |
339 |
+pkg_postinst() { |
340 |
+ elog "SExtractor examples configuration files are located in" |
341 |
+ elog "${EROOT%/}/${CONFDIR} and are not loaded anymore by default." |
342 |
+} |