Name:           qhull
Version:        2020.2
Release:        1
Summary:        General dimension convex hull programs
License:        Qhull
URL:            http://www.qhull.org
Source0:        http://www.qhull.org/download/qhull-2020-src-8.0.2.tgz

Patch0: qhull-lib64.patch
Patch1: qhull-install.patch
Patch2: qhull-staticr-pic.patch

BuildRequires:  gcc gcc-c++ cmake chrpath
Provides:       libqhull = %{version}-%{release} libqhull_r = %{version}-%{release} libqhull_p = %{version}-%{release}
Obsoletes:      libqhull < %{version}-%{release} libqhull_r < %{version}-%{release} libqhull_p < %{version}-%{release}

%description
Qhull is a general dimension convex hull program that reads a set
of points from stdin, and outputs the smallest convex set that contains
the points to stdout.  It also generates Delaunay triangulations, Voronoi
diagrams, furthest-site Voronoi diagrams, and halfspace intersections
about a point.

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

%description devel
Qhull is a general dimension convex hull program that reads a set
of points from stdin, and outputs the smallest convex set that contains
the points to stdout.  It also generates Delaunay triangulations, Voronoi
diagrams, furthest-site Voronoi diagrams, and halfspace intersections
about a point.

%package help
Summary:        Help package for qhull

%description help
This package provides man files and docs for qhull.

%prep
%autosetup -n %{name}-%{version} -p1

%build
%cmake -DLINK_APPS_SHARED=ON
make VERBOSE=1 %{?_smp_mflags}
make VERBOSE=1 %{?_smp_mflags} libqhull qhull_p
cd ..

%install
%make_install VERBOSE=1
chrpath --delete ${RPM_BUILD_ROOT}%{_libdir}/lib*.so.*

%files
%license COPYING.txt
%{_bindir}/*
%{_libdir}/libqhull.so.*
%{_libdir}/libqhull_r.so.*
%{_libdir}/libqhull_p.so.*

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files devel
%{_libdir}/*.so
%{_includedir}/*
%{_libdir}/libqhullcpp.a
%dir %{_libdir}/cmake/Qhull
%{_libdir}/cmake/Qhull/QhullConfig*.cmake
%{_libdir}/cmake/Qhull/QhullTargets*.cmake
%{_libdir}/pkgconfig/qhull_r.pc
%{_libdir}/pkgconfig/qhullcpp.pc
%{_libdir}/pkgconfig/qhullstatic*.pc
%{_libdir}/libqhullstatic*.a

%files help
%{_pkgdocdir}
%{_mandir}/man1/*

%changelog
* Tue Oct 24 2023 xu_ping <707078654@qq.com> - 2020.2-1
- Upgrade version to 2020.2

* Fri Mar 6 2020 lingsheng <lingsheng@huawei.com> - 2015.2-7
- Package init
