23dea7f
# Bootstrap option, we have to build astrometry before we can generate index
23dea7f
# files, but later package will require them for tests at build time
23dea7f
%global bootstrap 1
23dea7f
23dea7f
23dea7f
Name:           astrometry
43b7a2a
Version:        0.74
43b7a2a
Release:        1%{?dist}
23dea7f
Summary:        Blind astrometric calibration of arbitrary astronomical images
23dea7f
23dea7f
# Software is BSD with some GPL code
23dea7f
# https://groups.google.com/forum/#!topic/astrometry/9GgP7rj4Y-g
23dea7f
# Here we asked to fix source headers:
23dea7f
# https://groups.google.com/forum/#!topic/astrometry/mCuyze3TOeM
23dea7f
# 
23dea7f
# Licensing breakdown
23dea7f
# ===================
23dea7f
#
23dea7f
# See also: file CREDITS in source folder
23dea7f
#
23dea7f
# General license for astrometry code: 3-clause BSD
23dea7f
#
23dea7f
# GPLv2+:
23dea7f
#    qfits-an/*
23dea7f
#    include/astrometry/qfits*
23dea7f
#    catalogs/ucac4-fits.h
23dea7f
#    libkd/an-fls.h
23dea7f
#    util/makefile.jpeg
23dea7f
#    util/md5.c
23dea7f
#    Makefile
23dea7f
#    doc/UCAC3_guide/* (not used for build and not shipped)
23dea7f
#    doc/UCAC4_guide/* (not used for build and not shipped)
f629677
#    
f629677
#    2MASS data files index-42xx.fits
23dea7f
#
23dea7f
# GPLv3+:
23dea7f
#    blind/an_mm_malloc.h
23dea7f
#    util/ctmf.c
23dea7f
#
23dea7f
License:        BSD and GPLv2+ and GPLv3+
23dea7f
URL:            http://www.astrometry.net
23dea7f
23dea7f
# Upstream sources contains nonfree stuff so we must clean them
23dea7f
# Download original sources from:
23dea7f
# Source0:        http://astrometry.net/downloads/%%{name}.net-%%{version}.tar.gz
23dea7f
# Then use the provided script to clean them with
23dea7f
# ./generate-tarball %%{version}
23dea7f
Source0:        %{name}.net-%{version}-clean.tar.xz
23dea7f
Source1:        %{name}-generate-tarball.sh
23dea7f
7e2ef85
# 2MASS data files, ./astrometry-get-data.sh
7e2ef85
Source2:        astrometry-data-4204.tar.xz
7e2ef85
Source3:        astrometry-data-4205.tar.xz
7e2ef85
Source4:        astrometry-data-4206.tar.xz
7e2ef85
Source5:        astrometry-data-4207.tar.xz
7e2ef85
Source6:        astrometry-data-4208-4219.tar.xz
7e2ef85
Source7:        astrometry-get-data.sh
f629677
23dea7f
# Patches from Ole Streicher <olebole@debian.org> used on Debian to
23dea7f
#  * disable build of nonfree stuff removed from sources
23dea7f
#  * have a proper versioned soname
23dea7f
#  * use system libraries properly
23dea7f
#  * use dynamical linking
9df6897
Patch0:         %{name}-0.73-Add-SONAME-to-libastrometry.so.patch
23dea7f
Patch1:         %{name}-Dynamically-link-to-libastrometry.so-when-possible.patch
23dea7f
Patch2:         %{name}-Fix-issues-when-using-Debian-libs-instead-of-convienience.patch
23dea7f
Patch3:         %{name}-Call-python-scripts-as-modules-instead-of-executables.patch
81cd19f
Patch4:         %{name}-0.73-Don-t-install-non-free-files-images-and-NGC2000.0-catalog.patch
23dea7f
23dea7f
23dea7f
BuildRequires:  netpbm-devel
23dea7f
BuildRequires:  python2-numpy
23dea7f
BuildRequires:  python2-astropy
23dea7f
BuildRequires:  python2-devel
23dea7f
BuildRequires:  swig
23dea7f
BuildRequires:  xorg-x11-proto-devel
23dea7f
23dea7f
BuildRequires:  pkgconfig
23dea7f
BuildRequires:  pkgconfig(cairo)
23dea7f
BuildRequires:  pkgconfig(cfitsio)
23dea7f
BuildRequires:  pkgconfig(fontconfig)
23dea7f
BuildRequires:  pkgconfig(gsl)
23dea7f
BuildRequires:  pkgconfig(libjpeg)
23dea7f
BuildRequires:  pkgconfig(libpng)
23dea7f
BuildRequires:  pkgconfig(wcslib)
23dea7f
BuildRequires:  pkgconfig(xrender)
23dea7f
BuildRequires:  pkgconfig(zlib)
23dea7f
23dea7f
%if ! 0%{?bootstrap}
23dea7f
BuildRequires:  astrometry-tycho2
23dea7f
%endif
23dea7f
f629677
Requires:       %{name}-data = %{version}-%{release}
3d047f1
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
23dea7f
Requires:       netpbm-progs
23dea7f
Requires:       python2-%{name} = %{version}-%{release}
23dea7f
8f9f443
# User could use own set of index files or another set from upstream.
f629677
# Therefore we suggest and not require astrometry-tycho2 here
f629677
Suggests:     astrometry-tycho2
23dea7f
23dea7f
%description
23dea7f
The astrometry engine will take any image and return the astrometry
23dea7f
world coordinate system (WCS), a standards-based description of the
23dea7f
transformation between image coordinates and sky coordinates.
23dea7f
23dea7f
Other tools included in the astrometry package can do much more, like
23dea7f
plotting astronomic information over solved images, convertion utilities
23dea7f
or generate statistics from FITS images.
23dea7f
7e2ef85
f629677
%package data
7e2ef85
Summary:        2MASS catalog index files for astrometry (4208-4129, wide-field)
f629677
License:        GPLv2+
f629677
BuildArch:      noarch
f629677
Requires:       %{name} = %{version}-%{release}
7e2ef85
Provides:       %{name}-data-4208-4219 = %{version}-%{release}
f629677
f629677
%description data
7e2ef85
2MASS index files 4208-4219 (wide-field, 30-2000 arcminutes) for astrometry.
7e2ef85
7e2ef85
7e2ef85
%package data-4204
7e2ef85
Summary:        2MASS catalog index files (4204 series) for astrometry
7e2ef85
License:        GPLv2+
7e2ef85
BuildArch:      noarch
7e2ef85
Requires:       %{name} = %{version}-%{release}
7e2ef85
Enhances:       %{name}
7e2ef85
7e2ef85
%description data-4204
7e2ef85
2MASS index files (4204 series) with 8-11 arcminutes skymarks for astrometry.
7e2ef85
7e2ef85
7e2ef85
%package data-4205
7e2ef85
Summary:        2MASS catalog index files (4205 series) for astrometry
7e2ef85
License:        GPLv2+
7e2ef85
BuildArch:      noarch
7e2ef85
Requires:       %{name} = %{version}-%{release}
7e2ef85
Enhances:       %{name}
7e2ef85
7e2ef85
%description data-4205
7e2ef85
2MASS index files (4205 series) with 11-16 arcminutes skymarks for astrometry.
7e2ef85
7e2ef85
7e2ef85
%package data-4206
7e2ef85
Summary:        2MASS catalog index files (4206 series) for astrometry
7e2ef85
License:        GPLv2+
7e2ef85
BuildArch:      noarch
7e2ef85
Requires:       %{name} = %{version}-%{release}
7e2ef85
Enhances:       %{name}
7e2ef85
7e2ef85
%description data-4206
7e2ef85
2MASS index files (4206 series) with 16-22 arcminutes skymarks for astrometry.
7e2ef85
7e2ef85
7e2ef85
%package data-4207
7e2ef85
Summary:        2MASS catalog index files (4207 series) for astrometry
7e2ef85
License:        GPLv2+
7e2ef85
BuildArch:      noarch
7e2ef85
Requires:       %{name} = %{version}-%{release}
7e2ef85
Enhances:       %{name}
7e2ef85
7e2ef85
%description data-4207
7e2ef85
2MASS index files (4207 series) with 22-30 arcminutes skymarks for astrometry.
7e2ef85
23dea7f
23dea7f
%package devel
23dea7f
Summary:        Development files for %{name}
3d047f1
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
23dea7f
23dea7f
%description devel
23dea7f
%{summary}
23dea7f
3d047f1
%package libs
3d047f1
Summary:        Libraries for %{name}
3d047f1
3d047f1
%description libs
3d047f1
Libraries for %{name}
3d047f1
23dea7f
%package -n python2-%{name}
23dea7f
Summary:        Python modules from %{name}
23dea7f
Requires:       python2-astropy
23dea7f
Provides:       %{name}-python2 = %{version}-%{release}
8f9f443
Obsoletes:      %{name}-python2 < %{version}-%{release}
23dea7f
23dea7f
%description -n python2-%{name}
23dea7f
%{summary}
23dea7f
23dea7f
23dea7f
%prep
7e2ef85
%autosetup -p1 -n %{name}.net-%{version}
7e2ef85
%setup -T -D -a 2 -n %{name}.net-%{version}
7e2ef85
%setup -T -D -a 3 -n %{name}.net-%{version}
7e2ef85
%setup -T -D -a 4 -n %{name}.net-%{version}
7e2ef85
%setup -T -D -a 5 -n %{name}.net-%{version}
7e2ef85
%setup -T -D -a 6 -n %{name}.net-%{version}
23dea7f
23dea7f
# Fix Wrong FSF address - reported upstream
23dea7f
# https://groups.google.com/forum/#!topic/astrometry/mCuyze3TOeM
23dea7f
grep -rl '59 Temple Place, Suite 330, Boston, MA  02111-1307  USA' * | xargs -i@ sed -i 's/59 Temple Place, Suite 330, Boston, MA  02111-1307  USA/51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA./g' @
23dea7f
23dea7f
23dea7f
%build
23dea7f
# Weird symlink required... (also in upstream git)
23dea7f
ln -sf . astrometry
23dea7f
23dea7f
# Astrometry doesn't automatically find netpbm
23dea7f
export NETPBM_INC=-I%{_includedir}/netpbm
23dea7f
export NETPBM_LIB="-L%{_libdir} -lnetpbm"
23dea7f
23dea7f
# Apply mandatory ld flags
23dea7f
export LDFLAGS="%__global_ldflags"
23dea7f
23dea7f
# Parallel make flags on break build
23dea7f
make SYSTEM_GSL=yes all py extra ARCH_FLAGS="%{optflags}"
23dea7f
23dea7f
23dea7f
%install
23dea7f
%{make_install} SYSTEM_GSL=yes \
23dea7f
                INSTALL_DIR=%{buildroot}%{_prefix} \
23dea7f
                PY_BASE_INSTALL_DIR=%{buildroot}%{python2_sitearch}/%{name} \
23dea7f
                INCLUDE_INSTALL_DIR=%{buildroot}%{_includedir}/%{name} \
23dea7f
                LIB_INSTALL_DIR=%{buildroot}%{_libdir} \
23dea7f
                BIN_INSTALL_DIR=%{buildroot}%{_bindir} \
23dea7f
                DATA_INSTALL_DIR=%{buildroot}%{_datadir}/%{name}/data \
23dea7f
                PY_BASE_LINK_DIR=%{python2_sitearch}/%{name} \
23dea7f
                ETC_INSTALL_DIR=%{buildroot}%{_sysconfdir} \
23dea7f
                MAN1_INSTALL_DIR=%{buildroot}%{_mandir}/man1 \
23dea7f
                DOC_INSTALL_DIR=%{buildroot}%{_docdir}/%{name} \
23dea7f
                EXAMPLE_INSTALL_DIR=%{buildroot}%{_datadir}/%{name}/examples
23dea7f
23dea7f
# We need to correct the data dir link in config file
23dea7f
sed -i \
23dea7f
    "s:%{buildroot}%{_prefix}/data:%{_datadir}/%{name}/data:" \
23dea7f
    %{buildroot}/etc/astrometry.cfg
23dea7f
23dea7f
# Rename generic named executables with known conflict
23dea7f
pushd %{buildroot}%{_bindir}
23dea7f
for exec in tabmerge tablist; do
23dea7f
        mv $exec astrometry-$exec
23dea7f
done
23dea7f
popd
23dea7f
23dea7f
# Remove unuseful file
23dea7f
rm -f %{buildroot}%{_docdir}/%{name}/report.txt
23dea7f
23dea7f
# We don't ship static libraries so we remove them
23dea7f
rm -f %{buildroot}%{_libdir}/*.a
23dea7f
23dea7f
# Fix wrong python interpreter
23dea7f
pushd %{buildroot}%{_bindir}
23dea7f
for exec in degtohms image2pnm removelines text2fits hmstodeg votabletofits uniformize merge-columns; do
23dea7f
        sed -i "s,/usr/bin/env python,%{__python2},g" $exec
23dea7f
done
23dea7f
popd
23dea7f
find %{buildroot}/%{python2_sitearch}/%{name} -name '*.py' | xargs sed -i '1s|^#!.*|#!%{__python2}|'
23dea7f
23dea7f
# LICENSE file is managed by %%license scriptlet
23dea7f
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE
23dea7f
7e2ef85
# Install data files
7e2ef85
install -m0644 astrometry-data*/*.fits %{buildroot}%{_datadir}/%{name}/data
23dea7f
23dea7f
%check
23dea7f
make test ARCH_FLAGS="%{optflags}"
23dea7f
23dea7f
3d047f1
%post libs -p /sbin/ldconfig
3d047f1
%postun libs -p /sbin/ldconfig
23dea7f
23dea7f
23dea7f
%files
23dea7f
%doc CREDITS README.md
23dea7f
%license LICENSE
23dea7f
%{_mandir}/man1/*
23dea7f
%{_bindir}/*
23dea7f
%exclude %{_bindir}/*.py
23dea7f
%dir %{_datadir}/astrometry
23dea7f
%dir %{_datadir}/astrometry/data
23dea7f
%{_datadir}/astrometry/examples
23dea7f
%config(noreplace) %{_sysconfdir}/astrometry.cfg
23dea7f
f629677
%files data
7e2ef85
%license astrometry-data-4208-4219/LICENSE
7e2ef85
%{_datadir}/astrometry/data/index-4208.fits
7e2ef85
%{_datadir}/astrometry/data/index-4209.fits
7e2ef85
%{_datadir}/astrometry/data/index-421*.fits
7e2ef85
7e2ef85
%files data-4204
7e2ef85
%license astrometry-data-4204/LICENSE
7e2ef85
%{_datadir}/astrometry/data/index-4204*.fits
7e2ef85
7e2ef85
%files data-4205
7e2ef85
%license astrometry-data-4205/LICENSE
7e2ef85
%{_datadir}/astrometry/data/index-4205*.fits
7e2ef85
7e2ef85
%files data-4206
7e2ef85
%license astrometry-data-4206/LICENSE
7e2ef85
%{_datadir}/astrometry/data/index-4206*.fits
7e2ef85
7e2ef85
%files data-4207
7e2ef85
%license astrometry-data-4207/LICENSE
7e2ef85
%{_datadir}/astrometry/data/index-4207*.fits
f629677
23dea7f
%files devel
23dea7f
%{_includedir}/*
23dea7f
%{_libdir}/*.so
23dea7f
3d047f1
%files libs
3d047f1
%license LICENSE
3d047f1
%{_libdir}/*.so.*
3d047f1
23dea7f
%files -n python2-%{name}
23dea7f
%{python2_sitearch}/*
23dea7f
%{_bindir}/*.py
23dea7f
23dea7f
%changelog
43b7a2a
* Sat May 26 2018 Christian Dersch <lupinix@mailbox.org> - 0.74-1
43b7a2a
- new version
43b7a2a
8e85c14
* Sat May 26 2018 Christian Dersch <lupinix@mailbox.org> - 0.73-5
8e85c14
- rebuilt for cfitsio 3.450
8e85c14
83b02ae
* Sat Feb 24 2018 Christian Dersch <lupinix@mailbox.org> - 0.73-4
83b02ae
- rebuilt for cfitsio 3.420 (so version bump)
83b02ae
364fc67
* Wed Feb 14 2018 Christian Dersch <lupinix@mailbox.org> - 0.73-3
364fc67
- rebuilt
364fc67
f8bea85
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.73-2
f8bea85
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
f8bea85
dfec9bc
* Fri Nov 17 2017 Christian Dersch <lupinix@mailbox.org> - 0.73-1
dfec9bc
- new version
dfec9bc
7e2ef85
* Tue Oct 17 2017 Christian Dersch <lupinix@mailbox.org> - 0.72-4
7e2ef85
- Added subpackages for 4204-4207 index files
7e2ef85
f629677
* Mon Oct 16 2017 Christian Dersch <lupinix@mailbox.org> - 0.72-3
f629677
- Added data subpackage containing the wide-field 2MASS indices
f629677
3d047f1
* Mon Sep 25 2017 Christian Dersch <lupinix@mailbox.org> - 0.72-2
3d047f1
- Move libs to subpackage to be multiarch compatible
3d047f1
8f9f443
* Tue Sep 12 2017 Christian Dersch <lupinix@mailbox.org> - 0.72-1
8f9f443
- Initial SCM import (#1470436)
8f9f443
23dea7f
* Wed Jul 12 2017 Christian Dersch <lupinix@mailbox.org> - 0.72-0.1
23dea7f
- initial spec (using the packaging effort from Mattia Verga, RHBZ  #1299139)
23dea7f