File netcdf.spec of Package netcdf

#
# spec file for package netcdf
#
# Copyright (c) 2012 SUSE LINUX Products 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/
#


%define ncdf_so_major 7

Name:           netcdf
Summary:        Libraries for the Unidata network Common Data Form
License:        SUSE-NetCDF
Group:          System/Libraries
Version:        4.2.1
Release:        0
Url:            http://www.unidata.ucar.edu/software/netcdf/
Source:         %{name}-%{version}.tar.bz2
Source1:        nc-config.1.gz
Patch0:         %{name}-correct_casting.patch
Patch1:         %{name}-codecleanup.patch
Patch2:         %{name}-no_date_time.patch
#Strip FFLAGS from nc-config
#Use pkgconfig in nc-config to avoid multi-lib issues
Patch3:         netcdf-pkgconfig.patch
#Strip FFLAGS from nc-config
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  gawk
BuildRequires:  gcc-c++
BuildRequires:  gcc-fortran
BuildRequires:  hdf5-devel >= 1.8.4
BuildRequires:  libcurl-devel
BuildRequires:  pkg-config
BuildRequires:  zlib-devel
%ifarch %ix86 x86_64 ppc ppc64 s390x armv7l
BuildRequires:  valgrind
%endif
Requires:       hdf5

%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.

NetCDF data is:

   o Self-Describing: A NetCDF file includes information about the
     data it contains.

   o 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.

   o Direct-access:  A small subset of a large dataset may be accessed
     efficiently, without first reading through all the preceding
     data.

   o 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.

   o Sharable:  One writer and multiple readers may simultaneously
     access the same NetCDF file.

%package devel
Summary:        Development files for netcdf
Group:          Development/Libraries/C and C++
Requires:       hdf5-devel
Requires:       libcurl-devel
Requires:       libnetcdf%{ncdf_so_major} = %{version}
Requires:       pkgconfig

%description devel
This package contains the netCDF header files, shared devel libs, and
man pages.

%package -n     libnetcdf%{ncdf_so_major}
Summary:        Library for Array Oriented Data Access
Group:          System/Libraries
Provides:       libnetcdf-4 = %{version}
Obsoletes:      libnetcdf-4 < %{version}

%description -n libnetcdf%{ncdf_so_major}
This library provides array-oriented data access for the languages C
and C++.

%package doc
Summary:        Documentation for netcdf
Group:          Documentation/Other

%description doc
Documentation files of for netcdf

%package devel-static
Summary:        Static libs for netcdf
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}-%{release}

%description devel-static
This package contains the netCDF static libs.

%prep
%setup -q
%patch0 -p1 -b .correct_casting
%patch1 -p1 -b .codecleanup
%patch2 -p1 -b .no_date_time
%patch3 -p1 -b .pkgconfig

%build
export CC=gcc CXX=g++ FC=gfortran \
    CFLAGS="%{optflags}" CXXFLAGS="%{optflags}" 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
# %%ifnarch s390 s390x
#            --enable-valgrind-tests \
# %%endif

make %{?_smp_mflags}

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

%check
make check

%post -n libnetcdf%{ncdf_so_major} -p /sbin/ldconfig

%postun -n libnetcdf%{ncdf_so_major} -p /sbin/ldconfig

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

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

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

%files doc
%defattr(-,root,root,-)
%{_mandir}/man1/*

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

%changelog
openSUSE Build Service is sponsored by