New Recipe: Wcstools (#4968)

* Initial recipe
This commit is contained in:
Gabriele Baldassarre
2020-05-17 14:05:37 +02:00
committed by GitHub
parent 0456d40fa5
commit 1b5f839e59
6 changed files with 417 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
SUBDIRS = libwcs
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = -I$(top_srcdir)/libwcs
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = wcstools.pc
bin_SCRIPTS = wcstools
EXTRA_DIST = wcstools COPYING Readme NEWS Programs
bin_PROGRAMS = \
cphead delwcs delhead edhead fixpix gethead i2f imcat imhead immatch \
imrot imsize imstar imwcs scat sethead addpix getpix setpix sky2xy \
keyhead skycoor subpix xy2sky wcshead conpix gettab newfits getfits \
imstack imextract sumpix wcsremap getcol wcsgetdate imfill imsmooth imresize \
fileroot filename filext char2sp sp2char wcscrlf isnum isrange isfits \
isfile simpos bincat
# these ones don't need libwcs
wcscrlf_SOURCES = crlf.c
filename_SOURCES = filename.c
filedir_SOURCES = filedir.c
fileroot_SOURCES = fileroot.c
filext_SOURCES = filext.c
isrange_SOURCES = isrange.c
LDADD = $(top_builddir)/libwcs/libwcstools.la
bincat_SOURCES = bincat.c
getcol_SOURCES = getcol.c
wcsgetdate_SOURCES = getdate.c
gethead_SOURCES = gethead.c
getfits_SOURCES = getfits.c
getpix_SOURCES = getpix.c
gettab_SOURCES = gettab.c
imcat_SOURCES = imcat.c
imsize_SOURCES = imsize.c
imstar_SOURCES = imstar.c
imwcs_SOURCES = imwcs.c
immatch_SOURCES = immatch.c
scat_SOURCES = scat.c
setpix_SOURCES = setpix.c
skycoor_SOURCES = skycoor.c
sumpix_SOURCES = sumpix.c
xy2sky_SOURCES = xy2sky.c
simpos_SOURCES = simpos.c
addpix_SOURCES = addpix.c
char2sp_SOURCES = char2sp.c
conpix_SOURCES = conpix.c
cphead_SOURCES = cphead.c
delwcs_SOURCES = delwcs.c
delhead_SOURCES = delhead.c
edhead_SOURCES = edhead.c
fixpix_SOURCES = fixpix.c
i2f_SOURCES = i2f.c
imfill_SOURCES = imfill.c
imresize_SOURCES = imresize.c
imsmooth_SOURCES = imsmooth.c
imhead_SOURCES = imhead.c
imrot_SOURCES = imrot.c
imstack_SOURCES = imstack.c
imextract_SOURCES = imextract.c
isfile_SOURCES = isfile.c
isnum_SOURCES = isnum.c
keyhead_SOURCES = keyhead.c
newfits_SOURCES = newfits.c
wcsremap_SOURCES = remap.c
sethead_SOURCES = sethead.c
sky2xy_SOURCES = sky2xy.c
sp2char_SOURCES = sp2char.c
subpix_SOURCES = subpix.c
wcshead_SOURCES = wcshead.c

View File

@@ -0,0 +1,17 @@
lib_LTLIBRARIES = libwcstools.la
libwcstools_la_SOURCES = \
imsetwcs.c imgetwcs.c matchstar.c findstar.c daoread.c wcscon.c \
fitswcs.c wcsinit.c wcs.c ty2read.c webread.c tmcread.c \
gscread.c gsc2read.c ujcread.c uacread.c ubcread.c ucacread.c \
sdssread.c tabread.c binread.c ctgread.c actread.c catutil.c \
skybotread.c imrotate.c fitsfile.c imhfile.c \
hget.c hput.c imio.c dateutil.c imutil.c \
worldpos.c tnxpos.c zpxpos.c dsspos.c platepos.c \
sortstar.c platefit.c iget.c fileutil.c \
wcslib.c lin.c cel.c proj.c sph.c wcstrig.c distort.c poly.c
wcsdir = $(includedir)/wcs
wcs_HEADERS = \
wcscat.h wcslib.h wcs.h lwcs.h fitshead.h fitsfile.h imio.h
noinst_HEADERS = fitsfile1.h wcscat1.h

View File

@@ -0,0 +1,25 @@
AC_INIT([wcstools], [3.9.5] , [http://tdc-www.harvard.edu/wcstools/])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([libwcs/Makefile Makefile wcstools.pc])
AC_CONFIG_MACRO_DIRS([m4])
AC_CANONICAL_HOST
AC_PROG_CC
AC_PROG_LIBTOOL
LT_INIT([disable-static])
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_LIB([m], [sin])
AS_CASE([$host_os],[haiku*], [
AC_CHECK_LIB([network], [listen], [], [AC_MSG_ERROR([listen wa not found in Haiku -lnetwork])])
LDFLAGS="-lnetwork $LDFLAGS"
])
AC_SUBST([LDFLAGS])
AC_OUTPUT

View File

@@ -0,0 +1,12 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: @PACKAGE_NAME@
Description: World Coordinate System Library and Tools
Version: @PACKAGE_VERSION@
URL: http://tdc-www.harvard.edu/wcstools/
Libs: -L${libdir} -lwcstools
Libs.private: -lm
Cflags: -I${includedir}/wcs

View File

@@ -0,0 +1,59 @@
From dc8211f03f3c6ab2b427820f01fad755ddfb6136 Mon Sep 17 00:00:00 2001
From: Gabriele Baldassarre <gabriele@gabrielebaldassarre.com>
Date: Fri, 8 May 2020 23:33:56 +0000
Subject: Use autoheader file
diff --git a/libwcs/wcs.h b/libwcs/wcs.h
index 0d69049..6cda4e4 100644
--- a/libwcs/wcs.h
+++ b/libwcs/wcs.h
@@ -30,6 +30,10 @@
#ifndef _wcs_h_
#define _wcs_h_
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include "wcslib.h"
#include "fitshead.h"
--
2.26.0
From d4c42087bf2a8c2e122de4a4a776c05e0ad26a48 Mon Sep 17 00:00:00 2001
From: Gabriele Baldassarre <gabriele@gabrielebaldassarre.com>
Date: Fri, 8 May 2020 23:37:56 +0000
Subject: Fix compiler warnings
diff --git a/libwcs/imhfile.c b/libwcs/imhfile.c
index b618686..4279d3c 100644
--- a/libwcs/imhfile.c
+++ b/libwcs/imhfile.c
@@ -1075,7 +1075,7 @@ char *hdrname; /* IRAF image header file pathname */
/* add name */
newpixname[len] = '\0';
- (void)strncat (newpixname, pixname, SZ_IM2PIXFILE);
+ (void)strncat (newpixname, pixname, SZ_IM2PIXFILE - len);
}
/* Pixel file has same name as header file, but with .pix extension */
diff --git a/libwcs/webread.c b/libwcs/webread.c
index 1f5c518..cd9cba9 100644
--- a/libwcs/webread.c
+++ b/libwcs/webread.c
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
+#include <ctype.h>
#include <math.h>
#include "wcs.h"
#include "fitsfile.h"
--
2.26.0

View File

@@ -0,0 +1,227 @@
SUMMARY="World Coordinate System library for astronomical FITS images"
DESCRIPTION="WCSTools is a package of programs and a library of utility \
subroutines for setting and using the world coordinate systems (WCS) in the \
headers of the most common astronomical image formats, FITS and IRAF .imh, \
to relate image pixels to sky coordinates. "
HOMEPAGE="https://heasarc.gsfc.nasa.gov/fitsio/CCfits"
COPYRIGHT="1996-2020 Jessica Mink - Smithsonian Astrophysical Observatory
1995-2020 Mark Calabretta - Australia Telescope National Facility, CSIRO
1999-2020 Gentoo Authors"
LICENSE="GNU GPL v2
GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="http://tdc-www.harvard.edu/software/wcstools/wcstools-$portVersion.tar.gz"
CHECKSUM_SHA256="b2f9be55fdec29f0c640028a9986771bfd6ab3d2f633953e4c7cc3b410e5fe9c"
PATCHES="wcstools-$portVersion.patchset"
ADDITIONAL_FILES="
configure.ac
Makefile.am
Makefile.libwcs.am
wcstools.pc.in
"
ARCHITECTURES="!x86_gcc2 x86_64 ?arm ?ppc ?sparc"
SECONDARY_ARCHITECTURES="x86"
portVersionCompat="$portVersion compat >= ${portVersion%%.*}"
libVersion="0.0.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandSuffix=
commandBinDir=$prefix/bin
fi
PROVIDES="
wcstools$secondaryArchSuffix = $portVersionCompat
cmd:addpix$commandSuffix = $portVersionCompat
cmd:bincat$commandSuffix = $portVersionCompat
cmd:char2sp$commandSuffix = $portVersionCompat
cmd:conpix$commandSuffix = $portVersionCompat
cmd:cphead$commandSuffix = $portVersionCompat
cmd:delhead$commandSuffix = $portVersionCompat
cmd:delwcs$commandSuffix = $portVersionCompat
cmd:edhead$commandSuffix = $portVersionCompat
cmd:filename$commandSuffix = $portVersion
cmd:fileroot$commandSuffix = $portVersionCompat
cmd:filext$commandSuffix = $portVersionCompat
cmd:fixpix$commandSuffix = $portVersionCompat
cmd:getcol$commandSuffix = $portVersionCompat
cmd:getfits$commandSuffix = $portVersionCompat
cmd:gethead$commandSuffix = $portVersionCompat
cmd:getpix$commandSuffix = $portVersionCompat
cmd:gettab$commandSuffix = $portVersionCompat
cmd:i2f$commandSuffix = $portVersionCompat
cmd:imcat$commandSuffix = $portVersionCompat
cmd:imextract$commandSuffix = $portVersionCompat
cmd:imfill$commandSuffix = $portVersionCompat
cmd:imhead$commandSuffix = $portVersionCompat
cmd:immatch$commandSuffix = $portVersionCompat
cmd:imresize$commandSuffix = $portVersionCompat
cmd:imrot$commandSuffix = $portVersionCompat
cmd:imsize$commandSuffix = $portVersionCompat
cmd:imsmooth$commandSuffix = $portVersionCompat
cmd:imstack$commandSuffix = $portVersionCompat
cmd:imstar$commandSuffix = $portVersionCompat
cmd:imwcs$commandSuffix = $portVersionCompat
cmd:isfile$commandSuffix = $portVersionCompat
cmd:isfits$commandSuffix = $portVersionCompat
cmd:isnum$commandSuffix = $portVersionCompat
cmd:isrange$commandSuffix = $portVersionCompat
cmd:keyhead$commandSuffix = $portVersionCompat
cmd:newfits$commandSuffix = $portVersionCompat
cmd:scat$commandSuffix = $portVersionCompat
cmd:sethead$commandSuffix = $portVersionCompat
cmd:setpix$commandSuffix = $portVersionCompat
cmd:simpos$commandSuffix = $portVersionCompat
cmd:sky2xy$commandSuffix = $portVersionCompat
cmd:skycoor$commandSuffix = $portVersionCompat
cmd:sp2char$commandSuffix = $portVersionCompat
cmd:subpix$commandSuffix = $portVersionCompat
cmd:sumpix$commandSuffix = $portVersionCompat
cmd:wcscrlf$commandSuffix = $portVersionCompat
cmd:wcsgetdate$commandSuffix = $portVersionCompat
cmd:wcshead$commandSuffix = $portVersionCompat
cmd:wcsremap$commandSuffix = $portVersionCompat
cmd:wcstools$commandSuffix = $portVersionCompat
cmd:xy2sky$commandSuffix = $portVersionCompat
lib:libwcstools$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
"
PROVIDES_devel="
wcstools${secondaryArchSuffix}_devel = $portVersionCompat
devel:libwcstools$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
wcstools$secondaryArchSuffix == $portVersion base
haiku$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:aclocal
cmd:autoconf
cmd:autoheader
cmd:automake
cmd:awk
cmd:gcc$secondaryArchSuffix
cmd:libtoolize$secondaryArchSuffix
cmd:make
cmd:sed
"
defineDebugInfoPackage wcstools$secondaryArchSuffix \
"$commandBinDir"/addpix$commandSuffix \
"$commandBinDir"/bincat$commandSuffix \
"$commandBinDir"/char2sp$commandSuffix \
"$commandBinDir"/conpix$commandSuffix \
"$commandBinDir"/cphead$commandSuffix \
"$commandBinDir"/delhead$commandSuffix \
"$commandBinDir"/delwcs$commandSuffix \
"$commandBinDir"/edhead$commandSuffix \
"$commandBinDir"/filename$commandSuffix \
"$commandBinDir"/fileroot$commandSuffix \
"$commandBinDir"/filext$commandSuffix \
"$commandBinDir"/fixpix$commandSuffix \
"$commandBinDir"/getcol$commandSuffix \
"$commandBinDir"/getfits$commandSuffix \
"$commandBinDir"/gethead$commandSuffix \
"$commandBinDir"/getpix$commandSuffix \
"$commandBinDir"/gettab$commandSuffix \
"$commandBinDir"/i2f$commandSuffix \
"$commandBinDir"/imcat$commandSuffix \
"$commandBinDir"/imextract$commandSuffix \
"$commandBinDir"/imfill$commandSuffix \
"$commandBinDir"/imhead$commandSuffix \
"$commandBinDir"/immatch$commandSuffix \
"$commandBinDir"/imresize$commandSuffix \
"$commandBinDir"/imrot$commandSuffix \
"$commandBinDir"/imsize$commandSuffix \
"$commandBinDir"/imsmooth$commandSuffix \
"$commandBinDir"/imstack$commandSuffix \
"$commandBinDir"/imstar$commandSuffix \
"$commandBinDir"/imwcs$commandSuffix \
"$commandBinDir"/isfile$commandSuffix \
"$commandBinDir"/isfits$commandSuffix \
"$commandBinDir"/isnum$commandSuffix \
"$commandBinDir"/isrange$commandSuffix \
"$commandBinDir"/keyhead$commandSuffix \
"$commandBinDir"/newfits$commandSuffix \
"$commandBinDir"/scat$commandSuffix \
"$commandBinDir"/sethead$commandSuffix \
"$commandBinDir"/setpix$commandSuffix \
"$commandBinDir"/simpos$commandSuffix \
"$commandBinDir"/sky2xy$commandSuffix \
"$commandBinDir"/skycoor$commandSuffix \
"$commandBinDir"/sp2char$commandSuffix \
"$commandBinDir"/subpix$commandSuffix \
"$commandBinDir"/sumpix$commandSuffix \
"$commandBinDir"/wcscrlf$commandSuffix \
"$commandBinDir"/wcsgetdate$commandSuffix \
"$commandBinDir"/wcshead$commandSuffix \
"$commandBinDir"/wcsremap$commandSuffix \
"$commandBinDir"/xy2sky$commandSuffix \
"$libDir"/libwcstools.so.$libVersion
PATCH()
{
sed -i \
-e 's/getdate/wcsgetdate/' \
-e 's/crlf/wcscrlf/' \
-e 's/remap/wcsremap/' \
-e "s/3.... Programs/${portVersion} Programs/" \
wcstools
}
BUILD()
{
for f in "$portDir"/additional-files/{configure.ac,wcstools.pc.in,Makefile.am}; do
cp ${f} .
done
cp "$portDir"/additional-files/Makefile.libwcs.am libwcs/Makefile.am
mkdir -p m4
libtoolize --force --copy --install
aclocal --force --install
autoheader --force
autoconf --force
automake --add-missing --force-missing
runConfigure --omit-dirs binDir ./configure --bindir="$commandBinDir"
make $jobArgs
}
INSTALL()
{
make install
rm -f $libDir/libwcstools.la*
prepareInstalledDevelLib libwcstools
fixPkgconfig
# copy man documentation
mkdir -p $manDir/man1
cp -af man/man1/*.1 $manDir/man1
# devel package
packageEntries devel $developDir
}
TEST()
{
# WIP
newfits -a 10 -j 248 41 -p 0.15 test.fits
sethead test.fits A=1 B=1
[[ "$(./gethead test.fits RA)" == "16:32:00.0000" ]] || exit 1
rm test.fits
}