%define majorver 0

Name: libindi
Summary: Instrument Neutral Distributed Interface
Version: 0.8
Release: 2%{?_dist_release}

Group: System Environment/Libraries
License: LGPLv2+ and GPLv2+
# The code is LGPLv2+ except:
# some files for v4l2 conversion under libs/webcam are GPLv2+
# drivers/video/stvdriver (indi_stv driver) appears to contain GPL code
# upstream bug https://sourceforge.net/tracker2/?func=detail&aid=2572902&group_id=90275&atid=593019
URL: http://indi.sourceforge.net/

Source0: http://downloads.sourceforge.net/indi/%{name}_%{version}.tar.gz
Patch0: libindi-suffix.patch

Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: cmake
BuildRequires: cfitsio-devel >= 3.03
BuildRequires: libboost-devel
BuildRequires: libnova-devel >= 0.12.1
BuildRequires: libusb-devel
BuildRequires: zlib-devel

Conflicts: kdeedu3

%description
INDI is a distributed control protocol designed to operate
astronomical instrumentation. INDI is small, flexible, easy to parse,
and scalable. It supports common DCS functions such as remote control,
data acquisition, monitoring, and a lot more.


%package devel
Summary: Libraries, includes, etc. used to develop an application with %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Provides: libindi-static = %{version}-%{release}

%description devel
These are the header files needed to develop a %{name} application

%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
#patch1 -p1

%build
mkdir -p %{_target_platform}
pushd %{_target_platform}
CFLAGS="${CFLAGS:-%optflags}" \
CXXFLAGS="${CXXFLAGS:-%optflags}" \
FFLAGS="${FFLAGS:-%optflags}" \
%cmake \
    -DCMAKE_BUILD_TYPE=release \
    -DDATA_INSTALL_DIR:PATH=%{_datadir} \
    ..
popd

make VERBOSE=1 %{?_smp_mflags} -C %{_target_platform}

%install
rm -fr %{buildroot}
make install DESTDIR=%{buildroot} -C %{_target_platform}

%clean
rm -fr %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING.LIB LICENSE README README.drivers 
%{_bindir}/*
%{_libdir}/*.so.*
%{_datadir}/indi

%files devel
%defattr(-,root,root,-)
%doc README COPYING.LIB LICENSE
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/*.a
%{_libdir}/pkgconfig/*.pc

%changelog
* Wed Feb 25 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 0.8.0-2
- rebuilt with cfitsio 3.370 and libnova 0.15.0

* Sun Aug 28 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 0.8.0-1
- new upstream release
- updated Patch0
- built with libnova-0.14

* Thu Sep 23 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 0.6.3-1
- rebuilt with rpm-4.8.1 for pkg-config

* Tue Aug 17 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 0.6.2-1
- new upstream release
- updated Patch0

* Wed Jul  7 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 0.6-12
- added Conflicts: kdeedu3

* Sat Apr 17 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 0.6-11
- rebuilt with new toolchain and libnova-0.13

* Sat Sep 05 2009 NAKAMURA Kenta <kenta@vinelinux.org> - 0.6-10
- use %%cmake macro

* Sun Aug 30 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 0.6-9
- Inisital build for Vine Linux

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Wed Feb 18 2009 Sergio Pascual <sergiopr at fedoraproject.org> -  0.6-6
- Provides libindi-static

* Tue Feb 17 2009 Sergio Pascual <sergiopr at fedoraproject.org> -  0.6-5
- Need to provide the static library libindidriver.a to build indi-apogee

* Sat Feb 14 2009 Sergio Pascual <sergiopr at fedoraproject.org> -  0.6-4
- Fixed patch to find cfitsio

* Sat Feb 14 2009 Sergio Pascual <sergiopr at fedoraproject.org> -  0.6-3
- Patch to detect cfitsio in all architectures

* Fri Feb 06 2009 Sergio Pascual <sergiopr at fedoraproject.org> -  0.6-2
- Commands (rm, make) instead of macros
- Upstream bug about licenses (GPLv2 missing)
- Upstream bug about libindi calling exit

* Mon Jan 28 2009 Sergio Pascual <sergiopr at fedoraproject.org> -  0.6-1
- First version
