commit:     732d5c38a89687a8c064fb5e5033b911254412c4
Author:     Sébastien Fabbro <bicatali <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  7 21:00:43 2016 +0000
Commit:     Sebastien Fabbro <bicatali <AT> gentoo <DOT> org>
CommitDate: Mon Mar  7 21:02:24 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=732d5c38

sci-astronomy/psfex: initial import

Package-Manager: portage-2.2.27

 sci-astronomy/psfex/Manifest                       |   1 +
 .../psfex/files/psfex-3.17.1-have-mmap.patch       |  55 +++++
 .../psfex/files/psfex-3.17.1-plplot510.patch       | 221 +++++++++++++++++++++
 .../psfex/files/psfex-3.17.1-sigbus.patch          |  26 +++
 sci-astronomy/psfex/metadata.xml                   |  17 ++
 sci-astronomy/psfex/psfex-3.17.1.ebuild            |  64 ++++++
 6 files changed, 384 insertions(+)

diff --git a/sci-astronomy/psfex/Manifest b/sci-astronomy/psfex/Manifest
new file mode 100644
index 0000000..e739f7b
--- /dev/null
+++ b/sci-astronomy/psfex/Manifest
@@ -0,0 +1 @@
+DIST psfex-3.17.1.tar.gz 2366370 SHA256 
53f1b449ab7da7e6e0a989c41b82885f52c8f08270ceb4378bb1ec7ef754af89 SHA512 
eb562372dd75593a111c23698b0c00ce050547051803a741ac771ca346d13a0de1e478b055581619a9fa2bf6fa374915ca685cfcf1c4162271b6aa44303e6e58
 WHIRLPOOL 
3245b2b8c5a85e5f0a88b0c11aff07ce10ced0682890b786d0b092285d46fedf72bf15e87dd3ef6f6296527bc632e12c5162fa0b3b660b5b8bff0b30f38510c9

diff --git a/sci-astronomy/psfex/files/psfex-3.17.1-have-mmap.patch 
b/sci-astronomy/psfex/files/psfex-3.17.1-have-mmap.patch
new file mode 100644
index 0000000..1b65650
--- /dev/null
+++ b/sci-astronomy/psfex/files/psfex-3.17.1-have-mmap.patch
@@ -0,0 +1,55 @@
+Author: Justin Pryzby <[email protected]>
+Description: (guess) Use mmap only if it exists.
+--- a/src/fits/fitsbody.c
++++ b/src/fits/fitsbody.c
+@@ -64,9 +64,12 @@
+  ***/
+ PIXTYPE       *alloc_body(tabstruct *tab, void (*func)(PIXTYPE *ptr, int 
npix))
+   {
++#ifdef        HAVE_MMAP
+    FILE               *file;
+    PIXTYPE    *buffer;
+-   size_t     npix, size, sizeleft, spoonful;
++   size_t     sizeleft, spoonful;
++#endif
++   size_t     npix, size;
+ 
+   if (!body_ramflag)
+     {
+@@ -87,7 +90,9 @@
+ /* Decide if the data will go in physical memory or on swap-space */
+   npix = tab->tabsize/tab->bytepix;
+   size = npix*sizeof(PIXTYPE);
++#if !HAVE_MMAP
+   if (size < body_ramleft)
++#endif
+     {
+ /*-- There should be enough RAM left: try to do a malloc() */
+     if ((tab->bodybuf = malloc(size)))
+@@ -105,6 +110,7 @@
+       tab->bodybuf = NULL;
+     }
+ 
++#if HAVE_MMAP
+   if (size < body_vramleft)
+     {
+ /*-- Convert and copy the data to a swap file, and mmap() it */
+@@ -144,6 +150,7 @@
+       return NULL;
+     return (PIXTYPE *)tab->bodybuf;
+     }
++#endif
+ 
+ /* If no memory left at all: forget it! */
+   return NULL;
+@@ -270,8 +277,10 @@
+     size = (tab->tabsize/tab->bytepix)*sizeof(PIXTYPE);
+     if (tab->swapflag)
+       {
++#if HAVE_MMAP
+       if (munmap(tab->bodybuf, size))
+         warning("Can't unmap ", tab->cat->filename);
++#endif
+       tab->swapflag = 0;
+       tab->bodybuf = NULL;
+       body_vramleft += size;

diff --git a/sci-astronomy/psfex/files/psfex-3.17.1-plplot510.patch 
b/sci-astronomy/psfex/files/psfex-3.17.1-plplot510.patch
new file mode 100644
index 0000000..4dd5805
--- /dev/null
+++ b/sci-astronomy/psfex/files/psfex-3.17.1-plplot510.patch
@@ -0,0 +1,221 @@
+Author: Ole Streicher <[email protected]>
+Description: Replace deprecated plwid() calls by plwidth().
+--- a/src/cplot.c
++++ b/src/cplot.c
+@@ -527,7 +527,7 @@
+ 
+ /* Draw meridians */
+   plschr(0.0, 0.33);
+-  plwid(0);
++  plwidth(0.0);
+   pllsty(2);
+   xmd = xmu = xdo = -0.5;
+   ymd = ymu = ydo = -0.5;
+@@ -709,14 +709,14 @@
+   ymin = 0.5;
+   ymax = 100.5;
+   lwid = plotaaflag? ((CPLOT_AAFAC+1)/2) : 1;
+-  plwid(lwid);
++  plwidth((double)lwid);
+   plfont(2);
+   plcol0(15);
+   plenv((PLFLT)xmin, (PLFLT)xmax, (PLFLT)ymin, (PLFLT)ymax, 1, -1);
+   sprintf(str, "#uField %.24s: FWHM map", field->rtcatname);
+   plschr(0.0, 1.0);
+   pllab("","", str);
+-  plwid(0);
++  plwidth(0.0);
+   plcol0(7);
+   cplot_drawloccoordgrid(wcsout, xmin, xmax, ymin, ymax);
+ 
+@@ -830,7 +830,7 @@
+       plFree2dGrid(fwhm, nsnap2, nsnap2);
+       }
+     plcol0(7);
+-    plwid(lwid);
++    plwidth((double)lwid);
+     cplot_drawbounds(wcs, wcsout);
+     }
+ 
+@@ -941,14 +941,14 @@
+   ymin = 0.5;
+   ymax = 100.5;
+   lwid = plotaaflag? ((CPLOT_AAFAC+1)/2) : 1;
+-  plwid(lwid);
++  plwidth((double)lwid);
+   plfont(2);
+   plcol0(15);
+   plenv((PLFLT)xmin, (PLFLT)xmax, (PLFLT)ymin, (PLFLT)ymax, 1, -1);
+   sprintf(str, "#uField %.24s: ellipticity map", field->rtcatname);
+   plschr(0.0, 1.0);
+   pllab("","", str);
+-  plwid(0);
++  plwidth(0.0);
+   plcol0(7);
+   cplot_drawloccoordgrid(wcsout, xmin, xmax, ymin, ymax);
+ 
+@@ -1062,7 +1062,7 @@
+       plFree2dGrid(ellip, nsnap2, nsnap2);
+       }
+     plcol0(7);
+-    plwid(lwid);
++    plwidth((double)lwid);
+     cplot_drawbounds(wcs, wcsout);
+     }
+ 
+@@ -1159,14 +1159,14 @@
+   ymin = 0.5;
+   ymax = 100.5;
+   lwid = plotaaflag? ((CPLOT_AAFAC+1)/2) : 1;
+-  plwid(lwid);
++  plwidth((double)lwid);
+   plfont(2);
+   plcol0(15);
+   plenv((PLFLT)xmin, (PLFLT)xmax, (PLFLT)ymin, (PLFLT)ymax, 1, -1);
+   sprintf(str, "#uField %.24s: map of Moffat fit residuals", 
field->rtcatname);
+   plschr(0.0, 1.0);
+   pllab("","", str);
+-  plwid(0);
++  plwidth(0.0);
+   plcol0(7);
+   cplot_drawloccoordgrid(wcsout, xmin, xmax, ymin, ymax);
+ 
+@@ -1278,7 +1278,7 @@
+       plFree2dGrid(resi, nsnap2, nsnap2);
+       }
+     plcol0(7);
+-    plwid(lwid);
++    plwidth((double)lwid);
+     cplot_drawbounds(wcs, wcsout);
+     }
+ 
+@@ -1378,14 +1378,14 @@
+   ymin = 0.5;
+   ymax = 100.5;
+   lwid = plotaaflag? ((CPLOT_AAFAC+1)/2) : 1;
+-  plwid(lwid);
++  plwidth((double)lwid);
+   plfont(2);
+   plcol0(15);
+   plenv((PLFLT)xmin, (PLFLT)xmax, (PLFLT)ymin, (PLFLT)ymax, 1, -1);
+   sprintf(str, "#uField %.24s: PSF asymmetry map", field->rtcatname);
+   plschr(0.0, 1.0);
+   pllab("","", str);
+-  plwid(0);
++  plwidth(0.0);
+   plcol0(7);
+   cplot_drawloccoordgrid(wcsout, xmin, xmax, ymin, ymax);
+ 
+@@ -1497,7 +1497,7 @@
+       plFree2dGrid(resi, nsnap2, nsnap2);
+       }
+     plcol0(7);
+-    plwid(lwid);
++    plwidth((double)lwid);
+     cplot_drawbounds(wcs, wcsout);
+     }
+ 
+@@ -1592,14 +1592,14 @@
+   ymin = 0.5;
+   ymax = 100.5;
+   lwid = plotaaflag? ((CPLOT_AAFAC+1)/2) : 1;
+-  plwid(lwid);
++  plwidth((double)lwid);
+   plfont(2);
+   plcol0(15);
+   plenv((PLFLT)xmin, (PLFLT)xmax, (PLFLT)ymin, (PLFLT)ymax, 1, -1);
+   sprintf(str, "#uField %.24s: source count map", field->rtcatname);
+   plschr(0.0, 1.0);
+   pllab("","", str);
+-  plwid(0);
++  plwidth(0.0);
+   plcol0(7);
+   cplot_drawloccoordgrid(wcsout, xmin, xmax, ymin, ymax);
+ 
+@@ -1666,7 +1666,7 @@
+            clevel, CPLOT_NSHADES, 1, 0, 0, plfill, 0, distort_map, wcsptr);
+     plFree2dGrid(count, nsnap2, nsnap2);
+     plcol0(7);
+-    plwid(lwid);
++    plwidth((double)lwid);
+     cplot_drawbounds(wcs, wcsout);
+     }
+ 
+@@ -1751,14 +1751,14 @@
+   ymin = 0.5;
+   ymax = 100.5;
+   lwid = plotaaflag? ((CPLOT_AAFAC+1)/2) : 1;
+-  plwid(lwid);
++  plwidth((double)lwid);
+   plfont(2);
+   plcol0(15);
+   plenv((PLFLT)xmin, (PLFLT)xmax, (PLFLT)ymin, (PLFLT)ymax, 1, -1);
+   sprintf(str, "#uField %.24s: source count fraction map", field->rtcatname);
+   plschr(0.0, 1.0);
+   pllab("","", str);
+-  plwid(0);
++  plwidth(0.0);
+   plcol0(7);
+   cplot_drawloccoordgrid(wcsout, xmin, xmax, ymin, ymax);
+ 
+@@ -1826,7 +1826,7 @@
+            clevel, CPLOT_NSHADES, 1, 0, 0, plfill, 0, distort_map, wcsptr);
+     plFree2dGrid(count, nsnap2, nsnap2);
+     plcol0(7);
+-    plwid(lwid);
++    plwidth((double)lwid);
+     cplot_drawbounds(wcs, wcsout);
+     }
+ 
+@@ -1911,14 +1911,14 @@
+   ymin = 0.5;
+   ymax = 100.5;
+   lwid = plotaaflag? ((CPLOT_AAFAC+1)/2) : 1;
+-  plwid(lwid);
++  plwidth((double)lwid);
+   plfont(2);
+   plcol0(15);
+   plenv((PLFLT)xmin, (PLFLT)xmax, (PLFLT)ymin, (PLFLT)ymax, 1, -1);
+   sprintf(str, "#uField %.24s: #gx#u2#d/d.o.f. map", field->rtcatname);
+   plschr(0.0, 1.0);
+   pllab("","", str);
+-  plwid(0);
++  plwidth(0.0);
+   plcol0(7);
+   cplot_drawloccoordgrid(wcsout, xmin, xmax, ymin, ymax);
+ 
+@@ -1985,7 +1985,7 @@
+            clevel, CPLOT_NSHADES, 1, 0, 0, plfill, 0, distort_map, wcsptr);
+     plFree2dGrid(count, nsnap2, nsnap2);
+     plcol0(7);
+-    plwid(lwid);
++    plwidth((double)lwid);
+     cplot_drawbounds(wcs, wcsout);
+     }
+ 
+@@ -2070,14 +2070,14 @@
+   ymin = 0.5;
+   ymax = 100.5;
+   lwid = plotaaflag? ((CPLOT_AAFAC+1)/2) : 1;
+-  plwid(lwid);
++  plwidth((double)lwid);
+   plfont(2);
+   plcol0(15);
+   plenv((PLFLT)xmin, (PLFLT)xmax, (PLFLT)ymin, (PLFLT)ymax, 1, -1);
+   sprintf(str, "#uField %.24s: map of residuals", field->rtcatname);
+   plschr(0.0, 1.0);
+   pllab("","", str);
+-  plwid(0);
++  plwidth(0.0);
+   plcol0(7);
+   cplot_drawloccoordgrid(wcsout, xmin, xmax, ymin, ymax);
+ 
+@@ -2144,7 +2144,7 @@
+            clevel, CPLOT_NSHADES, 1, 0, 0, plfill, 0, distort_map, wcsptr);
+     plFree2dGrid(count, nsnap2, nsnap2);
+     plcol0(7);
+-    plwid(lwid);
++    plwidth((double)lwid);
+     cplot_drawbounds(wcs, wcsout);
+     }
+ 

diff --git a/sci-astronomy/psfex/files/psfex-3.17.1-sigbus.patch 
b/sci-astronomy/psfex/files/psfex-3.17.1-sigbus.patch
new file mode 100644
index 0000000..2796f63
--- /dev/null
+++ b/sci-astronomy/psfex/files/psfex-3.17.1-sigbus.patch
@@ -0,0 +1,26 @@
+Author: Justin Pryzby <[email protected]>
+Description: (guess) Handle the "sigbus" case only if it exists
+--- a/src/fits/fitscleanup.c
++++ b/src/fits/fitscleanup.c
+@@ -164,7 +164,9 @@
+ /* Catch CTRL-Cs */
+   signal(SIGINT, signal_function);
+ /* Catch bus errors */
++#ifdef        SIGBUS // TODO: what if it is an enum?
+   signal(SIGBUS, signal_function);
++#endif
+ /* Catch segmentation faults */
+   signal(SIGSEGV, signal_function);
+ /* Catch floating exceptions */
+@@ -195,9 +197,11 @@
+     case SIGINT:
+       fprintf(stderr, "^C\n");
+       exit(-1);
++#ifdef        SIGBUS
+     case SIGBUS:
+       fprintf(stderr, "bus error\n");
+       exit(-1);
++#endif
+     case SIGSEGV:
+       fprintf(stderr, "segmentation fault\n");
+       exit(-1);

diff --git a/sci-astronomy/psfex/metadata.xml b/sci-astronomy/psfex/metadata.xml
new file mode 100644
index 0000000..45b00a7
--- /dev/null
+++ b/sci-astronomy/psfex/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+<maintainer type="project">
+  <email>[email protected]</email>
+  <name>Gentoo Astronomy Project</name>
+</maintainer>
+<longdescription lang="en">
+  PSFEx  (“PSF Extractor”) extracts models of the Point Spread
+  Function (PSF) from FITS images processed with 
<pkg>sci-libs/sextractor</pkg>, and
+  measures the quality of images. The generated PSF models can be used
+  for model-fitting photometry or morphological analyses.
+</longdescription>
+<use>
+  <flag name="plplot">Build with <pkg>sci-libs/plplot</pkg> to allow 
diagnostic plots during processing</flag>
+</use>
+</pkgmetadata>

diff --git a/sci-astronomy/psfex/psfex-3.17.1.ebuild 
b/sci-astronomy/psfex/psfex-3.17.1.ebuild
new file mode 100644
index 0000000..d288e5b
--- /dev/null
+++ b/sci-astronomy/psfex/psfex-3.17.1.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit autotools
+
+DESCRIPTION="Extracts models of the Point Spread Function from FITS images"
+HOMEPAGE="http://www.astromatic.net/software/psfex";
+SRC_URI="http://www.astromatic.net/download/${PN}/${P}.tar.gz";
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+
+LICENSE="GPL-3"
+SLOT="0"
+IUSE="doc threads plplot"
+
+RDEPEND="
+       sci-libs/atlas:0[lapack,threads=]
+       sci-libs/fftw:3.0
+       plplot? ( sci-libs/plplot:= )"
+DEPEND="${RDEPEND}
+       virtual/pkgconfig"
+
+PATCHES=(
+       "${FILESDIR}/${P}-have-mmap.patch"
+       "${FILESDIR}/${P}-plplot510.patch"
+       "${FILESDIR}/${P}-sigbus.patch"
+)
+
+src_prepare() {
+       default
+       local mycblas=atlcblas  myclapack=atlclapack
+       if use threads; then
+               [[ -e ${EPREFIX}/usr/$(get_libdir)/libptcblas.so ]] && \
+                       mycblas=ptcblas
+               [[ -e ${EPREFIX}/usr/$(get_libdir)/libptclapack.so ]] &&
+               myclapack=ptclapack
+       fi
+       # fix the configure and not the acx_atlas.m4. the eautoreconf will
+       # produce a configure giving  a wrong install Makefile target (to fix)
+       sed -e "s/-lcblas/-l${mycblas}/g" \
+               -e "s/AC_CHECK_LIB(cblas/AC_CHECK_LIB(${mycblas}/g" \
+               -e "s/-llapack/-l${myclapack}/g" \
+               -e "s/\(lapack_lib=\).*/\1${myclapack}/g" \
+               -e "s/AC_CHECK_LIB(lapack/AC_CHECK_LIB(${myclapack}/g" \
+               -i acx_atlas.m4 || die
+
+       # fix for newer plplot
+       sed -e 's/plplotd/plplot/g' -i acx_plplot.m4 || die
+       eautoreconf
+}
+
+src_configure() {
+       econf \
+               --with-atlas-incdir="${EPREFIX}/usr/include/atlas" \
+               $(use_enable plplot) \
+               $(use_enable threads)
+}
+
+src_install () {
+       default
+       use doc && dodoc doc/*
+}

Reply via email to