Merge from debian.
[hcoop/debian/courier-authlib.git] / courier-authlib.spec.in
CommitLineData
0fde1ce3 1# $Id: courier-authlib.spec.in,v 1.14 2008/07/13 14:53:39 mrsam Exp $
d9898ee8 2#
0fde1ce3 3# Copyright 1998 - 2008 Double Precision, Inc. See COPYING for
d9898ee8 4# distribution information.
5
6# No dist tag from mock; detect mandrake, redhat, etc. the old fashioned way
7%if 0%{!?dist:1}
8%define courier_release %(test -e /etc/mandrake-release -o -e /etc/mandriva-release && release="mdk" ; if test $? != 0; then release="`rpm -q --queryformat='.rh%{VERSION}' redhat-release 2>/dev/null`" ; if test $? != 0 ; then release="`rpm -q --queryformat='.fc%{VERSION}' fedora-release 2>/dev/null`" ; if test $? != 0 ; then release="" ; fi ; fi ; fi ; echo "$release")
64ff59ba 9%else
10%define courier_release %{nil}
d9898ee8 11%endif
12
13################################################################################
14
15Name: courier-authlib
16Version: @VERSION@
17Release: 1%{?dist}%{?courier_release}
18Summary: Courier authentication library
19
20Group: System Environment/Daemons
21License: GPL
22URL: http://www.courier-mta.org
23
24################################################################################
25
26Source: http://dl.sourceforge.net/courier/%{name}-%{version}.tar.bz2
27
28BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
29
30################################################################################
31
32BuildRequires: libtool
33BuildRequires: openldap-devel
34BuildRequires: mysql-devel zlib-devel
35BuildRequires: postgresql-devel
36BuildRequires: gdbm-devel
37BuildRequires: pam-devel
38BuildRequires: expect
39BuildRequires: gcc-c++
64ff59ba 40BuildRequires: redhat-rpm-config
d9898ee8 41
42BuildRequires: %{_includedir}/ltdl.h
43
44%if 0%(rpm -q redhat-release >/dev/null 2>&1 || rpm -q fedora-release >/dev/null 2>&1 || exit 0; echo "1")
45BuildRequires: redhat-rpm-config
46%endif
47
48
49Requires(post): /sbin/chkconfig
50Requires(preun): /sbin/chkconfig
51
0fde1ce3 52# Provides by symlinks in this release, for compatibility with 0.60,
53# will be removed in 0.62. This is temporary hack:
54
55%define dummysuffix %(test "%{_lib}" = "lib64" && echo '()(64bit)')
56
57Provides: libcourierauth.so.0%{dummysuffix} libcourierauthsasl.so.0%{dummysuffix} libcourierauthsaslclient.so.0%{dummysuffix} libcourierauthcommon.so.0%{dummysuffix}
58
d9898ee8 59################################################################################
60
61%description
62The Courier authentication library provides authentication services for
63other Courier applications.
64
65################################################################################
66
67%package devel
68Summary: Development libraries for the Courier authentication library
69Group: Development/Libraries
70Requires: courier-authlib = 0:%{version}-%{release}
71
72%description devel
73This package contains the development libraries and files needed to compile
74Courier packages that use this authentication library. Install this
75package in order to build the rest of the Courier packages. After they are
76built and installed this package can be removed. Files in this package
77are not needed at runtime.
78
79################################################################################
80
81%package userdb
82
83Summary: userdb support for the Courier authentication library
84Group: System Environment/Daemons
85Requires: courier-authlib = 0:%{version}-%{release}
86
87%description userdb
88This package installs the userdb support for the Courier authentication
89library. Userdb is a simple way to manage virtual mail accounts using
90a GDBM-based database file.
91Install this package in order to be able to authenticate with userdb.
92
93################################################################################
94
95%package ldap
96
97Summary: LDAP support for the Courier authentication library
98Group: System Environment/Daemons
99Requires: courier-authlib = 0:%{version}-%{release}
100
101%description ldap
102This package installs LDAP support for the Courier authentication library.
103Install this package in order to be able to authenticate using LDAP.
104
105################################################################################
106
107%package mysql
108
109Summary: MySQL support for the Courier authentication library
110Group: System Environment/Daemons
111Requires: courier-authlib = 0:%{version}-%{release}
112
113%description mysql
114This package installs MySQL support for the Courier authentication library.
115Install this package in order to be able to authenticate using MySQL.
116
117################################################################################
118
119%package pgsql
120
121Summary: MySQL support for the Courier authentication library
122Group: System Environment/Daemons
123Requires: courier-authlib = 0:%{version}-%{release}
124
125%description pgsql
126This package installs PostgreSQL support for the Courier authentication
127library.
128Install this package in order to be able to authenticate using PostgreSQL.
129
130################################################################################
131
132%package pipe
133
134Summary: External authentication module that communicates via pipes
135Group: System Environment/Daemons
136Requires: courier-authlib = 0:%{version}-%{release}
137
138%description pipe
139This package installs the authpipe module, which is a generic plugin
140that enables authentication requests to be serviced by an external
141program, then communicates through messages on stdin and stdout.
142
143################################################################################
144
145%prep
146%setup -q
147%configure --with-redhat
148
149%build
64ff59ba 150%{__make} -s %{_smp_mflags}
d9898ee8 151
152%install
153rm -rf $RPM_BUILD_ROOT
154MAKEFLAGS= %{__make} -j 1 install DESTDIR=$RPM_BUILD_ROOT
155%{__rm} -f $RPM_BUILD_ROOT%{_libdir}/courier-authlib/*.a
156%{__install} -m 555 sysconftool $RPM_BUILD_ROOT%{_libexecdir}/courier-authlib
157%{__install} -m 555 authmigrate $RPM_BUILD_ROOT%{_libexecdir}/courier-authlib
158
159./courierauthconfig --configfiles >configtmp
160. configtmp
161
162./authmksock $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/socket || exit 1
163touch $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/pid.lock || exit 1
164touch $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/pid || exit 1
165%{__chmod} 777 $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/socket || exit 1
166
167cat >configfiles.base <<EOF
168%defattr(-,$mailuser,$mailgroup,-)
169%{_sysconfdir}/authlib
170%{_libexecdir}/courier-authlib
171%dir %{_libdir}/courier-authlib
172%dir %attr(750,$mailuser,$mailgroup) %{_localstatedir}/spool/authdaemon
173EOF
174
175echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.mysql
176echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.ldap
177echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.pgsql
178echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.userdb
179echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.pipe
180echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.devel
181
182for f in $RPM_BUILD_ROOT%{_sbindir}/*
183do
184 fn=`basename $f`
185 case "$fn" in
186 *userdb*)
187 echo "%{_sbindir}/$fn" >>configfiles.userdb
188 ;;
189 *)
190 echo "%{_sbindir}/$fn" >>configfiles.base
191 ;;
192 esac
193done
194
195for f in $RPM_BUILD_ROOT%{_libdir}/courier-authlib/*
196do
197 fn=`basename $f`
198 case "$fn" in
199 libauthpipe*)
200 echo "%{_libdir}/courier-authlib/$fn" >>configfiles.pipe
201 ;;
202 libauthldap*)
203 echo "%{_libdir}/courier-authlib/$fn" >>configfiles.ldap
204 ;;
205 libauthmysql*)
206 echo "%{_libdir}/courier-authlib/$fn" >>configfiles.mysql
207 ;;
208 libauthpgsql*)
209 echo "%{_libdir}/courier-authlib/$fn" >>configfiles.pgsql
210 ;;
211 libauthldap*)
212 echo "%{_libdir}/courier-authlib/$fn" >>configfiles.ldap
213 ;;
214 libauthuserdb*)
215 echo "%{_libdir}/courier-authlib/$fn" >>configfiles.userdb
216 ;;
217 *)
218 echo "%{_libdir}/courier-authlib/$fn" >>configfiles.base
219 ;;
220 esac
221done
222%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
223%{__install} -m 555 courier-authlib.sysvinit \
224 $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/courier-authlib
225
226%post
227%{_libexecdir}/courier-authlib/authmigrate >/dev/null
228%{_libexecdir}/courier-authlib/sysconftool %{_sysconfdir}/authlib/*.dist >/dev/null
229
230/sbin/chkconfig --del courier-authlib
231/sbin/chkconfig --add courier-authlib
232
233%preun
234if test -x %{_sbindir}/authdaemond
235then
236 %{_sbindir}/authdaemond >/dev/null 2>&1 || /bin/true
237fi
238
239if test "$1" = "0"
240then
241 /sbin/chkconfig --del courier-authlib
242fi
243
244%clean
245rm -rf $RPM_BUILD_ROOT
246
247
248%files -f configfiles.base
249%defattr(-,root,root,-)
250%doc README README*html README.authmysql.myownquery README.ldap
251%doc NEWS COPYING* AUTHORS ChangeLog authldap.schema
252/etc/rc.d/init.d/*
253%ghost %attr(600, root, root) %{_localstatedir}/spool/authdaemon/pid.lock
254%ghost %attr(644, root, root) %{_localstatedir}/spool/authdaemon/pid
255%ghost %attr(-, root, root) %{_localstatedir}/spool/authdaemon/socket
256%{_mandir}/man1/*
257
258%files -f configfiles.userdb userdb
259%{_mandir}/man8/*userdb*
260
261%files -f configfiles.devel devel
262%defattr(-,root,root,-)
263%{_bindir}/courierauthconfig
264%{_includedir}/*
265%{_mandir}/man3/*
266%doc authlib.html auth_*.html
267
268%files -f configfiles.ldap ldap
269%defattr(-,root,root,-)
270%doc authldap.schema
271
272%files -f configfiles.mysql mysql
273
274%files -f configfiles.pgsql pgsql
275
276%files -f configfiles.pipe pipe
277
278%changelog
279
280* Thu Sep 7 2006 Chris Petersen <rpm@forevermore.net> 0.58-2
281- Make the spec a little prettier
282- Replace BuildPreReq with BuildRequires
283- Remove period from summaries (rpmlint)
284- Fix release tag to use %{?dist} macro if it's present
285- Change distro-detection to use "rh" and "fc" for version detection, and add support for mandriva
286
287* Sun Oct 3 2004 Mr. Sam <sam@email-scan.com> 0.50-1
288- Initial build.
289