File nceplibs-ip.spec of Package nceplibs-ip
#
# spec file for package nceplibs-ip
#
# Copyright (c) 2025 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/
#
#---32bit archs build but have several testsuite failures, disable them, as we don't need them:
ExcludeArch: %{ix86} %{arm}
%define name2 NCEPLIBS-ip
%define sover 0
%define libname libip%{sover}
Name: nceplibs-ip
Version: 5.4.0
Release: 0
Summary: NCEP C decoder/encoder routines for GRIB edition 2
License: LGPL-3.0-only
URL: https://github.com/NOAA-EMC/NCEPLIBS-ip
Source: https://github.com/NOAA-EMC/NCEPLIBS-ip/archive/refs/tags/%{version}.tar.gz#/%{name2}-%{version}.tar.gz
Source1: https://ftp.emc.ncep.noaa.gov/static_files/public/NCEPLIBS-ip/ip-test-data-20241230.tgz
BuildRequires: blas-devel
BuildRequires: cmake
BuildRequires: gcc-fortran
BuildRequires: lapack-devel
%if 0%{?suse_version}
BuildRequires: fdupes
%endif
%description
The NCEP general interpolation library contains Fortran 90 subprograms to be
used for interpolating between nearly all grids used at NCEP. The library is
particularly efficient when interpolating many fields at one time. It also
contains routines for spectral transforms and other processing, including
those previously contained in the NCEPLIBS-sp library.
This is part of the NCEPLIBS project.
%package -n %{libname}
Summary: NCEP C decoder/encoder routines for GRIB edition 2
Group: Productivity/Scientific/Other
%description -n %{libname}
The NCEP general interpolation library contains Fortran 90 subprograms to be
used for interpolating between nearly all grids used at NCEP. The library is
particularly efficient when interpolating many fields at one time. It also
contains routines for spectral transforms and other processing, including
those previously contained in the NCEPLIBS-sp library.
This is part of the NCEPLIBS project.
%package devel
Summary: Headers and development libraries for %{name}
Group: Development/Libraries/C and C++
Requires: %{libname} = %{version}
%description devel
This package contains the files needed for compiling programs using
the %{name} library.
%prep
%autosetup -p1 -n "%{name2}-%{version}"
#---fix version information:
echo "%{version}" > VERSION
%build
%cmake \
-DCMAKE_Fortran_FLAGS="%{optflags} -Wno-unused-dummy-argument%{?_fmoddir: -I%{_fmoddir}}" \
-DOPENMP=ON \
-DBUILD_DEPRECATED=ON \
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
-DBUILD_STATIC_LIBS=OFF \
%endif
%{nil}
%cmake_build
%install
%cmake_install
#---move include directories to some sane locations:
mkdir -p %{buildroot}%{_includedir}
mv %{buildroot}%{_prefix}/include_4 %{buildroot}%{_includedir}/libip_4
mv %{buildroot}%{_prefix}/include_d %{buildroot}%{_includedir}/libip_d
sed -i '{
/INTERFACE_INCLUDE_DIRECTORIES/ s|/include_4|/include/libip_4|
/INTERFACE_INCLUDE_DIRECTORIES/ s|/include_d|/include/libip_d|
}' %{buildroot}%{_libdir}/cmake/ip/ip-targets.cmake
%if 0%{?suse_version}
%fdupes %{buildroot}%{_includedir}
%endif
%check
#---need to unpack data for tests in build directory, so can't be done in %%prep:
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
%define __builddir %{__cmake_builddir}
%endif
tar -C %{__builddir}/tests -xf %{SOURCE1}
%ctest
%ldconfig_scriptlets -n %{libname}
%files -n %{libname}
%license LICENSE.md
%doc README.md docs/user_guide.md
%{_libdir}/libip_4.so.*
%{_libdir}/libip_d.so.*
%files devel
%license LICENSE.md
%{_libdir}/libip_4.so
%{_libdir}/libip_d.so
%{_libdir}/cmake/ip/
%{_includedir}/libip_4/
%{_includedir}/libip_d/
%changelog