File photospline.spec of Package photospline

#
# spec file for package photospline
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# 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 so_ver 2
Name:           photospline
Version:        2.4.1
Release:        0
Summary:        Library to compute B-splines representations of multidimensional histograms
License:        BSD-2-Clause
URL:            https://github.com/icecube/photospline
Source:         %{url}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# PATCH-FIX-OPENSUSE photospline-dont-include-package.patch badshah400@gmail.com -- Do not include packaging macros and avoid checking /etc/os-release
Patch0:         photospline-dont-include-package.patch
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  pkgconfig
BuildRequires:  python3-devel
BuildRequires:  python3-numpy-devel
BuildRequires:  pkgconfig(SuiteSparse_config)
BuildRequires:  pkgconfig(cfitsio)
BuildRequires:  pkgconfig(lapack)
# No support for 32-bit systems
ExcludeArch:    %{ix86} ppc %{arm32}

%description
Photospline is a library that uses the penalized spline technique to
efficiently compute, store, and evaluate B-spline representations of large
multidimensional histograms typically used for Monte Carlo simulations in
high-energy physics.

%package -n libphotospline%{so_ver}
Summary:        Shared library for the main photospline library

%description -n libphotospline%{so_ver}
This package provides the shared library for the main photospline library.

%package -n libcphotospline%{so_ver}
Summary:        Shared library for the photospline C library

%description -n libcphotospline%{so_ver}
This package provides the shared library for the photospline C library.

%package -n libspglam%{so_ver}
Summary:        Shared library for the spglam library, used by photospline

%description -n libspglam%{so_ver}
This package provides the shared library for the spglam library used by photospline.

%package -n photospline-devel
Summary:        Headers and sources for developing with photospline library
Requires:       libcphotospline%{so_ver} = %{version}
Requires:       libphotospline%{so_ver} = %{version}
Requires:       libspglam%{so_ver} = %{version}
Requires:       pkgconfig(SuiteSparse_config)
Requires:       pkgconfig(cfitsio)
Requires:       pkgconfig(lapack)

%description -n photospline-devel
This package provides the headers and sources for developing with the
photospline library.

%package -n python3-photospline
Summary:        Python3 bindings for photospline
Requires:       python3-numpy

%description -n python3-photospline
This package provides a Python3 module for developing with photospline in that
programming language.

%prep
%autosetup -p1

%build
%cmake \
  -DCMAKE_EXE_LINKER_FLAGS="%{?build_ldflags}" \
  -DCMAKE_MODULE_LINKER_FLAGS="%{?build_ldflags}" \
  -DCMAKE_SHARED_LINKER_FLAGS="%{?build_ldflags}" \
  %{nil}

%cmake_build

%install
%cmake_install

%ldconfig_scriptlets -n libphotospline%{so_ver}
%ldconfig_scriptlets -n libcphotospline%{so_ver}
%ldconfig_scriptlets -n libspglam%{so_ver}

%files -n libphotospline%{so_ver}
%license COPYING.txt
%{_libdir}/libphotospline.so.%{so_ver}*

%files -n libcphotospline%{so_ver}
%license COPYING.txt
%{_libdir}/libcphotospline.so.%{so_ver}*

%files -n libspglam%{so_ver}
%license COPYING.txt
%{_libdir}/libspglam.so.%{so_ver}*

%files -n photospline-devel
%{_bindir}/photospline-*
%{_libdir}/lib*.so
%{_includedir}/photospline/
%{_datadir}/photospline/

%files -n python3-photospline
%{python3_sitearch}/photospline-stubs/
%{python3_sitearch}/photospline.so

%changelog
openSUSE Build Service is sponsored by