Blob Blame History Raw
Name:           phd2
Version:        2.6.4
Release:        3%{?dist}
Summary:        Telescope guiding software
# Main program files are BSD licensed
# Some components have different licenses:
# QHY camera headers are GPLv2+
# SX camera headers are ICU
# INDI GUI is LGPLv2+
License:        BSD and (GPLv2+ and MIT and LGPLv2+)
URL:            http://openphdguiding.org/
# Download upstream tarball from
# https://github.com/OpenPHDGuiding/%%{name}/archive/v%%{version}.tar.gz
# and then run ./generate-tarball.sh %%{version}
Source0:        %{name}-%{version}-purged.tar.xz
# Script to purge binaries and unneeded files from downloaded sources
Source1:        generate-tarball.sh

# Correct appdata files location
# https://github.com/OpenPHDGuiding/phd2/pull/658
Patch1:         phd2_appdata_location_change.patch

# Use C++14 flag
Patch99:        phd2_cflags.patch

# We need to disable camera firmwares we removed from sources
# This is Fedora specific and not reported upstream
Patch100:       phd2_disable_cams.patch

BuildRequires:  cmake
BuildRequires:  desktop-file-utils
BuildRequires:  dos2unix
BuildRequires:  extra-cmake-modules
BuildRequires:  gettext
BuildRequires:  gtest-devel
BuildRequires:  libappstream-glib
BuildRequires:  libindi-static
BuildRequires:  libnova-devel
BuildRequires:  wxGTK3-devel

BuildRequires:  pkgconfig(cfitsio)
BuildRequires:  pkgconfig(eigen3)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libindi)
BuildRequires:  pkgconfig(libusb-1.0)
BuildRequires:  pkgconfig(zlib)

Recommends:     libindi


%description
PHD2 is telescope guiding software that simplifies the process of tracking
a guide star, letting you concentrate on other aspects of deep-sky imaging
or spectroscopy.


%prep
%autosetup -p1

# Remove spurious executable bit set on icons and docs
find icons -type f -print0 |xargs -0 chmod -x
chmod -x PHD_2.0_Architecture.docx

# Fix line ending
dos2unix README-PHD2.txt

%build
mkdir -p %{_target_platform}
pushd %{_target_platform}
%{cmake} -DUSE_SYSTEM_CFITSIO=ON \
            -DUSE_SYSTEM_LIBUSB=ON \
            -DUSE_SYSTEM_EIGEN3=ON \
            -DUSE_SYSTEM_GTEST=ON ..

%make_build


%install
pushd %{_target_platform}
%make_install
popd

%find_lang %{name}

%check
# Tests are failing on x86 with GCC7
# https://github.com/OpenPHDGuiding/phd2/issues/608
%ifnarch %{ix86}
make test -C %{_target_platform}
%endif

desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/%{name}.appdata.xml

%post
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :


%files -f %{name}.lang
%doc README.txt README-PHD2.txt PHD_2.0_Architecture.docx
%license LICENSE.txt
%{_bindir}/*
%{_datadir}/metainfo/%{name}.appdata.xml
%{_datadir}/applications/%{name}.desktop
%{_datadir}/phd2/
%{_datadir}/pixmaps/*


%changelog
* Sun Nov 05 2017 Mattia Verga <mattia.verga@email.it> - 2.6.4-3
- Fix spurious exec bits and line endings
- Use more macros
- Purge another unneeded directory from sources
- Use C++14 flag

* Sat Nov 04 2017 Mattia Verga <mattia.verga@email.it> - 2.6.4-2
- Breakdown components licenses
- Add some useful docs
- Add weak dependency to libindi

* Thu Nov 02 2017 Mattia Verga <mattia.verga@email.it> - 2.6.4-1
- Initial packaging