openldap/openldap.spec

Mon, 28 Mar 2011 19:41:02 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Mar 2011 19:41:02 +0200
changeset 332
2289d64c2123
parent 184
f035b8d886ac
child 380
4f3b1ee715dd
permissions
-rw-r--r--

Completely rework package including...
Simpify 64-bit -fPIC logic, instruct make to build in parallel,
force error condition on failed profile dependency, build the
standard 'bootstrap' target as suggested, correct grammar, wording,
and punctuation in general, upgrade to latest upstream vendor version,
rearrange package dependencies mpc, mpfr, and gmp, correct buildconf
thanks to new lto-plugin forced, avoid failed platform specific stage
comparison, adjust patch code to reflect new version update, and most
importantly adjust optimization flags to platform. Please note that
block 'correct hardcoded paths' is likely no yet complete.

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

mercurial