Name:           geos
Version:        3.9.0
Release:        1
Summary:        GEOS is a C++ port of the Java Topology Suite
License:        LGPLv2
URL:            http://trac.osgeo.org/geos/
Source0:        http://download.osgeo.org/%{name}/%{name}-%{version}.tar.bz2

BuildRequires:  gcc gcc-c++ doxygen libtool

%description
GEOS (Geometry Engine - Open Source) is a C++ port of the JTS Topology Suite (JTS).
It aims to contain the complete functionality of JTS in C++. This includes all the
OpenGIS Simple Features for SQL spatial predicate functions and spatial operators,
as well as specific JTS enhanced functions. GEOS provides spatial functionality to
many other projects and products.

%package devel
Summary:        Development files for GEOS
Requires:       %{name} = %{version}-%{release}

%description devel
GEOS (Geometry Engine - Open Source) is a C++ port of the JTS Topology Suite (JTS).
It aims to contain the complete functionality of JTS in C++. This includes all the
OpenGIS Simple Features for SQL spatial predicate functions and spatial operators,
as well as specific JTS enhanced functions. GEOS provides spatial functionality to
many other projects and products.

This package contains the development files to build applications that
use GEOS.

%prep
%autosetup -p1

%build
sed -i -e 's|\/lib\/python|$libdir\/python|g' configure
sed -i -e 's|.get_python_lib(0|.get_python_lib(1|g' configure
sed -i -e 's|find \$i -name libpython|find \$i\/lib*\/ -name libpython|g' configure
sed -i -e 's|= isnan(|= std::isnan(|g' configure

for makefile in `find . -type f -name 'Makefile.in'`; do
sed -i 's|@LIBTOOL@|%{_bindir}/libtool|g' $makefile
done

%configure --disable-static --disable-dependency-tracking --disable-python

%make_build

%install
%make_install

%check
make  check || exit 0

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%doc AUTHORS NEWS README.md
%license COPYING
%{_libdir}/libgeos-%{version}.so
%{_libdir}/libgeos_c.so.1*
%exclude %{_libdir}/*.a

%files devel
%{_bindir}/geos-config
%{_includedir}/*
%{_libdir}/libgeos.so
%{_libdir}/libgeos_c.so
%exclude %{_libdir}/*.la
%exclude %{_libdir}/*.a
%{_libdir}/pkgconfig/%{name}.pc

%changelog
* Sat Jan 22 2022 yaoxin <yaoxin30@huawei.com> - 3.9.0-1
- Upgrade geos to 3.9.0

* Wed Nov 11 2020 leiju<leiju4@huawei.com> - 3.6.1-13
- Remove python2 subpackage

* Mon Mar 09 2020 yangjian<yangjian79@huawei.com> - 3.6.1-12
- Fix patch problem

* Wed Mar 04 2020 yangjian<yangjian79@huawei.com> - 3.6.1-11
- Package init
