netcdf/netcdf.spec
2021-05-17 15:49:38 +08:00

298 lines
7.6 KiB
RPMSpec

Name: netcdf
Version: 4.7.3
Release: 1
Summary: Libraries for the Unidata network Common Data Form
License: NetCDF
URL: https://github.com/Unidata/netcdf-c
Source0: https://github.com/Unidata/netcdf-c/archive/v%{version}/%{name}-%{version}.tar.gz
BuildRequires: make
BuildRequires: environment-modules
BuildRequires: libtool
BuildRequires: chrpath
BuildRequires: doxygen
BuildRequires: hdf-static
BuildRequires: hdf5-devel
BuildRequires: gawk
BuildRequires: libcurl-devel
BuildRequires: m4
BuildRequires: zlib-devel
%ifarch %{valgrind_arches}
BuildRequires: valgrind
%endif
BuildRequires: openssh-clients
Requires: hdf5%{?_isa} = %{_hdf5_version}
%global with_mpich 1
%global with_openmpi 1
%if %{with_mpich}
%global mpi_list mpich
%endif
%if %{with_openmpi}
%global mpi_list %{?mpi_list} openmpi
%endif
%description
NetCDF (network Common Data Form) is an interface for array-oriented
data access and a freely-distributed collection of software libraries
for C, Fortran, C++, and perl that provides an implementation of the
interface. The NetCDF library also defines a machine-independent
format for representing scientific data. Together, the interface,
library, and format support the creation, access, and sharing of
scientific data. The NetCDF software was developed at the Unidata
Program Center in Boulder, Colorado.
%package devel
Summary: Development files for netcdf
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: pkgconfig%{?_isa}
Requires: hdf5-devel%{?_isa}
Requires: libcurl-devel%{?_isa}
%description devel
This package contains the netCDF C header files, shared devel libs, and
man pages.
%package static
Summary: Static libs for netcdf
Requires: %{name}%{?_isa} = %{version}-%{release}
%description static
This package contains the netCDF C static libs.
%if %{with_mpich}
%package mpich
Summary: NetCDF mpich libraries
Requires: hdf5-mpich%{?_isa} = %{_hdf5_version}
BuildRequires: mpich-devel
BuildRequires: hdf5-mpich-devel >= 1.8.4
Provides: %{name}-mpich2 = %{version}-%{release}
Obsoletes: %{name}-mpich2 < 4.3.0-4
%description mpich
NetCDF parallel mpich libraries
%package mpich-devel
Summary: NetCDF mpich development files
Requires: %{name}-mpich%{?_isa} = %{version}-%{release}
Requires: pkgconfig%{?_isa}
Requires: hdf5-mpich-devel%{?_isa}
Requires: libcurl-devel%{?_isa}
Provides: %{name}-mpich2-devel = %{version}-%{release}
Obsoletes: %{name}-mpich2-devel < 4.3.0-4
%description mpich-devel
NetCDF parallel mpich development files
%package mpich-static
Summary: NetCDF mpich static libraries
Requires: %{name}-mpich-devel%{?_isa} = %{version}-%{release}
Provides: %{name}-mpich2-static = %{version}-%{release}
Obsoletes: %{name}-mpich2-static < 4.3.0-4
%description mpich-static
NetCDF parallel mpich static libraries
%endif
%if %{with_openmpi}
%package openmpi
Summary: NetCDF openmpi libraries
Requires: hdf5-openmpi%{?_isa} = %{_hdf5_version}
BuildRequires: openmpi-devel
BuildRequires: hdf5-openmpi-devel >= 1.8.4
%description openmpi
NetCDF parallel openmpi libraries
%package openmpi-devel
Summary: NetCDF openmpi development files
Requires: %{name}-openmpi%{_isa} = %{version}-%{release}
Requires: openmpi-devel%{?_isa}
Requires: pkgconfig%{?_isa}
Requires: hdf5-openmpi-devel%{?_isa}
Requires: libcurl-devel%{?_isa}
%description openmpi-devel
NetCDF parallel openmpi development files
%package openmpi-static
Summary: NetCDF openmpi static libraries
Requires: %{name}-openmpi-devel%{?_isa} = %{version}-%{release}
%description openmpi-static
NetCDF parallel openmpi static libraries
%endif
%prep
%autosetup -p1 -n %{name}-c-%{version}
%build
%global _configure ../configure
export LDFLAGS="%{__global_ldflags} -L%{_libdir}/hdf"
export CFLAGS="%{optflags} -fno-strict-aliasing"
%global configure_opts \\\
--enable-shared \\\
--enable-netcdf-4 \\\
--enable-dap \\\
--enable-extra-example-tests \\\
CPPFLAGS=-I%{_includedir}/hdf \\\
LIBS="-ltirpc" \\\
--enable-hdf4 \\\
--disable-dap-remote-tests \\\
%{nil}
# Serial build
mkdir build
pushd build
ln -s ../configure .
%configure %{configure_opts}
%make_build
popd
# MPI builds
%if %{with_mpich}
for mpi in %{mpi_list}
do
mkdir $mpi
pushd $mpi
module load mpi/$mpi-%{_arch}
ln -s ../configure .
# parallel tests hang on s390(x)
%configure %{configure_opts} \
CC=mpicc \
--libdir=%{_libdir}/$mpi/lib \
--bindir=%{_libdir}/$mpi/bin \
--sbindir=%{_libdir}/$mpi/sbin \
--includedir=%{_includedir}/$mpi-%{_arch} \
--datarootdir=%{_libdir}/$mpi/share \
--mandir=%{_libdir}/$mpi/share/man \
--enable-parallel-tests
%make_build
module purge
popd
done
%endif
%install
make -C build install DESTDIR=${RPM_BUILD_ROOT}
/bin/rm -f ${RPM_BUILD_ROOT}%{_libdir}/*.la
chrpath --delete ${RPM_BUILD_ROOT}/%{_bindir}/nc{copy,dump,gen,gen3}
/bin/rm -f ${RPM_BUILD_ROOT}%{_infodir}/dir
%if %{with_mpich}
for mpi in %{mpi_list}
do
module load mpi/$mpi-%{_arch}
make -C $mpi install DESTDIR=${RPM_BUILD_ROOT}
rm $RPM_BUILD_ROOT/%{_libdir}/$mpi/lib/*.la
chrpath --delete ${RPM_BUILD_ROOT}/%{_libdir}/$mpi/bin/nc{copy,dump,gen,gen3}
module purge
done
%endif
%check
make %{?_smp_mflags} -C build check
%ldconfig_scriptlets
%files
%license COPYRIGHT
%doc README.md RELEASE_NOTES.md
%{_bindir}/nccopy
%{_bindir}/ncdump
%{_bindir}/ncgen
%{_bindir}/ncgen3
%{_libdir}/*.so.15*
%{_mandir}/man1/*
%files devel
%doc examples
%{_bindir}/nc-config
%{_includedir}/netcdf.h
%{_includedir}/netcdf_aux.h
%{_includedir}/netcdf_dispatch.h
%{_includedir}/netcdf_filter.h
%{_includedir}/netcdf_meta.h
%{_includedir}/netcdf_mem.h
%{_libdir}/libnetcdf.settings
%{_libdir}/*.so
%{_libdir}/pkgconfig/netcdf.pc
%{_mandir}/man3/*
%files static
%{_libdir}/*.a
%if %{with_mpich}
%files mpich
%license COPYRIGHT
%doc README.md RELEASE_NOTES.md
%{_libdir}/mpich/bin/nccopy
%{_libdir}/mpich/bin/ncdump
%{_libdir}/mpich/bin/ncgen
%{_libdir}/mpich/bin/ncgen3
%{_libdir}/mpich/lib/*.so.15*
%doc %{_libdir}/mpich/share/man/man1/*.1*
%files mpich-devel
%{_libdir}/mpich/bin/nc-config
%{_includedir}/mpich-%{_arch}/netcdf.h
%{_includedir}/mpich-%{_arch}/netcdf_aux.h
%{_includedir}/mpich-%{_arch}/netcdf_dispatch.h
%{_includedir}/mpich-%{_arch}/netcdf_filter.h
%{_includedir}/mpich-%{_arch}/netcdf_meta.h
%{_includedir}/mpich-%{_arch}/netcdf_mem.h
%{_includedir}/mpich-%{_arch}/netcdf_par.h
%{_libdir}/mpich/lib/libnetcdf.settings
%{_libdir}/mpich/lib/*.so
%{_libdir}/mpich/lib/pkgconfig/%{name}.pc
%doc %{_libdir}/mpich/share/man/man3/*.3*
%files mpich-static
%{_libdir}/mpich/lib/*.a
%endif
%if %{with_openmpi}
%files openmpi
%license COPYRIGHT
%doc README.md RELEASE_NOTES.md
%{_libdir}/openmpi/bin/nccopy
%{_libdir}/openmpi/bin/ncdump
%{_libdir}/openmpi/bin/ncgen
%{_libdir}/openmpi/bin/ncgen3
%{_libdir}/openmpi/lib/*.so.15*
%doc %{_libdir}/openmpi/share/man/man1/*.1*
%files openmpi-devel
%{_libdir}/openmpi/bin/nc-config
%{_includedir}/openmpi-%{_arch}/netcdf.h
%{_includedir}/openmpi-%{_arch}/netcdf_aux.h
%{_includedir}/openmpi-%{_arch}/netcdf_dispatch.h
%{_includedir}/openmpi-%{_arch}/netcdf_filter.h
%{_includedir}/openmpi-%{_arch}/netcdf_meta.h
%{_includedir}/openmpi-%{_arch}/netcdf_mem.h
%{_includedir}/openmpi-%{_arch}/netcdf_par.h
%{_libdir}/openmpi/lib/libnetcdf.settings
%{_libdir}/openmpi/lib/*.so
%{_libdir}/openmpi/lib/pkgconfig/%{name}.pc
%doc %{_libdir}/openmpi/share/man/man3/*.3*
%files openmpi-static
%{_libdir}/openmpi/lib/*.a
%endif
%changelog
* Fri Tue 30 2021 caodongxia <caodongxia@huawei.com> - 4.7.3-1
- Upgrade to 4.7.3
* Mon Mar 9 2020 tangjing <tangjing30@huawei.com> - 4.4.1.1-11
- Package init