Fri, 15 Oct 2010 19:06:09 +0200
Correct shared library and plugin link logic, as well as informal text.
Update file server URL, update build resource estimations, correct RPATH
logic, allow for qmake(1) static to shared library changes via CONFIG
argument, correct documentation broken title and index links, correct
shared library install path, install only one set of (correct) plugins,
install the designer shared library (as required by QtCreator), announce
features related to shared linking using qmake(1), and correclty
substitute hard coded paths in prl and la library files.
1 ##
2 ## openldap.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ##
5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all
8 ## copies.
9 ##
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 # package information
25 Name: openldap
26 Summary: Lightweight Directory Access Protocol (LDAP) Toolkit
27 URL: http://www.openldap.org/
28 Vendor: OpenLDAP Project
29 Packager: OpenPKG Foundation e.V.
30 Distribution: OpenPKG Community
31 Class: BASE
32 Group: LDAP
33 License: GPL
34 Version: 2.4.16
35 Release: 20090420
37 # package options
38 %option with_server yes
39 %option with_fsl yes
40 %option with_crypt yes
41 %option with_overlays yes
42 %option with_pthreads yes
43 %option with_pth no
44 %option with_sasl no
45 %option with_perl no
46 %option with_odbc no
48 # list of sources
49 Source0: ftp://ftp.openldap.org/pub/openldap/openldap-release/openldap-%{version}.tgz
50 Source1: rc.openldap
51 Source2: fsl.openldap
52 Source3: openldap.pc
53 Patch0: openldap.patch
55 # build information
56 Prefix: %{l_prefix}
57 BuildRoot: %{l_buildroot}
58 BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc
59 PreReq: OpenPKG, openpkg >= 20060823
60 BuildPreReq: openssl, db >= 4.5
61 PreReq: openssl, db >= 4.5
62 %if "%{with_server}" == "yes" && "%{with_fsl}" == "yes"
63 BuildPreReq: fsl
64 PreReq: fsl
65 %endif
66 %if "%{with_server}" == "yes" && "%{with_pthreads}" == "yes"
67 BuildPreReq: db::with_pthreads = yes
68 PreReq: db::with_pthreads = yes
69 %endif
70 %if "%{with_server}" == "yes" && "%{with_pth}" == "yes"
71 BuildPreReq: pth
72 PreReq: pth
73 %endif
74 %if "%{with_sasl}" == "yes"
75 BuildPreReq: sasl
76 PreReq: sasl
77 %endif
78 %if "%{with_server}" == "yes" && "%{with_odbc}" == "yes"
79 BuildPreReq: ODBC
80 PreReq: ODBC
81 %endif
82 AutoReq: no
83 AutoReqProv: no
85 %description
86 OpenLDAP is an open source implementation of the Lightweight
87 Directory Access Protocol (LDAP). The suite includes libraries
88 implementing the LDAP protocol plus a stand-alone LDAP server
89 slapd(8).
91 %track
92 prog openldap = {
93 version = %{version}
94 url = ftp://ftp.openldap.org/pub/openldap/openldap-release/
95 regex = openldap-(__VER__)\.tgz
96 }
98 %prep
99 %setup -q
100 %patch -p0
101 %{l_shtool} subst \
102 -e 's;-ldb-4\.[1-9];-ldb;g' \
103 -e 's;-ldb-4-[1-9];-ldb;g' \
104 -e 's;-ldb-4[1-9];-ldb;g' \
105 -e 's;-ldb-4;-ldb;g' \
106 configure
108 %build
109 cp /dev/null config.cache
111 # configuration: standard build flags
112 export CC="%{l_cc}"
113 export CFLAGS="%{l_cflags -O}"
114 export CPPFLAGS="%{l_cppflags}"
115 export LDFLAGS="%{l_ldflags}"
116 export LIBS=""
117 export ARGS=""
118 ARGS="$ARGS --prefix=%{l_prefix}"
119 ARGS="$ARGS --libexecdir=%{l_prefix}/libexec/openldap"
120 ARGS="$ARGS --localstatedir=%{l_prefix}/var/openldap"
121 ARGS="$ARGS --mandir=%{l_prefix}/man"
122 ARGS="$ARGS --enable-syslog"
123 ARGS="$ARGS --with-tls"
124 ARGS="$ARGS --without-fetch"
125 ARGS="$ARGS --without-gssapi"
126 ARGS="$ARGS --disable-dynamic"
127 ARGS="$ARGS --disable-shared"
128 %if "%{with_server}" == "yes"
129 ARGS="$ARGS --enable-slapd"
130 ARGS="$ARGS --disable-modules"
131 ARGS="$ARGS --enable-local"
132 ARGS="$ARGS --enable-bdb"
133 ARGS="$ARGS --enable-hdb"
134 ARGS="$ARGS --enable-rewrite"
135 ARGS="$ARGS --enable-ldap"
136 ARGS="$ARGS --enable-meta"
137 ARGS="$ARGS --enable-monitor"
138 ARGS="$ARGS --enable-dnssrv"
139 ARGS="$ARGS --enable-null"
140 ARGS="$ARGS --enable-shell"
141 ARGS="$ARGS --with-proxycache"
142 %else
143 ARGS="$ARGS --disable-slapd"
144 ARGS="$ARGS --disable-modules"
145 %endif
147 # configuration: force to use OSSP fsl
148 %if "%{with_server}" == "yes"
149 LDFLAGS="$LDFLAGS %{l_fsl_ldflags}"
150 LIBS="$LIBS %{l_fsl_libs}"
151 %endif
153 # configuration: force to use GNU pth if enabled
154 %if "%{with_server}" == "yes"
155 %if "%{with_pth}" == "yes"
156 CFLAGS="$CFLAGS `%{l_prefix}/bin/pth-config --cflags`"
157 CPPFLAGS="$CPPFLAGS -I`%{l_prefix}/bin/pth-config --includedir`"
158 LDFLAGS="$LDFLAGS `%{l_prefix}/bin/pth-config --ldflags`"
159 LIBS="`%{l_prefix}/bin/pth-config --libs` $LIBS"
160 ARGS="$ARGS --with-threads=pth"
161 ( echo "ac_cv_header_sys_devpoll_h=no"
162 echo "ac_cv_header_sys_epoll_h=no"
163 ) >>config.cache
164 %else
165 %if "%{with_pthreads}" == "yes"
166 ARGS="$ARGS --with-threads=posix"
167 %else
168 ARGS="$ARGS --with-threads=no"
169 %endif
170 %endif
171 %endif
173 # configuration: optional overlay support
174 %if "%{with_server}" == "yes" && "%{with_overlays}" == "yes"
175 ARGS="$ARGS --enable-overlays=yes"
176 %endif
178 # configuration: optional SASL support
179 %if "%{with_sasl}" == "yes"
180 ( echo "ac_cv_lib_sasl2_sasl_client_init=yes"
181 ) >>config.cache
182 CPPFLAGS="%{l_cppflags sasl} $CPPFLAGS"
183 ARGS="$ARGS --with-cyrus-sasl --enable-spasswd"
184 %else
185 ARGS="$ARGS --without-cyrus-sasl --disable-spasswd"
186 %endif
188 # configuration: optional crypt(3) support
189 %if "%{with_crypt}" == "yes"
190 ARGS="$ARGS --enable-crypt"
191 %endif
193 # configuration: optional Perl support
194 %if "%{with_server}" == "yes" && "%{with_perl}" == "yes"
195 ARGS="$ARGS --enable-perl"
196 %endif
198 # configuration: optional ODBC-based RDBMS support
199 %if "%{with_server}" == "yes" && "%{with_odbc}" == "yes"
200 ARGS="$ARGS --enable-sql"
201 %endif
203 # configuration: special platform support
204 case "%{l_platform -t}" in
205 *-sunos* ) CFLAGS="$CFLAGS -D_AVL_H"; LIBS="$LIBS -lrt" ;;
206 esac
208 # configuration: use hard-links and make sure our Berkeley-DB is picked up first
209 %{l_shtool} subst \
210 -e 's;ln -s;ln;g' \
211 -e 's;-ldb4[1-9];%{l_prefix}/lib/libdb.a;g' \
212 -e 's;<db\.h>;"db.h";g' \
213 configure
215 # configuration
216 ./configure --cache-file=./config.cache $ARGS
218 # build toolkit
219 %{l_make} %{l_mflags} depend
220 %{l_make} %{l_mflags}
222 %install
223 # install toolkit
224 rm -rf $RPM_BUILD_ROOT
225 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
227 # post adjustment: remove extra files
228 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/*.default
229 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/*/*.default
231 # post adjustment: move files
232 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/DB_CONFIG.example
233 %if "%{with_server}" == "yes"
234 mv $RPM_BUILD_ROOT%{l_prefix}/var/openldap/openldap-data/DB_CONFIG.example \
235 $RPM_BUILD_ROOT%{l_prefix}/var/openldap/openldap-data/DB_CONFIG
236 %endif
238 # post adjustment: enable and correct slapd.pid
239 %if "%{with_server}" == "yes"
240 %{l_shtool} subst \
241 -e 's;^[ #]*\(pidfile \).*$;\1 %{l_prefix}/var/openldap/run/slapd.pid;' \
242 $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/slapd.conf
243 %endif
245 # post adjustment: remove OSSP fsl dependency from libtool files
246 %if "%{with_server}" == "yes"
247 %{l_shtool} subst \
248 -e 's;-lfsl *;;' \
249 $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
250 %endif
252 # install run-command script
253 %if "%{with_server}" == "yes"
254 %{l_shtool} mkdir -f -p -m 755 \
255 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
256 %{l_shtool} install -c -m 755 %{l_value -s -a} \
257 %{SOURCE rc.openldap} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
258 %endif
260 # install OSSP fsl configuration
261 %if "%{with_server}" == "yes"
262 %{l_shtool} mkdir -f -p -m 755 \
263 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
264 %{l_shtool} install -c -m 644 %{l_value -s -a} \
265 %{SOURCE fsl.openldap} \
266 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
267 %endif
269 # install pkg-config configuration
270 %{l_shtool} mkdir -f -p -m 755 \
271 $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig
272 libs="-lldap -llber"
273 %if "%{with_sasl}" == "yes"
274 libs="$libs -lsasl2"
275 %endif
276 %{l_shtool} install -c -m 644 %{l_value -s -a} \
277 -e "s;@version@;%{version};" \
278 -e "s;@libs@;$libs;" \
279 %{SOURCE openldap.pc} \
280 $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
282 # optionally remove server-components
283 %if "%{with_server}" != "yes"
284 rm -rf $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/schema
285 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/slapd.conf
286 rm -rf $RPM_BUILD_ROOT%{l_prefix}/sbin
287 rm -rf $RPM_BUILD_ROOT%{l_prefix}/libexec/openldap
288 rm -f $RPM_BUILD_ROOT%{l_prefix}/include/slapi-plugin.h
289 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man5/slap*
290 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/slap*
291 %endif
293 # determine installation files
294 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
295 %{l_files_std} \
296 %if "%{with_server}" == "yes"
297 '%config %{l_prefix}/etc/fsl/fsl.openldap' \
298 '%config %{l_prefix}/etc/openldap/schema/*.schema' \
299 '%config %{l_prefix}/etc/openldap/schema/*.ldif' \
300 %endif
301 '%config %{l_prefix}/etc/openldap/*.conf'
303 %files -f files
305 %clean
306 rm -rf $RPM_BUILD_ROOT
308 %pre
309 %if "%{with_server}" == "yes"
310 # before upgrade, save status and stop service
311 [ $1 -eq 2 ] || exit 0
312 eval `%{l_rc} openldap status 2>/dev/null | tee %{l_tmpfile}`
313 %{l_rc} openldap stop 2>/dev/null
314 exit 0
315 %endif
317 %post
318 # after upgrade, restore status
319 %if "%{with_server}" == "yes"
320 [ $1 -eq 2 ] || exit 0
321 { eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1
322 [ ".$openldap_active" = .yes ] && %{l_rc} openldap start
323 exit 0
324 %endif
326 %preun
327 # before erase, stop service and remove log files
328 %if "%{with_server}" == "yes"
329 [ $1 -eq 0 ] || exit 0
330 %{l_rc} openldap stop 2>/dev/null
331 rm -f $RPM_INSTALL_PREFIX/var/openldap/openldap.log* >/dev/null 2>&1 || true
332 exit 0
333 %endif