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

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
Source1:        %{name}-rpmlintrc
BuildRequires:  autoconf
BuildRequires:  automake
%if 0%{?fedora_version}
BuildRequires:  antlr-C++
BuildRequires:  antlr-devel
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
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
%define omit_ncoxx 0

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 ( and, 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

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

%setup -q

automake --foreign
export CFLAGS="%{optflags} -Wno-cpp"
export CXXFLAGS="%{optflags}"
%configure \
    --prefix=%{_prefix} \
    --includedir=%{_includedir}/nco \
%if 0%{?omit_ncoxx}
    --disable_ncoxx \
    --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

make %{?_smp_mflags} check

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

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

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


%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