Blob Blame History Raw
%{?filter_setup:
%filter_provides_in %{python_sitearch}/.*\.so$
%filter_setup
}

Name:           libkdtree++
Version:        0.7.0
Release:        5%{?dist}
Summary:        C++ template container implementation of kd-tree sorting
URL:            http://libkdtree.alioth.debian.org/
License:        Artistic 2.0
Group:          System Environment/Libraries
BuildRequires:  autoconf automake python2-devel swig

Source0:        http://alioth.debian.org/frs/download.php/2702/libkdtree++-0.7.0.tar.bz2

# patch to make GCC 4.7 happy (fixed in upstream git, not yet in release):
Patch0:         libkdtree++-0.7.0-pedantic.patch
# patch to make pkgconfig file (.pc) (submitted to upstream mailing list
# on 29-Sep-2012):
Patch1:         libkdtree++-0.7.0-pkgconfig.patch
# patch to build examples/test with %{optflags}
Patch2:         libkdtree++-0.7.0-examples-optflags.patch

%description
%{summary}.


%package devel
Summary:        C++ template container implementation of kd-tree sorting
Group:          Development/Libraries
Provides:       libkdtree++-static = %{version}
BuildArch:      noarch

%description devel
%{summary}.


%package python
Summary:        Python language bindings for libkdtree++
Group:          Development/Languages

%description python
%{summary}.


%package examples
Summary:        Examples for libkdtree++
Group:          Development/Libraries
Requires:       libkdtree++-devel = %{version}
BuildArch:      noarch

%description examples
%{summary}.


%prep
%setup -q -n %{name}_%{version}
%patch0 -p1 -b .pkgconfig
%patch1 -p1 -b .pkgconfig
%patch2 -p1 -b .examples-optflags

# convert files from ISO-8859-1 to UTF-8 encoding
for f in README
do
  iconv -fiso88591 -tutf8 $f >$f.new
  touch -r $f $f.new
  mv $f.new $f
done


%build
autoreconf -f -i
%configure
make

cd python-bindings
make CPPFLAGS="%{optflags} -fPIC `pkg-config --cflags python`"
cd ..

%check
cd examples
make %{?_smpflags} CPPFLAGS="%{optflags}"
./test_kdtree
./test_hayne
cd ..

cd python-bindings
python py-kdtree_test.py
cd ..

%install
make install DESTDIR=%{buildroot}
install -d %{buildroot}%{python_sitearch}
install -pm 0755 python-bindings/_kdtree.so %{buildroot}%{python_sitearch}/
install -d %{buildroot}%{python_sitelib}
install -pm 0644 python-bindings/kdtree.py %{buildroot}%{python_sitelib}/

%files devel
%doc COPYING AUTHORS README NEWS TODO ChangeLog
%{_includedir}/kdtree++/
%{_datadir}/pkgconfig/*.pc

%files python
%doc COPYING AUTHORS README NEWS TODO ChangeLog
%{python_sitearch}/_kdtree.so
%{python_sitelib}/kdtree.py
%{python_sitelib}/kdtree.pyc
%{python_sitelib}/kdtree.pyo

%files examples
%doc examples/CMakeLists.txt
%doc examples/Makefile
%doc examples/test*.cpp

%changelog
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Sun Oct 14 2012 Eric Smith <eric@brouhaha.com> - 0.7.0-4
- Updated based on package review.

* Sat Sep 29 2012 Eric Smith <eric@brouhaha.com> - 0.7.0-3
- Updated based on package review.

* Fri Jun 22 2012 Eric Smith <eric@brouhaha.com> - 0.7.0-2
- Updated based on package review.

* Sat Dec 03 2011 Eric Smith <eric@brouhaha.com> - 0.7.0-1
- Initial version