openldap/openldap.spec

Mon, 17 Sep 2012 19:10:10 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 17 Sep 2012 19:10:10 +0200
changeset 689
9fe04d4d4e5a
parent 586
e10b124b2f21
child 777
4e2fe5febd48
permissions
-rw-r--r--

Update to new version of vendor software although Oracle fails to deliver.
More specifically, newer db(3) patch revisions exist but Oracle has
removed them from the canonical download server URI for Berkely DB.

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@587 34 Version: 2.4.32
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@174 103
michael@174 104 %build
michael@174 105 cp /dev/null config.cache
michael@174 106
michael@174 107 # configuration: standard build flags
michael@174 108 export CC="%{l_cc}"
michael@174 109 export CFLAGS="%{l_cflags -O}"
michael@174 110 export CPPFLAGS="%{l_cppflags}"
michael@174 111 export LDFLAGS="%{l_ldflags}"
michael@174 112 export LIBS=""
michael@174 113 export ARGS=""
michael@174 114 ARGS="$ARGS --prefix=%{l_prefix}"
michael@380 115 ARGS="$ARGS --mandir=%{l_prefix}/man"
michael@380 116 ARGS="$ARGS --infodir=%{l_prefix}/info"
michael@174 117 ARGS="$ARGS --libexecdir=%{l_prefix}/libexec/openldap"
michael@174 118 ARGS="$ARGS --localstatedir=%{l_prefix}/var/openldap"
michael@174 119 ARGS="$ARGS --enable-syslog"
michael@174 120 ARGS="$ARGS --with-tls"
michael@174 121 ARGS="$ARGS --without-fetch"
michael@174 122 ARGS="$ARGS --disable-dynamic"
michael@174 123 ARGS="$ARGS --disable-shared"
michael@174 124 %if "%{with_server}" == "yes"
michael@174 125 ARGS="$ARGS --enable-slapd"
michael@174 126 ARGS="$ARGS --disable-modules"
michael@174 127 ARGS="$ARGS --enable-local"
michael@174 128 ARGS="$ARGS --enable-bdb"
michael@174 129 ARGS="$ARGS --enable-hdb"
michael@174 130 ARGS="$ARGS --enable-rewrite"
michael@174 131 ARGS="$ARGS --enable-ldap"
michael@174 132 ARGS="$ARGS --enable-meta"
michael@174 133 ARGS="$ARGS --enable-monitor"
michael@174 134 ARGS="$ARGS --enable-dnssrv"
michael@174 135 ARGS="$ARGS --enable-null"
michael@174 136 ARGS="$ARGS --enable-shell"
michael@587 137 ARGS="$ARGS --enable-proxycache"
michael@587 138 ARGS="$ARGS --disable-mdb"
michael@174 139 %else
michael@174 140 ARGS="$ARGS --disable-slapd"
michael@174 141 ARGS="$ARGS --disable-modules"
michael@174 142 %endif
michael@174 143
michael@174 144 # configuration: force to use OSSP fsl
michael@174 145 %if "%{with_server}" == "yes"
michael@174 146 LDFLAGS="$LDFLAGS %{l_fsl_ldflags}"
michael@174 147 LIBS="$LIBS %{l_fsl_libs}"
michael@174 148 %endif
michael@174 149
michael@174 150 # configuration: force to use GNU pth if enabled
michael@174 151 %if "%{with_server}" == "yes"
michael@174 152 %if "%{with_pth}" == "yes"
michael@174 153 CFLAGS="$CFLAGS `%{l_prefix}/bin/pth-config --cflags`"
michael@174 154 CPPFLAGS="$CPPFLAGS -I`%{l_prefix}/bin/pth-config --includedir`"
michael@174 155 LDFLAGS="$LDFLAGS `%{l_prefix}/bin/pth-config --ldflags`"
michael@174 156 LIBS="`%{l_prefix}/bin/pth-config --libs` $LIBS"
michael@174 157 ARGS="$ARGS --with-threads=pth"
michael@174 158 ( echo "ac_cv_header_sys_devpoll_h=no"
michael@174 159 echo "ac_cv_header_sys_epoll_h=no"
michael@174 160 ) >>config.cache
michael@174 161 %else
michael@174 162 %if "%{with_pthreads}" == "yes"
michael@174 163 ARGS="$ARGS --with-threads=posix"
michael@174 164 %else
michael@174 165 ARGS="$ARGS --with-threads=no"
michael@174 166 %endif
michael@174 167 %endif
michael@174 168 %endif
michael@174 169
michael@174 170 # configuration: optional overlay support
michael@174 171 %if "%{with_server}" == "yes" && "%{with_overlays}" == "yes"
michael@174 172 ARGS="$ARGS --enable-overlays=yes"
michael@174 173 %endif
michael@174 174
michael@174 175 # configuration: optional SASL support
michael@174 176 %if "%{with_sasl}" == "yes"
michael@174 177 ( echo "ac_cv_lib_sasl2_sasl_client_init=yes"
michael@174 178 ) >>config.cache
michael@174 179 CPPFLAGS="%{l_cppflags sasl} $CPPFLAGS"
michael@174 180 ARGS="$ARGS --with-cyrus-sasl --enable-spasswd"
michael@174 181 %else
michael@174 182 ARGS="$ARGS --without-cyrus-sasl --disable-spasswd"
michael@174 183 %endif
michael@174 184
michael@174 185 # configuration: optional crypt(3) support
michael@174 186 %if "%{with_crypt}" == "yes"
michael@174 187 ARGS="$ARGS --enable-crypt"
michael@174 188 %endif
michael@174 189
michael@174 190 # configuration: optional Perl support
michael@174 191 %if "%{with_server}" == "yes" && "%{with_perl}" == "yes"
michael@174 192 ARGS="$ARGS --enable-perl"
michael@174 193 %endif
michael@174 194
michael@174 195 # configuration: optional ODBC-based RDBMS support
michael@174 196 %if "%{with_server}" == "yes" && "%{with_odbc}" == "yes"
michael@174 197 ARGS="$ARGS --enable-sql"
michael@174 198 %endif
michael@174 199
michael@174 200 # configuration: special platform support
michael@174 201 case "%{l_platform -t}" in
michael@174 202 *-sunos* ) CFLAGS="$CFLAGS -D_AVL_H"; LIBS="$LIBS -lrt" ;;
michael@174 203 esac
michael@174 204
michael@587 205 # configuration: use hard links and make sure our Berkeley DB is picked up first
michael@174 206 %{l_shtool} subst \
michael@174 207 -e 's;ln -s;ln;g' \
michael@174 208 -e 's;-ldb4[1-9];%{l_prefix}/lib/libdb.a;g' \
michael@174 209 -e 's;<db\.h>;"db.h";g' \
michael@174 210 configure
michael@174 211
michael@174 212 # configuration
michael@174 213 ./configure --cache-file=./config.cache $ARGS
michael@174 214
michael@174 215 # build toolkit
michael@587 216 %{l_make} %{l_mflags -O} depend
michael@587 217 %{l_make} %{l_mflags -O}
michael@174 218
michael@174 219 %install
michael@174 220 # install toolkit
michael@174 221 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
michael@174 222
michael@174 223 # post adjustment: remove extra files
michael@174 224 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/*.default
michael@174 225 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/*/*.default
michael@174 226
michael@174 227 # post adjustment: move files
michael@174 228 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/DB_CONFIG.example
michael@174 229 %if "%{with_server}" == "yes"
michael@174 230 mv $RPM_BUILD_ROOT%{l_prefix}/var/openldap/openldap-data/DB_CONFIG.example \
michael@174 231 $RPM_BUILD_ROOT%{l_prefix}/var/openldap/openldap-data/DB_CONFIG
michael@174 232 %endif
michael@174 233
michael@174 234 # post adjustment: enable and correct slapd.pid
michael@174 235 %if "%{with_server}" == "yes"
michael@174 236 %{l_shtool} subst \
michael@587 237 -e 's;^\(pidfile\).*$;\1 %{l_prefix}/var/openldap/run/slapd.pid;' \
michael@380 238 -e 's;^\(argsfile\).*$;\1 %{l_prefix}/var/openldap/run/slapd.args;' \
michael@174 239 $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/slapd.conf
michael@174 240 %endif
michael@174 241
michael@174 242 # post adjustment: remove OSSP fsl dependency from libtool files
michael@174 243 %if "%{with_server}" == "yes"
michael@174 244 %{l_shtool} subst \
michael@174 245 -e 's;-lfsl *;;' \
michael@174 246 $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
michael@174 247 %endif
michael@174 248
michael@587 249 # install run command script
michael@174 250 %if "%{with_server}" == "yes"
michael@174 251 %{l_shtool} mkdir -f -p -m 755 \
michael@174 252 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@174 253 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@174 254 %{SOURCE rc.openldap} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@174 255 %endif
michael@174 256
michael@174 257 # install OSSP fsl configuration
michael@174 258 %if "%{with_server}" == "yes"
michael@174 259 %{l_shtool} mkdir -f -p -m 755 \
michael@174 260 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
michael@174 261 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@174 262 %{SOURCE fsl.openldap} \
michael@174 263 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
michael@174 264 %endif
michael@174 265
michael@174 266 # install pkg-config configuration
michael@174 267 %{l_shtool} mkdir -f -p -m 755 \
michael@174 268 $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig
michael@174 269 libs="-lldap -llber"
michael@587 270 libdir="-L\${libdir}"
michael@174 271 %if "%{with_sasl}" == "yes"
michael@174 272 libs="$libs -lsasl2"
michael@174 273 %endif
michael@587 274 %if "%{with_pth}" == "yes"
michael@587 275 libs="$libs -lpth"
michael@587 276 libdir="$libdir -L\${libdir}/pth"
michael@587 277 %endif
michael@174 278 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@174 279 -e "s;@version@;%{version};" \
michael@174 280 -e "s;@libs@;$libs;" \
michael@587 281 -e "s;@libdir@;$libdir;" \
michael@174 282 %{SOURCE openldap.pc} \
michael@174 283 $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
michael@174 284
michael@587 285 # optionally remove server components
michael@174 286 %if "%{with_server}" != "yes"
michael@174 287 rm -rf $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/schema
michael@174 288 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/slapd.conf
michael@174 289 rm -rf $RPM_BUILD_ROOT%{l_prefix}/sbin
michael@174 290 rm -rf $RPM_BUILD_ROOT%{l_prefix}/libexec/openldap
michael@174 291 rm -f $RPM_BUILD_ROOT%{l_prefix}/include/slapi-plugin.h
michael@174 292 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man5/slap*
michael@174 293 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/slap*
michael@174 294 %endif
michael@174 295
michael@174 296 # determine installation files
michael@174 297 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@174 298 %{l_files_std} \
michael@174 299 %if "%{with_server}" == "yes"
michael@174 300 '%config %{l_prefix}/etc/fsl/fsl.openldap' \
michael@174 301 '%config %{l_prefix}/etc/openldap/schema/*.schema' \
michael@174 302 '%config %{l_prefix}/etc/openldap/schema/*.ldif' \
michael@174 303 %endif
michael@174 304 '%config %{l_prefix}/etc/openldap/*.conf'
michael@174 305
michael@174 306 %files -f files
michael@174 307
michael@174 308 %clean
michael@174 309
michael@174 310 %pre
michael@174 311 %if "%{with_server}" == "yes"
michael@174 312 # before upgrade, save status and stop service
michael@174 313 [ $1 -eq 2 ] || exit 0
michael@174 314 eval `%{l_rc} openldap status 2>/dev/null | tee %{l_tmpfile}`
michael@174 315 %{l_rc} openldap stop 2>/dev/null
michael@174 316 exit 0
michael@174 317 %endif
michael@174 318
michael@174 319 %post
michael@174 320 # after upgrade, restore status
michael@174 321 %if "%{with_server}" == "yes"
michael@174 322 [ $1 -eq 2 ] || exit 0
michael@174 323 { eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1
michael@174 324 [ ".$openldap_active" = .yes ] && %{l_rc} openldap start
michael@174 325 exit 0
michael@174 326 %endif
michael@174 327
michael@174 328 %preun
michael@174 329 # before erase, stop service and remove log files
michael@174 330 %if "%{with_server}" == "yes"
michael@174 331 [ $1 -eq 0 ] || exit 0
michael@174 332 %{l_rc} openldap stop 2>/dev/null
michael@174 333 rm -f $RPM_INSTALL_PREFIX/var/openldap/openldap.log* >/dev/null 2>&1 || true
michael@174 334 exit 0
michael@174 335 %endif
michael@174 336

mercurial