openldap/openldap.spec

Mon, 01 Jul 2013 22:00:33 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 01 Jul 2013 22:00:33 +0200
changeset 777
4e2fe5febd48
parent 587
d0df67c21897
permissions
-rw-r--r--

Correct use of nonportable u_int types and update to new vendor version.

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

mercurial