Imported Upstream version 0.63.0
[hcoop/debian/courier-authlib.git] / courier-authlib.spec.in
CommitLineData
8d138742 1# $Id: courier-authlib.spec.in,v 1.18 2009/12/18 04:24:20 mrsam Exp $
d9898ee8 2#
ac40fd9e 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")
dd184caf 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++
dd184caf 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
ac40fd9e 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
8d138742 147%configure -C --with-redhat
d9898ee8 148
149%build
dd184caf 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
d9898ee8 157
158./courierauthconfig --configfiles >configtmp
8d138742 159. ./configtmp
d9898ee8 160
8d138742
CE
161d=`pwd`
162cd $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon || exit 1
163$d/authmksock ./socket || exit 1
164cd $d || exit 1
d9898ee8 165touch $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/pid.lock || exit 1
166touch $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/pid || exit 1
167%{__chmod} 777 $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/socket || exit 1
168
169cat >configfiles.base <<EOF
170%defattr(-,$mailuser,$mailgroup,-)
171%{_sysconfdir}/authlib
172%{_libexecdir}/courier-authlib
173%dir %{_libdir}/courier-authlib
174%dir %attr(750,$mailuser,$mailgroup) %{_localstatedir}/spool/authdaemon
175EOF
176
177echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.mysql
178echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.ldap
179echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.pgsql
180echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.userdb
181echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.pipe
182echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.devel
183
184for f in $RPM_BUILD_ROOT%{_sbindir}/*
185do
186 fn=`basename $f`
187 case "$fn" in
188 *userdb*)
189 echo "%{_sbindir}/$fn" >>configfiles.userdb
190 ;;
191 *)
192 echo "%{_sbindir}/$fn" >>configfiles.base
193 ;;
194 esac
195done
196
197for f in $RPM_BUILD_ROOT%{_libdir}/courier-authlib/*
198do
199 fn=`basename $f`
200 case "$fn" in
201 libauthpipe*)
202 echo "%{_libdir}/courier-authlib/$fn" >>configfiles.pipe
203 ;;
204 libauthldap*)
205 echo "%{_libdir}/courier-authlib/$fn" >>configfiles.ldap
206 ;;
207 libauthmysql*)
208 echo "%{_libdir}/courier-authlib/$fn" >>configfiles.mysql
209 ;;
210 libauthpgsql*)
211 echo "%{_libdir}/courier-authlib/$fn" >>configfiles.pgsql
212 ;;
213 libauthldap*)
214 echo "%{_libdir}/courier-authlib/$fn" >>configfiles.ldap
215 ;;
216 libauthuserdb*)
217 echo "%{_libdir}/courier-authlib/$fn" >>configfiles.userdb
218 ;;
219 *)
220 echo "%{_libdir}/courier-authlib/$fn" >>configfiles.base
221 ;;
222 esac
223done
224%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
225%{__install} -m 555 courier-authlib.sysvinit \
226 $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/courier-authlib
227
228%post
d9898ee8 229%{_libexecdir}/courier-authlib/sysconftool %{_sysconfdir}/authlib/*.dist >/dev/null
230
231/sbin/chkconfig --del courier-authlib
232/sbin/chkconfig --add courier-authlib
233
234%preun
235if test -x %{_sbindir}/authdaemond
236then
237 %{_sbindir}/authdaemond >/dev/null 2>&1 || /bin/true
238fi
239
240if test "$1" = "0"
241then
242 /sbin/chkconfig --del courier-authlib
243fi
244
245%clean
246rm -rf $RPM_BUILD_ROOT
247
248
249%files -f configfiles.base
250%defattr(-,root,root,-)
251%doc README README*html README.authmysql.myownquery README.ldap
8d138742 252%doc NEWS COPYING* AUTHORS ChangeLog
d9898ee8 253/etc/rc.d/init.d/*
254%ghost %attr(600, root, root) %{_localstatedir}/spool/authdaemon/pid.lock
255%ghost %attr(644, root, root) %{_localstatedir}/spool/authdaemon/pid
256%ghost %attr(-, root, root) %{_localstatedir}/spool/authdaemon/socket
257%{_mandir}/man1/*
258
259%files -f configfiles.userdb userdb
260%{_mandir}/man8/*userdb*
261
262%files -f configfiles.devel devel
263%defattr(-,root,root,-)
264%{_bindir}/courierauthconfig
265%{_includedir}/*
266%{_mandir}/man3/*
267%doc authlib.html auth_*.html
268
269%files -f configfiles.ldap ldap
270%defattr(-,root,root,-)
8d138742 271%doc authldap.schema authldap.ldif
d9898ee8 272
273%files -f configfiles.mysql mysql
274
275%files -f configfiles.pgsql pgsql
276
277%files -f configfiles.pipe pipe
278
279%changelog
280
281* Thu Sep 7 2006 Chris Petersen <rpm@forevermore.net> 0.58-2
282- Make the spec a little prettier
283- Replace BuildPreReq with BuildRequires
284- Remove period from summaries (rpmlint)
285- Fix release tag to use %{?dist} macro if it's present
286- Change distro-detection to use "rh" and "fc" for version detection, and add support for mandriva
287
288* Sun Oct 3 2004 Mr. Sam <sam@email-scan.com> 0.50-1
289- Initial build.
290