File nco.spec of Package nco

#
# spec file for package nco
#
# 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/
#


Name:           nco
Version:        4.6.8
Release:        0
Summary:        Suite of programs for manipulating NetCDF/HDF files
License:        GPL-3.0
Group:          Productivity/Scientific/Other
Url:            http://nco.sourceforge.net/
Source0:        https://github.com/nco/nco/archive/%{name}-%{version}.tar.gz
Source1:        %{name}-rpmlintrc
BuildRequires:  autoconf
BuildRequires:  automake
%if 0%{?fedora_version}
BuildRequires:  antlr-C++
%else
BuildRequires:  antlr-devel
%endif
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  gawk
BuildRequires:  gcc-c++
BuildRequires:  gsl-devel
BuildRequires:  hdf5-devel >= 1.8.8
BuildRequires:  libcurl-devel
BuildRequires:  netcdf
BuildRequires:  netcdf-devel >= 4.1.3
BuildRequires:  udunits2-devel
BuildRequires:  texinfo
%if 0%{?fedora_version}
BuildRequires:  texinfo-tex
%endif
BuildRequires:  texlive
BuildRequires:  zlib-devel

#---a missing "#include <strings.h>" in unpatched antlr 2.7.7 (CharScanner.hpp:565)
#---breaks build with gcc>4.8. currently all supported distributions are patched.
%if 0%{?gcc_version} >= 48
%define omit_ncoxx 0
%else 
%define omit_ncoxx 0
%endif

%description
The netCDF Operators, NCO, are a suite of command line programs known
as operators.  The operators facilitate manipulation and analysis of
self-describing data stored in the freely available netCDF and HDF
formats (http://www.unidata.ucar.edu/software/netcdf and
http://www.hdfgroup.org, respectively).  Each NCO operator (e.g.,
ncks) takes netCDF or HDF input file(s), performs an operation (e.g.,
averaging, hyperslabbing, or renaming), and outputs a processed netCDF
file.  Although most users of netCDF and HDF data are involved in
scientific research, these data formats, and thus NCO, are generic and
are equally useful in fields from agriculture to zoology.  The NCO
User's Guide illustrates NCO use with examples from the field of
climate modeling and analysis.  The NCO homepage is
http://nco.sourceforge.net/.

%package devel
Summary:        Development files for NCO
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description devel
This package contains the NCO header and development files.

%package doc
Summary:        Documentation for NCO
Group:          Documentation/HTML

%description doc
This package contains the documentation for NCO.

%prep
%setup -q

%build
autoconf
aclocal
automake --foreign
export CFLAGS="%{optflags} -Wno-cpp"
export CXXFLAGS="%{optflags}"
%configure \
    --prefix=%{_prefix} \
    --includedir=%{_includedir}/nco \
%if 0%{?omit_ncoxx}
    --disable_ncoxx \
%endif
    --disable-dependency-tracking USER=abuild HOST=OBS HOSTNAME=OBS

#---we want reproducible builds:
find . -type f -regex ".*[.]cc?" -exec perl -i -pe 's{__(DATE|TIME)__}{""}g' "{}" "+"

make %{?_smp_mflags}
pushd doc
    makeinfo --html --no-split nco.texi
    make nco.pdf
popd

%check
make %{?_smp_mflags} check

%install
mkdir -p %{buildroot}%{_includedir}/nco
%make_install
find %{buildroot} -type f -name "*.la" -delete -print
rm -f %{buildroot}%{_infodir}/dir

%post
/sbin/ldconfig
/sbin/install-info %{_infodir}/nco.info %{_infodir}/dir 2>/dev/null || :

%postun
/sbin/ldconfig
if [ "$1" = 0 ]; then
  /sbin/install-info --delete \
        %{_infodir}/nco.info %{_infodir}/dir 2>/dev/null || :
fi

%files
%{_bindir}/*
%{_mandir}/*/*
%{_infodir}/*
%{_libdir}/libnco*.so

%files doc
%doc doc/README doc/LICENSE doc/rtfm.txt doc/nco.html doc/nco.pdf doc/nco.css
%doc doc/index.shtml doc/TODO doc/ChangeLog doc/nco.png doc/nco_news.shtml
%doc doc/nsf.png doc/ANNOUNCE CITATION

%files devel
%{_includedir}/nco/
%{_libdir}/libnco*.a

%changelog