release
[hcoop/debian/courier-authlib.git] / courier-authlib.spec.in
1 # $Id: courier-authlib.spec.in,v 1.18 2009/12/18 04:24:20 mrsam Exp $
2 #
3 # Copyright 1998 - 2008 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: @VERSION@
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 # 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
57 Provides: libcourierauth.so.0%{dummysuffix} libcourierauthsasl.so.0%{dummysuffix} libcourierauthsaslclient.so.0%{dummysuffix} libcourierauthcommon.so.0%{dummysuffix}
58
59 ################################################################################
60
61 %description
62 The Courier authentication library provides authentication services for
63 other Courier applications.
64
65 ################################################################################
66
67 %package devel
68 Summary: Development libraries for the Courier authentication library
69 Group: Development/Libraries
70 Requires: courier-authlib = 0:%{version}-%{release}
71
72 %description devel
73 This package contains the development libraries and files needed to compile
74 Courier packages that use this authentication library. Install this
75 package in order to build the rest of the Courier packages. After they are
76 built and installed this package can be removed. Files in this package
77 are not needed at runtime.
78
79 ################################################################################
80
81 %package userdb
82
83 Summary: userdb support for the Courier authentication library
84 Group: System Environment/Daemons
85 Requires: courier-authlib = 0:%{version}-%{release}
86
87 %description userdb
88 This package installs the userdb support for the Courier authentication
89 library. Userdb is a simple way to manage virtual mail accounts using
90 a GDBM-based database file.
91 Install this package in order to be able to authenticate with userdb.
92
93 ################################################################################
94
95 %package ldap
96
97 Summary: LDAP support for the Courier authentication library
98 Group: System Environment/Daemons
99 Requires: courier-authlib = 0:%{version}-%{release}
100
101 %description ldap
102 This package installs LDAP support for the Courier authentication library.
103 Install this package in order to be able to authenticate using LDAP.
104
105 ################################################################################
106
107 %package mysql
108
109 Summary: MySQL support for the Courier authentication library
110 Group: System Environment/Daemons
111 Requires: courier-authlib = 0:%{version}-%{release}
112
113 %description mysql
114 This package installs MySQL support for the Courier authentication library.
115 Install this package in order to be able to authenticate using MySQL.
116
117 ################################################################################
118
119 %package pgsql
120
121 Summary: MySQL support for the Courier authentication library
122 Group: System Environment/Daemons
123 Requires: courier-authlib = 0:%{version}-%{release}
124
125 %description pgsql
126 This package installs PostgreSQL support for the Courier authentication
127 library.
128 Install this package in order to be able to authenticate using PostgreSQL.
129
130 ################################################################################
131
132 %package pipe
133
134 Summary: External authentication module that communicates via pipes
135 Group: System Environment/Daemons
136 Requires: courier-authlib = 0:%{version}-%{release}
137
138 %description pipe
139 This package installs the authpipe module, which is a generic plugin
140 that enables authentication requests to be serviced by an external
141 program, then communicates through messages on stdin and stdout.
142
143 ################################################################################
144
145 %prep
146 %setup -q
147 %configure -C --with-redhat
148
149 %build
150 %{__make} -s %{_smp_mflags}
151
152 %install
153 rm -rf $RPM_BUILD_ROOT
154 MAKEFLAGS= %{__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
158 ./courierauthconfig --configfiles >configtmp
159 . ./configtmp
160
161 d=`pwd`
162 cd $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon || exit 1
163 $d/authmksock ./socket || exit 1
164 cd $d || exit 1
165 touch $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/pid.lock || exit 1
166 touch $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/pid || exit 1
167 %{__chmod} 777 $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/socket || exit 1
168
169 cat >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
175 EOF
176
177 echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.mysql
178 echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.ldap
179 echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.pgsql
180 echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.userdb
181 echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.pipe
182 echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.devel
183
184 for f in $RPM_BUILD_ROOT%{_sbindir}/*
185 do
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
195 done
196
197 for f in $RPM_BUILD_ROOT%{_libdir}/courier-authlib/*
198 do
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
223 done
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
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
235 if test -x %{_sbindir}/authdaemond
236 then
237 %{_sbindir}/authdaemond >/dev/null 2>&1 || /bin/true
238 fi
239
240 if test "$1" = "0"
241 then
242 /sbin/chkconfig --del courier-authlib
243 fi
244
245 %clean
246 rm -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
252 %doc NEWS COPYING* AUTHORS ChangeLog
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,-)
271 %doc authldap.schema authldap.ldif
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