File p4est.spec of Package p4est

#
# spec file for package p4est
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%define libname libp4est

Name:           p4est
Version:        2.8.5
Release:        0
Summary:        A C library to manage a collection of multiple octrees
License:        GPL-2.0-or-later
Group:          Development/Libraries/C and C++
URL:            https://www.p4est.org/
Source0:        https://p4est.github.io/release/p4est-%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires:  cmake
BuildRequires:  gcc-fortran
BuildRequires:  libsc-devel
BuildRequires:  zlib-devel

%description
p4est is a C library to manage a collection (a forest) of multiple
connected adaptive quadtrees or octrees in parallel.

This package contains the sequential version of the %{name} utilities.

%package -n %libname
Summary:        A C library to manage a collection of multiple octrees
Group:          System/Libraries

%description -n %libname
p4est is a C library to manage a collection (a forest) of multiple
connected adaptive quadtrees or octrees in parallel.

This package contains the sequential version of the %{name} library.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %libname = %{version}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%prep
%setup -q
sed -i -e 's@DESTINATION lib@DESTINATION %{_lib}@' CMakeLists.txt cmake/*.cmake
# Fix install path of CMake configs
sed -i -e 's@DESTINATION cmake@DESTINATION %{_lib}/cmake/P4EST@' CMakeLists.txt cmake/install.cmake

%build
%cmake
%cmake_build

%install
%cmake_install

# Remove duplicate COPYING
rm -Rf %{buildroot}/%{_datadir}/docs
# Remove irrelevant FindSC.cmake / FindP4EST.cmake
rm %{buildroot}/%{_libdir}/cmake/P4EST/Find{SC,P4EST}.cmake
# Remove broken pkgconfig file
rm %{buildroot}%{_libdir}/pkgconfig/*.pc

%post -n %libname -p /sbin/ldconfig
%postun -n %libname -p /sbin/ldconfig

%files -n %libname
%license COPYING
%{_libdir}/lib*.so

%files devel
%{_includedir}/*
%{_libdir}/cmake/P4EST


%changelog
openSUSE Build Service is sponsored by