94cc28cb95c1aed8c92259c8bd6e4c90149f1c7e
[packages/jabberd.git] / jabberd.spec
1 #
2 # Conditional build
3 %bcond_without  db      # don't build db storage and authreg backends
4 %bcond_without  ldap    # don't build ldap authreg backend
5 %bcond_without  mysql   # don't build MySQL storage and authreg backends
6 %bcond_without  pgsql   # don't build PostgreSQL storage and authreg backends
7 %bcond_without  sqlite  # don't build SQLite v3 storage backend
8 # allows limiting the number of offline messages stored per user (mysql storage)
9 # and allows offline storage (queuing) of subscription requests and/or messages
10 # to be disabled
11 %bcond_with     bxmpp   # - patches c2s to allow connections from Flash clients which don't use proper XMPP
12
13 %define         skip_post_check_so      mod_.*.so.0.0.0 libstorage.so.0.0.0
14
15 %include        /usr/lib/rpm/macros.perl
16 Summary:        Jabber/XMPP server
17 Summary(pl.UTF-8):      Serwer Jabber/XMPP
18 Name:           jabberd
19 Version:        2.6.1
20 Release:        2
21 License:        GPL
22 Group:          Applications/Communications
23 Source0:        https://github.com/jabberd2/jabberd2/releases/download/%{name}-%{version}/%{name}-%{version}.tar.xz
24 # Source0-md5:  cfe1b7fb77ccc9905cc18aabded9a1de
25 Source1:        %{name}.init
26 Source2:        %{name}.sysconfig
27 Source3:        db-setup.sqlite
28 Patch0:         %{name}-perlscript.patch
29 Patch1:         %{name}-daemonize.patch
30 Patch2:         %{name}-default_config.patch
31 Patch4:         %{name}-delay_jobs.patch
32 Patch5:         %{name}-binary_path.patch
33 Patch6:         %{name}-reconnect.patch
34 #bcond bxmpp
35 Patch22:        http://www.marquard.net/jabber/patches/patch-flash-v2
36 URL:            http://jabberd2.org/
37 BuildRequires:  autoconf
38 BuildRequires:  automake
39 %{?with_db:BuildRequires:       db-devel >= 4.1.24}
40 BuildRequires:  expat-devel
41 BuildRequires:  gettext-tools
42 BuildRequires:  gsasl-devel >= 0.2.28
43 BuildRequires:  libidn-devel >= 0.3.0
44 BuildRequires:  libstdc++-devel
45 BuildRequires:  libtool
46 %{?with_mysql:BuildRequires:    mysql-devel}
47 %{?with_ldap:BuildRequires:     openldap-devel}
48 BuildRequires:  openssl-devel >= 0.9.6d
49 BuildRequires:  pam-devel
50 %{?with_pgsql:BuildRequires:    postgresql-devel}
51 BuildRequires:  rpm-perlprov >= 3.0.3-16
52 BuildRequires:  rpmbuild(macros) >= 1.268
53 %{?with_sqlite:BuildRequires:   sqlite3-devel}
54 BuildRequires:  udns-devel
55 Requires(post): sed >= 4.0
56 Requires(post): textutils
57 Requires(post,preun):   /sbin/chkconfig
58 Requires:       jabber-common
59 Requires:       rc-scripts
60 Obsoletes:      jabber
61 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
62
63 %description
64 Modern open source Jabber server, implementing latest XMPP protocol.
65
66 %description -l pl.UTF-8
67 Nowoczesny, wolnodostępny serwer Jabbera implementujący najnowszy
68 protokół XMPP.
69
70 %prep
71 %setup -q
72 %patch0 -p1
73 %patch1 -p1
74 %patch2 -p1
75 %patch4 -p1
76 %patch5 -p1
77 %patch6 -p1
78
79 %if %{with bxmpp}
80 %patch22 -p0
81 %endif
82
83 install %{SOURCE3} tools/
84
85 %build
86 #http://j2.openaether.org/bugzilla/show_bug.cgi?id=17
87 %{__libtoolize}
88 %{__aclocal}
89 %{__autoconf}
90 %{__autoheader}
91 %{__automake}
92 %configure \
93         --bindir="%{_libdir}/%{name}" \
94         --sysconfdir="%{_sysconfdir}/jabber" \
95         %{?with_db:--enable-db} \
96         %{?with_mysql:--enable-mysql} \
97         %{?with_pgsql:--enable-pgsql} \
98         --enable-fs \
99         --enable-anon \
100         --enable-pipe \
101         --enable-pam \
102         %{?with_ldap:--enable-ldap} \
103         %{?with_sqlite:--enable-sqlite} \
104         %{?debug:--enable-debug}
105
106 %{__make}
107
108 %install
109 rm -rf $RPM_BUILD_ROOT
110 install -d $RPM_BUILD_ROOT{%{_sbindir},/var/lib/%{name}/{db,stats},/etc/{sysconfig,rc.d/init.d}}
111
112 %{__make} install \
113         DESTDIR=$RPM_BUILD_ROOT
114
115 mv $RPM_BUILD_ROOT%{_libdir}/jabberd/jabberd $RPM_BUILD_ROOT%{_sbindir}
116 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/jabber{,/templates}/*.dist 
117
118 # drop Upstart configuration files
119 %{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/jabber/*.conf 
120 %{__rm} -f $RPM_BUILD_ROOT%{_prefix}/etc/init/*.conf
121
122 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
123 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
124
125 %clean
126 rm -rf $RPM_BUILD_ROOT
127
128 %post
129 if [ -f %{_sysconfdir}/jabber/secret ] ; then
130         SECRET=`cat %{_sysconfdir}/jabber/secret`
131         if [ -n "$SECRET" ] ; then
132                 echo "Updating component authentication secret in Jabberd config files..."
133                 %{__sed} -i -e "s/>secret</>$SECRET</" %{_sysconfdir}/jabber/*.xml
134         fi
135 fi
136
137 /sbin/chkconfig --add jabberd
138 %service jabberd restart "Jabber server"
139
140 %if %{with avatars}
141 echo "This j2 package has new functionality, please read AVATARS file."
142 %endif
143
144 %preun
145 if [ "$1" = "0" ]; then
146         %service jabberd stop
147         /sbin/chkconfig --del jabberd
148 fi
149
150 %files
151 %defattr(644,root,root,755)
152 %doc AUTHORS ChangeLog NEWS README TODO
153 %doc tools/{db-setup.mysql,db-setup.pgsql,%{?with_sqlite:db-setup.sqlite,}pipe-auth.pl}
154 %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/*.cfg
155 %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/*.xml
156 %dir %{_sysconfdir}/jabber/templates
157 %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/templates/*.xml
158 %attr(755,root,root) %{_sbindir}/*
159 %dir %{_libdir}/jabberd
160 %attr(755,root,root) %{_libdir}/%{name}/*
161 %dir %attr(770,root,jabber) /var/lib/%{name}
162 %dir %attr(770,root,jabber) /var/lib/%{name}/db
163 %dir %attr(770,root,jabber) /var/lib/%{name}/stats
164 %attr(754,root,root) /etc/rc.d/init.d/%{name}
165 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
166 %{_mandir}/man*/*