Build courier-authlib 0.60.1-1hcoop1.
[hcoop/debian/courier-authlib.git] / courier-authlib.spec
1 # $Id: courier-authlib.spec.in,v 1.12 2007/10/07 02:50:45 mrsam Exp $
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")
9 %else
10 %define courier_release %{nil}
11 %endif
12
13 ################################################################################
14
15 Name: courier-authlib
16 Version: 0.60.1
17 Release: 1%{?dist}%{?courier_release}
18 Summary: Courier authentication library
19
20 Group: System Environment/Daemons
21 License: GPL
22 URL: http://www.courier-mta.org
23
24 ################################################################################
25
26 Source: http://dl.sourceforge.net/courier/%{name}-%{version}.tar.bz2
27
28 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
29
30 ################################################################################
31
32 BuildRequires: libtool
33 BuildRequires: openldap-devel
34 BuildRequires: mysql-devel zlib-devel
35 BuildRequires: postgresql-devel
36 BuildRequires: gdbm-devel
37 BuildRequires: pam-devel
38 BuildRequires: expect
39 BuildRequires: gcc-c++
40 BuildRequires: redhat-rpm-config
41
42 BuildRequires: %{_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")
45 BuildRequires: redhat-rpm-config
46 %endif
47
48
49 Requires(post): /sbin/chkconfig
50 Requires(preun): /sbin/chkconfig
51
52 ################################################################################
53
54 %description
55 The Courier authentication library provides authentication services for
56 other Courier applications.
57
58 ################################################################################
59
60 %package devel
61 Summary: Development libraries for the Courier authentication library
62 Group: Development/Libraries
63 Requires: courier-authlib = 0:%{version}-%{release}
64
65 %description devel
66 This package contains the development libraries and files needed to compile
67 Courier packages that use this authentication library. Install this
68 package in order to build the rest of the Courier packages. After they are
69 built and installed this package can be removed. Files in this package
70 are not needed at runtime.
71
72 ################################################################################
73
74 %package userdb
75
76 Summary: userdb support for the Courier authentication library
77 Group: System Environment/Daemons
78 Requires: courier-authlib = 0:%{version}-%{release}
79
80 %description userdb
81 This package installs the userdb support for the Courier authentication
82 library. Userdb is a simple way to manage virtual mail accounts using
83 a GDBM-based database file.
84 Install this package in order to be able to authenticate with userdb.
85
86 ################################################################################
87
88 %package ldap
89
90 Summary: LDAP support for the Courier authentication library
91 Group: System Environment/Daemons
92 Requires: courier-authlib = 0:%{version}-%{release}
93
94 %description ldap
95 This package installs LDAP support for the Courier authentication library.
96 Install this package in order to be able to authenticate using LDAP.
97
98 ################################################################################
99
100 %package mysql
101
102 Summary: MySQL support for the Courier authentication library
103 Group: System Environment/Daemons
104 Requires: courier-authlib = 0:%{version}-%{release}
105
106 %description mysql
107 This package installs MySQL support for the Courier authentication library.
108 Install this package in order to be able to authenticate using MySQL.
109
110 ################################################################################
111
112 %package pgsql
113
114 Summary: MySQL support for the Courier authentication library
115 Group: System Environment/Daemons
116 Requires: courier-authlib = 0:%{version}-%{release}
117
118 %description pgsql
119 This package installs PostgreSQL support for the Courier authentication
120 library.
121 Install this package in order to be able to authenticate using PostgreSQL.
122
123 ################################################################################
124
125 %package pipe
126
127 Summary: External authentication module that communicates via pipes
128 Group: System Environment/Daemons
129 Requires: courier-authlib = 0:%{version}-%{release}
130
131 %description pipe
132 This package installs the authpipe module, which is a generic plugin
133 that enables authentication requests to be serviced by an external
134 program, then communicates through messages on stdin and stdout.
135
136 ################################################################################
137
138 %prep
139 %setup -q
140 %configure --with-redhat
141
142 %build
143 %{__make} -s %{_smp_mflags}
144
145 %install
146 rm -rf $RPM_BUILD_ROOT
147 MAKEFLAGS= %{__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
156 touch $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/pid.lock || exit 1
157 touch $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/pid || exit 1
158 %{__chmod} 777 $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/socket || exit 1
159
160 cat >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
166 EOF
167
168 echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.mysql
169 echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.ldap
170 echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.pgsql
171 echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.userdb
172 echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.pipe
173 echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.devel
174
175 for f in $RPM_BUILD_ROOT%{_sbindir}/*
176 do
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
186 done
187
188 for f in $RPM_BUILD_ROOT%{_libdir}/courier-authlib/*
189 do
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
214 done
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
227 if test -x %{_sbindir}/authdaemond
228 then
229 %{_sbindir}/authdaemond >/dev/null 2>&1 || /bin/true
230 fi
231
232 if test "$1" = "0"
233 then
234 /sbin/chkconfig --del courier-authlib
235 fi
236
237 %clean
238 rm -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