Blob Blame History Raw
# If the emacs-el package has installed a pkgconfig file, use that to determine
# install locations and Emacs version at build time, otherwise set defaults.
%if %($(pkg-config emacs) ; echo $?)
%define emacs_version 22.1
%define emacs_lispdir %{_datadir}/emacs/site-lisp
%define emacs_startdir %{_datadir}/emacs/site-lisp/site-start.d
%else
%define emacs_version %(pkg-config emacs --modversion)
%define emacs_lispdir %(pkg-config emacs --variable sitepkglispdir)
%define emacs_startdir %(pkg-config emacs --variable sitestartdir)
%endif

# Note on building bbdb with support for VM: if support for VM in bbdb is
# required, then the source elisp for VM must be installed at build time. If
# support for BBDB is required in VM, then the BBDB source elisp must be present
# at build time. Hence there is a circular BuildRequires and bootstrapping is
# required. The way to do this is (i) build emacs-vm without BuildRequires:
# emacs-bbdb-el (ii) build emacs-bbdb with BuildRequires: emacs-vm-el (iii)
# rebuild emacs-vm with BuildRequires: emacs-bbdb-el. Or vice versa.
%define vmsupport 1

%define lispdir %{emacs_lispdir}/bbdb
%define texdir %{_datadir}/texmf/tex/generic/bbdb
	

Name:           emacs-bbdb
Version:        2.35
Release:        1%{?dist}
Epoch:		1
Summary:        A contact management utility for use with Emacs
Group:          Applications/Internet
License:        GPLv2+
URL:            http://bbdb.sourceforge.net/
Requires:       emacs(bin) >= %{emacs_version}

Source0:        bbdb-2.35.tar.gz

# This patch pulls in upstream changes to Makefile.in in the lisp directory (up
# to revision 1.17). No need to upstream therefore, and should be removed for bbdb-2.36
Patch0:		bbdb-2.35-fix_lisp_makefile.patch

BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  emacs emacs-el texinfo-tex

%if %{vmsupport}
BuildRequires:  emacs-vm-el
%endif

%description 
The Insidious Big Brother Database (BBDB) is a contact management
utility created by Jamie Zawinski for use with Emacs. It is tightly
integrated with several mail and news readers, allowing it to create
database entries directly from mail and news messages. As is usual
with applications for Emacs, this record creation can be configured in
many ways, ranging from a boolean create/don't create setting to
creation based on the result of a user-supplied function.

Database records can be used to store many types of information, from
name and address to URLs and X-Face images. This information can be
displayed when a message from an entity named in a database record is
received. In addition, messages from database members can be tagged in
the Gnus Summary Buffer, and Gnus scoring can be configured based on
the contents of database records. Supercite citations can even be
preset through the use of records in the BBDB.

%package -n %{name}-el
Summary:        Lisp source files for bbdb for Emacs
Group:          Applications/Internet
Requires:       %{name} = %{epoch}:%{version}-%{release}

%description -n %{name}-el
This package contains the Emacs lisp source files for %{name}. 

%prep 
%setup -q -n bbdb-%{version}

# Correct encoding of info file and ChangeLog
for i in texinfo/bbdb.texinfo ChangeLog ; do
    iconv --from=ISO-8859-1 --to=UTF-8 $i > $i.new
    mv $i.new $i
done

%patch0 -p 1 -b .fix_lisp_makefile

%build
# Note --enable-developer simply gives more verbose output during building,
# handy for debugging
%if %{vmsupport}
%configure --with-vm-dir=%{emacs_lispdir}/vm --enable-developer
%else
%configure --enable-developer
%endif

# Note: make %{?_smp_mflags} fails.
make all

%install
rm -rf $RPM_BUILD_ROOT

# There is no usable install make rule - install by hand.
install -d $RPM_BUILD_ROOT%{lispdir}
install -p -m 0644 lisp/*.{elc,el} $RPM_BUILD_ROOT%{lispdir}
install -d $RPM_BUILD_ROOT%{texdir}
install -p -m 0644 tex/*.tex $RPM_BUILD_ROOT%{texdir}
install -d $RPM_BUILD_ROOT%{_infodir}
install -p -m 0644 texinfo/bbdb.info $RPM_BUILD_ROOT%{_infodir}

# Create and install init file
install -d $RPM_BUILD_ROOT%{emacs_startdir}
cat > $RPM_BUILD_ROOT%{emacs_startdir}/bbdb-mode-init.el << EOF
(require 'bbdb-autoloads)
EOF

# Remove some unpackaged files
rm -f bits/make.bat
rm -f utils/Makefile*

# The perl scripts in the utils directory are packaged as docs, and so chmod -x
# them. Also correct the hash-bang.
find -name '*.pl' -exec chmod -x {} \;
find -name '*.pl' -exec sed -i -e 's|#![a-z/]*|/usr/bin/perl|g' {} \;

%clean
rm -rf $RPM_BUILD_ROOT

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

%preun
if [ $1 -eq 0 ]; then
  /sbin/install-info --delete %{_infodir}/bbdb.info %{_infodir}/dir 2>/dev/null || :
fi

%files
%defattr(-,root,root,-)
%doc bits misc utils ChangeLog 
%doc %{_infodir}/bbdb.info.gz
%{lispdir}/*.elc
%{texdir}/*.tex
%{emacs_startdir}/bbdb-mode-init.el
%dir %{lispdir}

%files el 
%defattr(-,root,root,-)
%{lispdir}/*.el

%changelog
* Sun Nov  9 2008 Jonathan G. Underwood <jonathan.underwood@gmail.com> - 1:2.35-1
- Revert to 2.35 release in order to address BZ 467909 and 467911
- Add bbdb-2.35-fix_lisp_makefile.patch in order to fix build problems
- Add epoch to avoid problems with package updating

* Thu Nov  6 2008 Jonathan G. Underwood <jonathan.underwood@gmail.com> - 2.36-0.1.20080928cvs
- Rename snapshot to reflect the fact that it is a 2.36 pre-release rather than
  a post 2.35 snapshot
- Fix day of previous spec file changelog entry
- Added a patch to revert upstream SVN revision 106 (which is suitable for
  emacs>=23) (BZ 467909)

* Sat Sep 29 2008 Jonathan G. Underwood <jonathan.underwood@gmail.com> - 2.35-9.20080928cvs
- Update to current CVS snapshot, fixing several bugs
- Ensure that bbdb-vm.elc is built and installed (BZ 462875)
- Add --enable-developer to configure for more verbose build info

* Fri Sep 28 2007 Jonathan G. Underwood <jonathan.underwood@gmail.com> - 2.35-8
- Correct encoding of ChangeLog and info files
- Correct hash bang in perl scripts which are installed as docs
- correct spelling mistake in description

* Sun Sep  9 2007 Jonathan G. Underwood <jonathan.underwood@gmail.com> - 2.35-7
- Add init file

* Sun Sep  9 2007 Jonathan G. Underwood <jonathan.underwood@gmail.com> - 2.35-6
- Add sensible defaults for the case that there is no Emacs
  pkg-config file at build time

* Thu Sep  6 2007 Jonathan G. Underwood <jonathan.underwood@gmail.com> - 2.35-5
- Add changes to comply with Emacs add-on packaging guidelines

* Tue May 29 2007 Jonathan G. Underwood <jonathan.underwood@gmail.com> - 2.35-4
- Add BuildRequires: emacs-vm-el
- Add macro to determine emacsversion at package build time
- Add Requires emacs-common >= emacsversion
- Add notes about bootstrapping with VM to top of spec file

* Mon May  7 2007 Jonathan G. Underwood <jonathan.underwood@gmail.com> - 2.35-3
- Convert info file to correct encoding (Tom Tromey)
- Use install rather than mkdir and cp to install files

* Sat Feb 10 2007 Jonathan G. Underwood <jonathan.underwood@gmail.com> - 2.35-2
- Added Requires: tetex, since bbd-print requires TeX to be installed

* Sat Feb  3 2007 Jonathan G. Underwood <jonathan.underwood@gmail.com> - 2.35-1
- Initial package