openldap/openldap.spec

Sat, 24 Mar 2012 21:40:49 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 24 Mar 2012 21:40:49 +0100
changeset 414
fd611cde817f
parent 195
8f6a78b621a9
child 586
e10b124b2f21
permissions
-rw-r--r--

Introduce many changes to the buildconf and source code including:
(01) clean up, update, and partially update default config files,
(02) seems that Melware is unable to perform release engineering so
update chan_capi to new daily snapshot to solve echo problems,
(03) correct Asterisk inadequate hard coded gmime version check,
(04) force postgresql pthreads linkage to solve build problem,
(05) remove buggy hard coded LibXML configure definitions,
(06) remove local architecture specification to allow GCC
internal logic to determine proper CPU type instead,
(07) remove vendor sound install target causing uncontrolled
downloads and non RPM managed file installation,
(08) solve long outstanding bug in tcptls causing Asterisk
to ignore any intermediate CA certificate signatures,
(09) back out Digium engineering team's bright idea of replacing the
very portable and pervasive POSIX rand(1) with ast_random(), and
then not even implementing it causing all references to fail in
platforms not providing the very new POSIX.1-2008 mkdtemp(3)
function only distributed by BSD and some Linux,
(10) withdraw advanced linker symbol manipulations from SVR5 builds
until either Binutils supports hybrid versioned and anonymous
linker scripts or GCC stops hard coding versioned linker scripts,
(11) correct missing library linkage, some tailored to a specific OS,
(12) remove outdated logic for the no longer distributed gmime-config(1),
(13) remove local gmime buildconf hacks now that Asterisk has corrected
their own build configuration to almost portably support gmime,
(14) solve build problems relating to undetected LibXML paths,
(15) correct erroneous out of tree include definitions,
(16) improve some variable and comment naming,
(17) simplify sound language path hierarchy creation,
and correct australian english installation logic.

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

mercurial