Personal tools
You are here: Home Linux Instant Messaging Compile ejabberd v14 RPM on CentOS 7

Compile ejabberd v14 RPM on CentOS 7

At the time of writing there was no ejabberd RPM for EL7/CentOS7. The strategy was to take the version from Fedora 22 (rawhide) and generate a binary RPM. The issues encourntered related to compiling and packaging the documentation:

  1. EL7 doesn't have a 'hevea' package (easily compiled)
  2. EL7 doesn't have a 'texlive-comment' package

 

RPMBuild Prerequisites

Install EPEL repository (for  erlang) and compilation dependencies:

# rpm -Uvh http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-2.noarch.rpm
# yum install rpm-build expat-devel openssl-devel pam-devel libyaml-devel erlang erlang-rebar git autoconf automake gcc gcc-c++

 

Build

Take the the standard Fedora package and apply the following two fixes/patches:

  1. add a patch file to Makefile to handle no install documentation when it isn't built
  2. patch the spec file to add the patch above and change the docs directory
$ wget http://mirror.as24220.net/pub/fedora/linux/development/rawhide/source/SRPMS/e/ejabberd-14.07-6.fc22.src.rpm
$ rpm -ivh ejabberd-14.07-6.fc22.src.rpm
$ ... apply fixes...
$ rpmbuild -ba ~/rpmbuild/SPECS/ejabberd.spec

Install

To install the binary RPM:

# yum install http://files.lucidsolutions.co.nz/linux/centos/ejabberd-el7/ejabberd-14.07-6.el7.centos.x86_64.rpm

Hevea

The hevea RPM from Fedora was built but the 'texlive-comment' dependency was still unresolved.

# yum install 'tex(latex)' ocaml 
$ wget http://mirror.as24220.net/pub/fedora/linux/development/rawhide/source/SRPMS/h/hevea-2.18-1.fc22.src.rpm
$ rpmbuild --rebuild hevea-2.18-1.fc22.src.rpm
# yum localinstall ~build/rpmbuild/RPMS/x86_64/hevea-2.18-1.el7.centos.x86_64.rpm

Links

Appendices

Makefile patch

$ cat  ../SOURCES/ejabberd-0012-no-install-docs.patch
--- ejabberd-14.07/Makefile.in  2014-12-06 13:37:03.052357334 +1300
+++ ejabberd-14.07-1/Makefile.in        2014-12-06 13:39:12.558357334 +1300
@@ -180,8 +180,12 @@
        #
        # Documentation
        $(INSTALL) -d $(DOCDIR)
-       $(INSTALL) -m 644 doc/dev.html $(DOCDIR)
-       $(INSTALL) -m 644 doc/guide.html $(DOCDIR)
+       [ -f doc/dev.html ] \
+               && $(INSTALL) -m 644 doc/dev.html $(DOCDIR) \
+               || echo "No doc/dev.html was built"
+       [ -f doc/guide.html ] \
+               && $(INSTALL) -m 644 doc/guide.html $(DOCDIR) \
+               || echo "No doc/guide.html was built"
        $(INSTALL) -m 644 doc/*.png $(DOCDIR)
        [ -f doc/guide.pdf ] \
                && $(INSTALL) -m 644 doc/guide.pdf $(DOCDIR) \

Spec patch

$ diff -u ejabberd.spec~f22 ejabberd.spec
--- ejabberd.spec~f22   2014-11-15 00:46:19.000000000 +1300
+++ ejabberd.spec       2014-12-06 14:50:18.115357334 +1300
@@ -65,6 +65,7 @@
 Patch10:ejabberd-0010-Enable-systemd-notification-if-available.patch

 Patch11: ejabberd-0011-aarch64.patch
+Patch12: ejabberd-0012-no-install-docs.patch

 BuildRequires:  expat-devel
 BuildRequires:  openssl-devel >= 0.9.8
@@ -140,6 +141,7 @@

 tar xvf %{S:14}
 %patch11 -p1
+%patch12 -p1


 %build
@@ -268,7 +270,7 @@


 %files
-%doc COPYING
+%doc /usr/share/doc/ejabberd/COPYING

 %attr(750,ejabberd,ejabberd) %dir %{_sysconfdir}/ejabberd
 %attr(640,ejabberd,ejabberd) %config(noreplace) %{_sysconfdir}/ejabberd/ejabberd.yml
@@ -314,15 +316,18 @@
 %attr(750,ejabberd,ejabberd) %dir /var/log/ejabberd

 %files doc
-%doc doc/*.html
-%doc doc/*.png
+%doc /usr/share/doc/ejabberd/*.html
+%doc /usr/share/doc/ejabberd/*.png
 %if 0%{?_with_hevea}
-%doc doc/*.pdf
+%doc /usr/share/doc/ejabberd/*.pdf
+%doc /usr/share/doc/ejabberd/*.txt
 %endif
-%doc doc/*.txt


 %changelog
+* Sat Dec 06 2014 Greg B <greg.brackley-rpmbuild-ejabberd@lucidsolutions.co.nz>
+- Fix build on EL7 without hevea & texlive-comment support
+
 * Fri Nov 14 2014 Dan HorĂ¡k <dan[at]danny.cz> - 14.07-6
 - increase stack size for hevea on ppc64* (#1164209)

 

Document Actions