File dateutils.spec of Package dateutils

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

%define have_octave 0
%if 0%{?suse_version} >= 1220 && 0%{?suse_version} != 1315
%define have_octave 1
%ifarch aarch64
%if 0%{?suse_version} <= 1310
%define have_octave 0
%ifnarch i586 x86_64
%if 0%{?suse_version} < 1310
%define have_octave 0
%if 0%{?fedora_version} >= 19
%define have_octave 1
Name:           dateutils
Version:        0.4.3
Release:        0
Summary:        Nifty command line date and time utilities
License:        BSD-3-Clause
Group:          Productivity/Text/Utilities
BuildRequires:  pkgconfig
BuildRequires:  xz
%if 0%{?suse_version}
BuildRequires:  timezone
%if %{have_octave}
BuildRequires:  octave-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires(pre):  info

Dateutils are a bunch of tools that revolve around fiddling with dates
and times in the command line with a strong focus on use cases that
arise when dealing with large amounts of financial data. Their target
market is shell scripts that need date calculations or calendar
conversions, and as such they are highly pipe-able and modeled after
their well-known cousins (e.g. dtest vs. test, or dgrep vs. grep).

%if %{have_octave}
%package octave
Summary:        Dateutils functions for matlab and octave
Group:          Development/Libraries/Other
Requires:       %{name} = %{version}
Requires:       octave

%description octave
Dateutils can be used from within matlab or ocatave.

%setup -q

%configure \
    --docdir=%{_docdir}/%{name} \
%if %{have_octave}
    --enable-contrib \
make %{?_smp_mflags} V=1

%{?make_install} %{!?make_install:make install DESTDIR=%{buildroot}}
rm -f %{buildroot}%{_infodir}/dir
rm -f %{buildroot}%{_libdir}/octave/site/oct/*/dateutils/

if ! make check; then
    cat test/test-suite.log
    exit 1

# How to make that info stuff portable?
%if 0%{?install_info:1} > 0
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info*

%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info*

%doc %{_docdir}/%{name}
%dir %{_datadir}/dateutils/

%if %{have_octave}
%files octave
%dir %{_libdir}/octave/site/oct/*/dateutils/