File emacs-vm.spec of Package emacs-vm

#
# spec file for package emacs-vm
#
# Copyright (c) 2015 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/
#


Name:           emacs-vm
BuildRequires:  emacs-nox
%if %suse_version  > 1140
BuildRequires:  makeinfo
%else
BuildRequires:  info
%endif
Url:            http://www.nongnu.org/viewmail/
Requires:       ed
Requires:       emacs
PreReq:         %install_info_prereq
Version:        8.2.0b
Release:        0
Summary:        VM - a mail reader for GNU Emacs
License:        GPL-2.0+
Group:          Productivity/Editors/Emacs
Source:         https://launchpad.net/vm/8.2.x/%{version}/+download/vm-%{version}.tgz
Source2:        emacs-vm-autoload.el
# PATCH-FIX-UPSTREAM U_rev-1313.patch bsc#939497 eich@suse.com -- Fix Launchpad lp#793541 and lp#907286
Patch1:         U_rev-1313.patch
Patch2:         U_Require-vm-reply.el-from-vm-compose-mail.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
VM (View Mail) is an Emacs subsystem that allows UNIX mail to be read
and disposed of within Emacs.  Commands exist to do the normal things
expected of a mail user agent, such as generating replies, saving
messages to folders, deleting messages and so on.  There are other more
advanced commands that do tasks like bursting and creating digests,
message forwarding, and organizing message presentation according to
various criteria.

%define _sitedir %{_prefix}/share/emacs/site-lisp
%define _vmdir  %{_sitedir}/vm
%define _infodir %{_prefix}/share/info
%define _vmetcdir %{_prefix}/share/emacs/${emacs_ver}/etc/vm
%define _vmdocdir %{_prefix}/share/doc/packages/%{name}

%prep
%setup -n vm-%{version}
%patch1
%patch2 -p1

%build
export LC_CTYPE=ISO-8859-1
export EMACS_UNIBYTE=1
EMACS="emacs --no-site"
emacs_ver=$(rpm -q --qf '%{VERSION}' emacs)
rm -rf lisp/*.elc
%configure FLAGS="-batch -q -no-site-file -no-init-file -l \$(srcdir)/vm-build.el" --with-etcdir=%{_vmetcdir} --with-docdir=%{_vmdocdir}
make DESTDIR=${RPM_BUILD_ROOT} MAKEINFO="makeinfo --force"

%install
mkdir -p ${RPM_BUILD_ROOT}
make DESTDIR=${RPM_BUILD_ROOT}  install
{
  echo ";; /usr/share/emacs/site-lisp/suse-start-%{name}.el"
  cat %{S:2}
  echo ";; /usr/share/emacs/site-lisp/suse-start-%{name}.el ends here"
} > ${RPM_BUILD_ROOT}%{_sitedir}/suse-start-%{name}.el

%post
%install_info --info-dir=%{_infodir} %{_infodir}/vm.info.gz

%postun
%install_info_delete --info-dir=%{_infodir} %{_infodir}/vm.info.gz

%files
%defattr(-, root, root)
%docdir %{_vmdocdir}
%{_vmdocdir}
%dir %{_sitedir}
%{_sitedir}/*.el
%dir %{_vmdir}
%{_vmdir}/*.el
%{_vmdir}/*.elc
%{_vmdir}/version.txt
/usr/bin/base64-encode
/usr/bin/base64-decode
/usr/bin/qp-decode
/usr/bin/qp-encode
%doc %{_infodir}/*.gz
%{_prefix}/share/emacs/*/etc/vm/pixmaps
%dir %{_prefix}/share/emacs/*/etc/vm
%exclude %{_prefix}/share/emacs/*/etc/vm/README 
%exclude %{_prefix}/share/emacs/*/etc/vm/CHANGES 
%exclude %{_prefix}/share/emacs/*/etc/vm/COPYING 
%exclude %{_prefix}/share/emacs/*/etc/vm/NEWS 
%exclude %{_prefix}/share/emacs/*/etc/vm/TODO

%changelog