- updated to 2.7.0
[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.7.0
20 Release:        1
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:  39b4b5286a1ad91ff84c3588fa26efa8
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 #bcond bxmpp
34 Patch22:        http://www.marquard.net/jabber/patches/patch-flash-v2
35 URL:            http://jabberd2.org/
36 BuildRequires:  autoconf
37 BuildRequires:  automake
38 %{?with_db:BuildRequires:       db-devel >= 4.1.24}
39 BuildRequires:  expat-devel
40 BuildRequires:  gettext-tools
41 BuildRequires:  gsasl-devel >= 0.2.28
42 BuildRequires:  libidn-devel >= 0.3.0
43 BuildRequires:  libstdc++-devel
44 BuildRequires:  libtool
45 %{?with_mysql:BuildRequires:    mysql-devel}
46 %{?with_ldap:BuildRequires:     openldap-devel}
47 BuildRequires:  openssl-devel >= 0.9.6d
48 BuildRequires:  pam-devel
49 %{?with_pgsql:BuildRequires:    postgresql-devel}
50 BuildRequires:  rpm-perlprov >= 3.0.3-16
51 BuildRequires:  rpmbuild(macros) >= 1.268
52 %{?with_sqlite:BuildRequires:   sqlite3-devel}
53 BuildRequires:  udns-devel
54 Requires(post): sed >= 4.0
55 Requires(post): textutils
56 Requires(post,preun):   /sbin/chkconfig
57 Requires:       jabber-common
58 Requires:       rc-scripts
59 Obsoletes:      jabber
60 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
61
62 %description
63 Modern open source Jabber server, implementing latest XMPP protocol.
64
65 %description -l pl.UTF-8
66 Nowoczesny, wolnodostępny serwer Jabbera implementujący najnowszy
67 protokół XMPP.
68
69 %prep
70 %setup -q
71 %patch0 -p1
72 %patch1 -p1
73 %patch2 -p1
74 %patch4 -p1
75 %patch5 -p1
76
77 %if %{with bxmpp}
78 %patch22 -p0
79 %endif
80
81 install %{SOURCE3} tools/
82
83 %build
84 #http://j2.openaether.org/bugzilla/show_bug.cgi?id=17
85 %{__libtoolize}
86 %{__aclocal}
87 %{__autoconf}
88 %{__autoheader}
89 %{__automake}
90 %configure \
91         --bindir="%{_libdir}/%{name}" \
92         --sysconfdir="%{_sysconfdir}/jabber" \
93         %{?with_db:--enable-db} \
94         %{?with_mysql:--enable-mysql} \
95         %{?with_pgsql:--enable-pgsql} \
96         --enable-fs \
97         --enable-anon \
98         --enable-pipe \
99         --enable-pam \
100         %{?with_ldap:--enable-ldap} \
101         %{?with_sqlite:--enable-sqlite} \
102         %{?debug:--enable-debug}
103
104 %{__make}
105
106 %install
107 rm -rf $RPM_BUILD_ROOT
108 install -d $RPM_BUILD_ROOT{%{_sbindir},/var/lib/%{name}/{db,stats},/etc/{sysconfig,rc.d/init.d}}
109
110 %{__make} install \
111         DESTDIR=$RPM_BUILD_ROOT
112
113 mv $RPM_BUILD_ROOT%{_libdir}/jabberd/jabberd $RPM_BUILD_ROOT%{_sbindir}
114 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/jabber{,/templates}/*.dist 
115
116 # drop Upstart configuration files
117 %{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/jabber/*.conf 
118 %{__rm} -f $RPM_BUILD_ROOT%{_prefix}/etc/init/*.conf
119
120 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
121 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
122
123 %clean
124 rm -rf $RPM_BUILD_ROOT
125
126 %post
127 if [ -f %{_sysconfdir}/jabber/secret ] ; then
128         SECRET=`cat %{_sysconfdir}/jabber/secret`
129         if [ -n "$SECRET" ] ; then
130                 echo "Updating component authentication secret in Jabberd config files..."
131                 %{__sed} -i -e "s/>secret</>$SECRET</" %{_sysconfdir}/jabber/*.xml
132         fi
133 fi
134
135 /sbin/chkconfig --add jabberd
136 %service jabberd restart "Jabber server"
137
138 %if %{with avatars}
139 echo "This j2 package has new functionality, please read AVATARS file."
140 %endif
141
142 %preun
143 if [ "$1" = "0" ]; then
144         %service jabberd stop
145         /sbin/chkconfig --del jabberd
146 fi
147
148 %files
149 %defattr(644,root,root,755)
150 %doc AUTHORS ChangeLog NEWS README TODO
151 %doc tools/{db-setup.mysql,db-setup.pgsql,%{?with_sqlite:db-setup.sqlite,}pipe-auth.pl}
152 %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/*.cfg
153 %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/*.xml
154 %dir %{_sysconfdir}/jabber/templates
155 %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/templates/*.xml
156 %attr(755,root,root) %{_sbindir}/*
157 %dir %{_libdir}/jabberd
158 %attr(755,root,root) %{_libdir}/%{name}/*
159 %dir %attr(770,root,jabber) /var/lib/%{name}
160 %dir %attr(770,root,jabber) /var/lib/%{name}/db
161 %dir %attr(770,root,jabber) /var/lib/%{name}/stats
162 %attr(754,root,root) /etc/rc.d/init.d/%{name}
163 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
164 %{_mandir}/man*/*