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