LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File netcdf.spec of Package netcdf (Project home:odassau)

#
# spec file for package netcdf
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


%if 0%{?sles_version}
%define _mvapich2 1
%endif
%if 0%{?suse_version}
%define _openmpi 1
%endif

%define _mpi %{?_openmpi:openmpi} %{?_mvapich2:mvapich2}

Name:           netcdf
%define libname libnetcdf
Summary:        Command-line programs for the NetCDF scientific data format
License:        NetCDF
Group:          Productivity/Scientific/Other
Version:        4.4.1.1
Release:        0
%define sonum   11
Url:            http://www.unidata.ucar.edu/software/netcdf/
Source:         ftp://ftp.unidata.ucar.edu/pub/%{name}/%{name}-%{version}.tar.gz
Source1:        nc-config.1.gz
Source99:       baselibs.conf
Patch0:         %{name}-no_date_time.patch
# PATCH-FIX-UPSTREAM netcdf-disable-szip-linking.patch badshah400@gmail.com -- Disable building with szip support for now, since test nc_test4/tst_interops5.c fails otherwise; this is likely to be fixed with version 4.5.0 of netcdf, but requires big enough changes that we don't backport it here.
Patch1:         netcdf-disable-szip-linking.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  gawk
BuildRequires:  gcc-c++
BuildRequires:  gcc-fortran
BuildRequires:  hdf-devel
BuildRequires:  hdf5-devel >= 1.8.8
BuildRequires:  libcurl-devel >= 7.18.0
BuildRequires:  libhdf
BuildRequires:  libhdf5
BuildRequires:  libhdf5_hl
BuildRequires:  libtool
BuildRequires:  m4
BuildRequires:  pkg-config
BuildRequires:  zlib-devel >= 1.2.5
%ifarch %ix86 x86_64 ppc ppc64 s390x armv7l
BuildRequires:  valgrind
%endif
%if 0%{?_openmpi}
BuildRequires:  hdf-openmpi-devel
BuildRequires:  hdf5-openmpi-devel
BuildRequires:  libhdf-openmpi
BuildRequires:  libhdf5-openmpi
BuildRequires:  libhdf5_hl-openmpi
#BuildRequires:  libpnetcdf-openmpi
BuildRequires:  openmpi-devel
#BuildRequires:  parallel-netcdf-openmpi-devel
%endif
%if 0%{?_mvapich2}
BuildRequires:  hdf-mvapich2-devel
BuildRequires:  hdf5-mvapich2-devel
BuildRequires:  libhdf-mvapich2
BuildRequires:  libhdf5-mvapich2
BuildRequires:  libhdf5_hl-mvapich2
BuildRequires:  libpnetcdf-mvapich2
BuildRequires:  mvapich2-devel
BuildRequires:  parallel-netcdf-mvapich2-devel
%endif
Requires:       %{libname}%{sonum} = %{version}

%description
NetCDF is a set of software libraries and self-describing, 
machine-independent data formats that support the creation, access,
and sharing of array-oriented scientific data.

This package contains utility functions for working with NetCDF files.

%package openmpi
Summary:        Command-line programs for the NetCDF scientific data format
Group:          Productivity/Scientific/Other
Requires:       %{libname}%{sonum}-openmpi = %{version}

%description openmpi
NetCDF is a set of software libraries and self-describing, 
machine-independent data formats that support the creation, access,
and sharing of array-oriented scientific data.

This package contains the openmpi version of utility functions for
working with NetCDF files.

%package mvapich2
Summary:        Command-line programs for the NetCDF scientific data format
Group:          Productivity/Scientific/Other
Requires:       %{libname}%{sonum}-mvapich2 = %{version}

%description mvapich2
NetCDF is a set of software libraries and self-describing, 
machine-independent data formats that support the creation, access,
and sharing of array-oriented scientific data.

This package contains the mvapich2 version of utility functions for
working with NetCDF files.

%package -n     %{libname}%{sonum}
Summary:        Shared libraries for the NetCDF scientific data format
Group:          System/Libraries
Provides:       %{libname}-4 = %{version}
Obsoletes:      %{libname}-4 < %{version}
# To avoid unresolvable errors due to multiple providers of the library
Provides:       %{libname} = %{version}
Obsoletes:      %{libname} < %{version}
Requires:       libhdf
Requires:       libhdf5
Requires:       libhdf5_hl

%description -n %{libname}%{sonum}
NetCDF is a set of software libraries and self-describing, 
machine-independent data formats that support the creation, access,
and sharing of array-oriented scientific data.

NetCDF (network Common Data Form) is an interface for array-oriented
data access and a 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.

NetCDF data is:
   - Self-Describing: A NetCDF file includes information about the
     data it contains.
   - Network-transparent:  A NetCDF file is represented in a form that
     can be accessed by computers with different ways of storing
     integers, characters, and floating-point numbers.
   - Direct-access:  A small subset of a large dataset may be accessed
     efficiently, without first reading through all the preceding
     data.
   - Appendable:  Data can be appended to a NetCDF dataset along one
     dimension without copying the dataset or redefining its
     structure. The structure of a NetCDF dataset can be changed,
     though this sometimes causes the dataset to be copied.
   - Sharable:  One writer and multiple readers may simultaneously
     access the same NetCDF file.

This package contains the NetCDF runtime libraries.

%package -n     %{libname}%{sonum}-openmpi
Summary:        Shared libraries for the NetCDF scientific data format
# To avoid unresolvable errors due to multiple providers of the library
Group:          Productivity/Scientific/Other
Provides:       %{libname}-openmpi = %{version}
Obsoletes:      %{libname}-openmpi < %{version}
Requires:       libhdf-openmpi
Requires:       libhdf5-openmpi
Requires:       libhdf5_hl-openmpi
#Requires:       libpnetcdf-openmpi

%description -n %{libname}%{sonum}-openmpi
NetCDF is a set of software libraries and self-describing, 
machine-independent data formats that support the creation, access,
and sharing of array-oriented scientific data.

This package contains the openmpi versuib if the NetCDF runtime
libraries.

%package -n     %{libname}%{sonum}-mvapich2
Summary:        Shared libraries for the NetCDF scientific data format
# To avoid unresolvable errors due to multiple providers of the library
Group:          Productivity/Scientific/Other
Provides:       %{libname}-mvapich2 = %{version}
Obsoletes:      %{libname}-mvapich2 < %{version}
Requires:       libhdf-mvapich2
Requires:       libhdf5-mvapich2
Requires:       libhdf5_hl-mvapich2
Requires:       libpnetcdf-mvapich2

%description -n %{libname}%{sonum}-mvapich2
NetCDF is a set of software libraries and self-describing, 
machine-independent data formats that support the creation, access,
and sharing of array-oriented scientific data.

This package contains the openmpi versuib if the NetCDF runtime
libraries.

%package devel-data
Summary:        Development data files for %{name}
Group:          Development/Libraries/C and C++

%description devel-data
NetCDF is a set of software libraries and self-describing, 
machine-independent data formats that support the creation, access,
and sharing of array-oriented scientific data.

This package contains generic files needed to create projects that use
any version of NetCDF.

%package devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{libname}%{sonum} = %{version}
Requires:       %{name}-devel-data = %{version}
Requires:       hdf-devel
Requires:       hdf5-devel >= 1.8.8
Requires:       libcurl-devel >= 7.18.0
Requires:       pkgconfig
Requires:       zlib-devel >= 1.2.5

%description devel
NetCDF is a set of software libraries and self-describing, 
machine-independent data formats that support the creation, access,
and sharing of array-oriented scientific data.

This package contains all files needed to create projects that use NetCDF.

%package openmpi-devel
Summary:        Development files for %{name}-openmpi
Group:          Development/Libraries/Parallel
Requires:       %{libname}%{sonum}-openmpi = %{version}
Requires:       %{name}-devel-data = %{version}
Requires:       hdf-openmpi-devel
Requires:       hdf5-openmpi-devel >= 1.8.8
Requires:       libcurl-devel >= 7.18.0
Requires:       openmpi-devel
#Requires:       parallel-netcdf-openmpi-devel
Requires:       pkgconfig
Requires:       zlib-devel >= 1.2.5

%description openmpi-devel
NetCDF is a set of software libraries and self-describing, 
machine-independent data formats that support the creation, access,
and sharing of array-oriented scientific data.

This package contains all files needed to create projects that use
the openmpi version of NetCDF.

%package mvapich2-devel
Summary:        Development files for %{name}-mvapich2
Group:          Development/Libraries/Parallel
Requires:       %{libname}%{sonum}-mvapich2 = %{version}
Requires:       %{name}-devel-data = %{version}
Requires:       hdf-mvapich2-devel
Requires:       hdf5-mvapich2-devel >= 1.8.8
Requires:       libcurl-devel >= 7.18.0
Requires:       mvapich2-devel
Requires:       parallel-netcdf-mvapich2-devel
Requires:       pkgconfig
Requires:       zlib-devel >= 1.2.5

%description mvapich2-devel
NetCDF is a set of software libraries and self-describing, 
machine-independent data formats that support the creation, access,
and sharing of array-oriented scientific data.

This package contains all files needed to create projects that use
the mvapich2 version of NetCDF.

%package devel-static
Summary:        Static development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name}-devel = %{version}
Requires:       hdf-devel
Requires:       hdf5-devel >= 1.8.8
Requires:       libcurl-devel >= 7.18.0
Requires:       zlib-devel >= 1.2.5

%description devel-static
NetCDF is a set of software libraries and self-describing, 
machine-independent data formats that support the creation, access,
and sharing of array-oriented scientific data.

This package contains the static libraries for NetCDF.

%package openmpi-devel-static
Summary:        Static development files for %{name}-openmpi
Group:          Development/Libraries/Parallel
Requires:       %{name}-openmpi-devel = %{version}

%description openmpi-devel-static
NetCDF is a set of software libraries and self-describing, 
machine-independent data formats that support the creation, access,
and sharing of array-oriented scientific data.

This package contains the openmpi versions of the static libraries 
for NetCDF.

%package mvapich2-devel-static
Summary:        Static development files for %{name}-mvapich2
Group:          Development/Libraries/Parallel
Requires:       %{name}-mvapich2-devel = %{version}

%description mvapich2-devel-static
NetCDF is a set of software libraries and self-describing, 
machine-independent data formats that support the creation, access,
and sharing of array-oriented scientific data.

This package contains the mvapich2 versions of the static libraries 
for NetCDF.

%prep
%setup -q
%patch0 -p0 -b .no_date_time
%patch1 -p1
m4 libsrc/ncx.m4 > libsrc/ncx.c

# Fix spurious-executable-perm RPMLINT warning
chmod a-x RELEASE_NOTES.md

%build
autoreconf -fv

echo "prepare parallel builds: %_mpi"
for build_dir in build %_mpi; do
    mkdir $build_dir
    ln -s ../configure $build_dir
done

pushd build
export CC=gcc CXX=g++ FC=gfortran
export CFLAGS="-fno-strict-aliasing" 
export CXXFLAGS="%{optflags}"
export FCFLAGS="%{optflags}"
%configure \
    --enable-shared \
    --enable-netcdf-4 \
    --enable-dap \
    --enable-ncgen4 \
    --enable-extra-example-tests \
    --disable-dap-remote-tests \
    --with-pic \
    --disable-doxygen \
    --enable-static \
    --enable-hdf4

make %{?_smp_mflags}
popd

for build_dir in %_mpi; do
pushd $build_dir
popd
done

%install
for build_dir in build; do
# for build_dir in %_mpi build; do
make install DESTDIR="%{buildroot}" -C "$build_dir"
done

mkdir -p %{buildroot}%{_mandir}/man1
install -m644 %{S:1} %{buildroot}%{_mandir}/man1
rm -f %{buildroot}%{_libdir}/*.la

# install netcdf_par.h which is skipped when mpicc in not detected
install -m644 include/netcdf_par.h %{buildroot}%{_includedir}/netcdf_par.h

# rpm macro for version checking
mkdir -p %{buildroot}%{_sysconfdir}/rpm
cat > %{buildroot}%{_sysconfdir}/rpm/macros.netcdf <<EOF
#
# RPM macros for hdf5 packaging
#
%_netcdf_sonum  %{sonum}
%_netcdf_version  %{version}
EOF

%check
for build_dir in build; do
# for build_dir in %_mpi build; do
    make -C $build_dir check
done

%post -n %{libname}%{sonum} -p /sbin/ldconfig
%postun -n %{libname}%{sonum} -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc COPYRIGHT README.md RELEASE_NOTES.md
%{_bindir}/*
%exclude %{_bindir}/nc-config
%{_mandir}/man1/*

%files -n %{libname}%{sonum}
%defattr(-,root,root,-)
%{_libdir}/libnetcdf.so.*

%files devel-data
%defattr(-,root,root,-)
%config %{_sysconfdir}/rpm/macros.netcdf

%files devel
%defattr(-,root,root,-)
%{_bindir}/nc-config
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/netcdf.pc
%{_mandir}/man3/*
%{_libdir}/libnetcdf.settings

%files devel-static
%defattr(-,root,root,-)
%{_libdir}/libnetcdf.a

%changelog