File atem.spec of Package atem

#
# spec file for package atem
#
# Copyright (c) 2013 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 build_release_tarball 1

Name:           atem
Version:        0.4.0.git4.0a898
Release:        0
Summary:        Command line tool to convert MetaStock to csv
License:        BSD-3-Clause
Group:          Productivity/Text/Convertors
URL:            https://github.com/rudimeier/atem/
Source:         %{name}-%{version}.tar.xz
%if %{build_release_tarball}
Source1:        %{name}-rpmlintrc
%endif
# required for git builds only
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  gengetopt
BuildRequires:  help2man
# required for dist builds
BuildRequires:  gcc-c++
BuildRequires:  xz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Atem converts metastock financial data to CSV text, fast and reliable.

%if %{build_release_tarball}
%package release-tarball
Summary:        Tarball to be released by upstream
Group:          Development/Libraries/Other
Requires:       do_not_install_this_but_unrpm

%description release-tarball
This packackge contains a clean "make dist" tarball to be released by
upstream maintainers. Do not install this package. Just unrpm it. In
doubt you'll never need it at all.
%endif

%prep
%setup -q

%build
autoreconf -vfi
export CXXFLAGS="${RPM_OPT_FLAGS/O2/O3}"
%configure --docdir=%{_docdir}/%{name}
make

%install
%{?make_install} %{!?make_install:make install DESTDIR=%{buildroot}}
# install dist tarball and create file list for release-tarball package
%if %{build_release_tarball}
make dist
dist_tarball="$(find -maxdepth 1 -name "%{name}-*.tar.xz")"
dist_tarball_dst="$(echo "%{distribution}" | sed 's,.* ,/release_obs_,g')"
mkdir -p "%{buildroot}${dist_tarball_dst}"
cp -a "${dist_tarball}" "%{buildroot}${dist_tarball_dst}"
echo "%dir ${dist_tarball_dst}" > /tmp/files_release_tarball
echo "${dist_tarball_dst}/${dist_tarball}" >> /tmp/files_release_tarball
%endif

%check
make check || \
( for i in test/*.log ;do echo "testlog: $i"; cat $i; done; exit 1 )
# redirect distcheck output to not confuse our rpmlint
if ! make distcheck &> make_distcheck.log ;then
    cat make_distcheck.log
    echo "make distcheck failed"
    exit 1
fi

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc %{_docdir}/%{name}
%doc %{_mandir}/man1/atem.1*
%{_bindir}/atem

%if %{build_release_tarball}
%files release-tarball -f /tmp/files_release_tarball
%defattr(-,root,root,-)
%endif

%changelog
openSUSE Build Service is sponsored by