File libindi.spec of Package libindi

#
# spec file for package libindi
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define so_ver 0

Name:           libindi
Version:        0.9
Release:        0
Summary:        Instrument Neutral Distributed Interface
License:        GPL-2.0+ ; LGPL-2.1+
Group:          Productivity/Scientific/Astronomy
Url:            http://www.indilib.org/
Source0:        http://downloads.sourceforge.net/indi/%{name}_%{version}.tar.gz
# PATCH-FIX-UPSTREAM no-return-in-nonvoid-function.patch asterios.dramis@gmail.com -- Fix "no-return-in-nonvoid-function" post-build check errors
Patch0:         no-return-in-nonvoid-function.patch
# PATCH-FIX-UPSTREAM libindi-usleep.patch asterios.dramis@gmail.com -- Fix compilation with gcc-4.7 (taken from Fedora)
Patch1:         libindi-usleep.patch
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  libcfitsio-devel
BuildRequires:  libfli-devel
BuildRequires:  libnova-devel
BuildRequires:  libusb-devel
BuildRequires:  zlib-devel
Requires:       libindi%{so_ver} = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
INDI is an Instrument Neutral Distributed Interface control protocol
for astronomical devices, which provides a framework that decouples low
level hardware drivers from high level front end clients. Clients that
use the device drivers are completely unaware of the device
capabilities and communicate with the device drivers and build a
completely dynamic GUI based on the services provided by the device.

%package devel
Summary:        Development files for libindi
Group:          Development/Libraries/C and C++
Requires:       glibc-devel
Requires:       libindi%{so_ver} = %{version}

%description devel
This package contains development files for libindi.

%package -n libindi%{so_ver}
Summary:        Instrument Neutral Distributed Interface
Group:          System/Libraries

%description -n libindi%{so_ver}
INDI is an Instrument Neutral Distributed Interface control protocol
for astronomical devices, which provides a framework that decouples low
level hardware drivers from high level front end clients. Clients that
use the device drivers are completely unaware of the device
capabilities and communicate with the device drivers and build a
completely dynamic GUI based on the services provided by the device.

%prep
%setup -q
%patch0
%patch1 -p1

%build
mkdir build
cd build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
_libsuffix=$(echo %_lib | cut -b4-)
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIB_SUFFIX="$_libsuffix" ..
make %{?_smp_mflags} VERBOSE=1
cd ..

%install
cd build
%make_install
cd ..

%post -n libindi%{so_ver} -p /sbin/ldconfig

%postun -n libindi%{so_ver} -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING.* COPYRIGHT ChangeLog LICENSE NEWS README README.drivers TODO
%{_datadir}/indi/
%{_bindir}/indi*

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

%files -n libindi%{so_ver}
%defattr(-,root,root,-)
%{_libdir}/libindi.so.%{so_ver}*

%changelog