openldap/openldap.spec

changeset 174
8998cbee3fc3
child 184
f035b8d886ac
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/openldap/openldap.spec	Mon Apr 20 01:18:20 2009 +0200
     1.3 @@ -0,0 +1,332 @@
     1.4 +##
     1.5 +##  openldap.spec -- OpenPKG RPM Package Specification
     1.6 +##  Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
     1.7 +##
     1.8 +##  Permission to use, copy, modify, and distribute this software for
     1.9 +##  any purpose with or without fee is hereby granted, provided that
    1.10 +##  the above copyright notice and this permission notice appear in all
    1.11 +##  copies.
    1.12 +##
    1.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    1.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.24 +##  SUCH DAMAGE.
    1.25 +##
    1.26 +
    1.27 +#   package information
    1.28 +Name:         openldap
    1.29 +Summary:      Lightweight Directory Access Protocol (LDAP) Toolkit
    1.30 +URL:          http://www.openldap.org/
    1.31 +Vendor:       OpenLDAP Project
    1.32 +Packager:     OpenPKG Foundation e.V.
    1.33 +Distribution: OpenPKG Community
    1.34 +Class:        BASE
    1.35 +Group:        LDAP
    1.36 +License:      GPL
    1.37 +Version:      2.4.16
    1.38 +Release:      20090406
    1.39 +
    1.40 +#   package options
    1.41 +%option       with_server   yes
    1.42 +%option       with_fsl      yes
    1.43 +%option       with_crypt    yes
    1.44 +%option       with_overlays yes
    1.45 +%option       with_pth      yes
    1.46 +%option       with_pthreads no
    1.47 +%option       with_sasl     no
    1.48 +%option       with_perl     no
    1.49 +%option       with_odbc     no
    1.50 +
    1.51 +#   list of sources
    1.52 +Source0:      ftp://ftp.openldap.org/pub/openldap/openldap-release/openldap-%{version}.tgz
    1.53 +Source1:      rc.openldap
    1.54 +Source2:      fsl.openldap
    1.55 +Source3:      openldap.pc
    1.56 +Patch0:       openldap.patch
    1.57 +
    1.58 +#   build information
    1.59 +Prefix:       %{l_prefix}
    1.60 +BuildRoot:    %{l_buildroot}
    1.61 +BuildPreReq:  OpenPKG, openpkg >= 20060823, make, gcc
    1.62 +PreReq:       OpenPKG, openpkg >= 20060823
    1.63 +BuildPreReq:  openssl, db >= 4.5
    1.64 +PreReq:       openssl, db >= 4.5
    1.65 +%if "%{with_server}" == "yes" && "%{with_fsl}" == "yes"
    1.66 +BuildPreReq:  fsl
    1.67 +PreReq:       fsl
    1.68 +%endif
    1.69 +%if "%{with_server}" == "yes" && "%{with_pthreads}" == "yes"
    1.70 +BuildPreReq:  db::with_pthreads = yes
    1.71 +PreReq:       db::with_pthreads = yes
    1.72 +%endif
    1.73 +%if "%{with_server}" == "yes" && "%{with_pth}" == "yes"
    1.74 +BuildPreReq:  pth
    1.75 +PreReq:       pth
    1.76 +%endif
    1.77 +%if "%{with_sasl}" == "yes"
    1.78 +BuildPreReq:  sasl
    1.79 +PreReq:       sasl
    1.80 +%endif
    1.81 +%if "%{with_server}" == "yes" && "%{with_odbc}" == "yes"
    1.82 +BuildPreReq:  ODBC
    1.83 +PreReq:       ODBC
    1.84 +%endif
    1.85 +AutoReq:      no
    1.86 +AutoReqProv:  no
    1.87 +
    1.88 +%description
    1.89 +    OpenLDAP is an open source implementation of the Lightweight
    1.90 +    Directory Access Protocol (LDAP). The suite includes libraries
    1.91 +    implementing the LDAP protocol plus a stand-alone LDAP server
    1.92 +    slapd(8).
    1.93 +
    1.94 +%track
    1.95 +    prog openldap = {
    1.96 +        version   = %{version}
    1.97 +        url       = ftp://ftp.openldap.org/pub/openldap/openldap-release/
    1.98 +        regex     = openldap-(__VER__)\.tgz
    1.99 +    }
   1.100 +
   1.101 +%prep
   1.102 +    %setup -q
   1.103 +    %patch -p0
   1.104 +    %{l_shtool} subst \
   1.105 +        -e 's;-ldb-4\.[1-9];-ldb;g' \
   1.106 +        -e 's;-ldb-4-[1-9];-ldb;g' \
   1.107 +        -e 's;-ldb-4[1-9];-ldb;g' \
   1.108 +        -e 's;-ldb-4;-ldb;g' \
   1.109 +        configure
   1.110 +
   1.111 +%build
   1.112 +    cp /dev/null config.cache
   1.113 +
   1.114 +    #   configuration: standard build flags
   1.115 +    export CC="%{l_cc}"
   1.116 +    export CFLAGS="%{l_cflags -O}"
   1.117 +    export CPPFLAGS="%{l_cppflags}"
   1.118 +    export LDFLAGS="%{l_ldflags}"
   1.119 +    export LIBS=""
   1.120 +    export ARGS=""
   1.121 +    ARGS="$ARGS --prefix=%{l_prefix}"
   1.122 +    ARGS="$ARGS --libexecdir=%{l_prefix}/libexec/openldap"
   1.123 +    ARGS="$ARGS --localstatedir=%{l_prefix}/var/openldap"
   1.124 +    ARGS="$ARGS --enable-syslog"
   1.125 +    ARGS="$ARGS --with-tls"
   1.126 +    ARGS="$ARGS --without-fetch"
   1.127 +    ARGS="$ARGS --disable-dynamic"
   1.128 +    ARGS="$ARGS --disable-shared"
   1.129 +%if "%{with_server}" == "yes"
   1.130 +    ARGS="$ARGS --enable-slapd"
   1.131 +    ARGS="$ARGS --disable-modules"
   1.132 +    ARGS="$ARGS --enable-local"
   1.133 +    ARGS="$ARGS --enable-bdb"
   1.134 +    ARGS="$ARGS --enable-hdb"
   1.135 +    ARGS="$ARGS --enable-rewrite"
   1.136 +    ARGS="$ARGS --enable-ldap"
   1.137 +    ARGS="$ARGS --enable-meta"
   1.138 +    ARGS="$ARGS --enable-monitor"
   1.139 +    ARGS="$ARGS --enable-dnssrv"
   1.140 +    ARGS="$ARGS --enable-null"
   1.141 +    ARGS="$ARGS --enable-shell"
   1.142 +    ARGS="$ARGS --with-proxycache"
   1.143 +%else
   1.144 +    ARGS="$ARGS --disable-slapd"
   1.145 +    ARGS="$ARGS --disable-modules"
   1.146 +%endif
   1.147 +
   1.148 +    #   configuration: force to use OSSP fsl
   1.149 +%if "%{with_server}" == "yes"
   1.150 +    LDFLAGS="$LDFLAGS %{l_fsl_ldflags}"
   1.151 +    LIBS="$LIBS %{l_fsl_libs}"
   1.152 +%endif
   1.153 +
   1.154 +    #   configuration: force to use GNU pth if enabled
   1.155 +%if "%{with_server}" == "yes"
   1.156 +%if "%{with_pth}" == "yes"
   1.157 +    CFLAGS="$CFLAGS `%{l_prefix}/bin/pth-config --cflags`"
   1.158 +    CPPFLAGS="$CPPFLAGS -I`%{l_prefix}/bin/pth-config --includedir`"
   1.159 +    LDFLAGS="$LDFLAGS `%{l_prefix}/bin/pth-config --ldflags`"
   1.160 +    LIBS="`%{l_prefix}/bin/pth-config --libs` $LIBS"
   1.161 +    ARGS="$ARGS --with-threads=pth"
   1.162 +    ( echo "ac_cv_header_sys_devpoll_h=no"
   1.163 +      echo "ac_cv_header_sys_epoll_h=no"
   1.164 +    ) >>config.cache
   1.165 +%else
   1.166 +%if "%{with_pthreads}" == "yes"
   1.167 +    ARGS="$ARGS --with-threads=posix"
   1.168 +%else
   1.169 +    ARGS="$ARGS --with-threads=no"
   1.170 +%endif
   1.171 +%endif
   1.172 +%endif
   1.173 +
   1.174 +    #   configuration: optional overlay support
   1.175 +%if "%{with_server}" == "yes" && "%{with_overlays}" == "yes"
   1.176 +    ARGS="$ARGS --enable-overlays=yes"
   1.177 +%endif
   1.178 +
   1.179 +    #   configuration: optional SASL support
   1.180 +%if "%{with_sasl}" == "yes"
   1.181 +    ( echo "ac_cv_lib_sasl2_sasl_client_init=yes"
   1.182 +    ) >>config.cache
   1.183 +    CPPFLAGS="%{l_cppflags sasl} $CPPFLAGS"
   1.184 +    ARGS="$ARGS --with-cyrus-sasl --enable-spasswd"
   1.185 +%else
   1.186 +    ARGS="$ARGS --without-cyrus-sasl --disable-spasswd"
   1.187 +%endif
   1.188 +
   1.189 +    #   configuration: optional crypt(3) support
   1.190 +%if "%{with_crypt}" == "yes"
   1.191 +    ARGS="$ARGS --enable-crypt"
   1.192 +%endif
   1.193 +
   1.194 +    #   configuration: optional Perl support
   1.195 +%if "%{with_server}" == "yes" && "%{with_perl}" == "yes"
   1.196 +    ARGS="$ARGS --enable-perl"
   1.197 +%endif
   1.198 +
   1.199 +    #   configuration: optional ODBC-based RDBMS support
   1.200 +%if "%{with_server}" == "yes" && "%{with_odbc}" == "yes"
   1.201 +    ARGS="$ARGS --enable-sql"
   1.202 +%endif
   1.203 +
   1.204 +    #   configuration: special platform support
   1.205 +    case "%{l_platform -t}" in
   1.206 +        *-sunos* ) CFLAGS="$CFLAGS -D_AVL_H"; LIBS="$LIBS -lrt" ;;
   1.207 +    esac
   1.208 +
   1.209 +    #   configuration: use hard-links and make sure our Berkeley-DB is picked up first
   1.210 +    %{l_shtool} subst \
   1.211 +        -e 's;ln -s;ln;g' \
   1.212 +        -e 's;-ldb4[1-9];%{l_prefix}/lib/libdb.a;g' \
   1.213 +        -e 's;<db\.h>;"db.h";g' \
   1.214 +        configure
   1.215 +
   1.216 +    #   configuration
   1.217 +    ./configure --cache-file=./config.cache $ARGS
   1.218 +
   1.219 +    #   build toolkit
   1.220 +    %{l_make} %{l_mflags} depend
   1.221 +    %{l_make} %{l_mflags}
   1.222 +
   1.223 +%install
   1.224 +    #   install toolkit
   1.225 +    rm -rf $RPM_BUILD_ROOT
   1.226 +    %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   1.227 +
   1.228 +    #   post adjustment: remove extra files
   1.229 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/*.default
   1.230 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/*/*.default
   1.231 +
   1.232 +    #   post adjustment: move files
   1.233 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/DB_CONFIG.example
   1.234 +%if "%{with_server}" == "yes"
   1.235 +    mv  $RPM_BUILD_ROOT%{l_prefix}/var/openldap/openldap-data/DB_CONFIG.example \
   1.236 +        $RPM_BUILD_ROOT%{l_prefix}/var/openldap/openldap-data/DB_CONFIG
   1.237 +%endif
   1.238 +
   1.239 +    #   post adjustment: enable and correct slapd.pid
   1.240 +%if "%{with_server}" == "yes"
   1.241 +    %{l_shtool} subst \
   1.242 +        -e 's;^[ #]*\(pidfile \).*$;\1 %{l_prefix}/var/openldap/run/slapd.pid;' \
   1.243 +        $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/slapd.conf
   1.244 +%endif
   1.245 +
   1.246 +    #   post adjustment: remove OSSP fsl dependency from libtool files
   1.247 +%if "%{with_server}" == "yes"
   1.248 +    %{l_shtool} subst \
   1.249 +        -e 's;-lfsl *;;' \
   1.250 +        $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
   1.251 +%endif
   1.252 +
   1.253 +    #   install run-command script
   1.254 +%if "%{with_server}" == "yes"
   1.255 +    %{l_shtool} mkdir -f -p -m 755 \
   1.256 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   1.257 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   1.258 +        %{SOURCE rc.openldap} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   1.259 +%endif
   1.260 +
   1.261 +    #   install OSSP fsl configuration
   1.262 +%if "%{with_server}" == "yes"
   1.263 +    %{l_shtool} mkdir -f -p -m 755 \
   1.264 +        $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   1.265 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
   1.266 +        %{SOURCE fsl.openldap} \
   1.267 +        $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   1.268 +%endif
   1.269 +
   1.270 +    #   install pkg-config configuration
   1.271 +    %{l_shtool} mkdir -f -p -m 755 \
   1.272 +        $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig
   1.273 +    libs="-lldap -llber"
   1.274 +%if "%{with_sasl}" == "yes"
   1.275 +    libs="$libs -lsasl2"
   1.276 +%endif
   1.277 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
   1.278 +        -e "s;@version@;%{version};" \
   1.279 +        -e "s;@libs@;$libs;" \
   1.280 +        %{SOURCE openldap.pc} \
   1.281 +        $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
   1.282 +
   1.283 +    #   optionally remove server-components
   1.284 +%if "%{with_server}" != "yes"
   1.285 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/schema
   1.286 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/slapd.conf
   1.287 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/sbin
   1.288 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/libexec/openldap
   1.289 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/include/slapi-plugin.h
   1.290 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man5/slap*
   1.291 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/slap*
   1.292 +%endif
   1.293 +
   1.294 +    #   determine installation files
   1.295 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   1.296 +        %{l_files_std} \
   1.297 +%if "%{with_server}" == "yes"
   1.298 +        '%config %{l_prefix}/etc/fsl/fsl.openldap' \
   1.299 +        '%config %{l_prefix}/etc/openldap/schema/*.schema' \
   1.300 +        '%config %{l_prefix}/etc/openldap/schema/*.ldif' \
   1.301 +%endif
   1.302 +        '%config %{l_prefix}/etc/openldap/*.conf'
   1.303 +
   1.304 +%files -f files
   1.305 +
   1.306 +%clean
   1.307 +    rm -rf $RPM_BUILD_ROOT
   1.308 +
   1.309 +%pre
   1.310 +%if "%{with_server}" == "yes"
   1.311 +    #   before upgrade, save status and stop service
   1.312 +    [ $1 -eq 2 ] || exit 0
   1.313 +    eval `%{l_rc} openldap status 2>/dev/null | tee %{l_tmpfile}`
   1.314 +    %{l_rc} openldap stop 2>/dev/null
   1.315 +    exit 0
   1.316 +%endif
   1.317 +
   1.318 +%post
   1.319 +    #   after upgrade, restore status
   1.320 +%if "%{with_server}" == "yes"
   1.321 +    [ $1 -eq 2 ] || exit 0
   1.322 +    { eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1
   1.323 +    [ ".$openldap_active" = .yes ] && %{l_rc} openldap start
   1.324 +    exit 0
   1.325 +%endif
   1.326 +
   1.327 +%preun
   1.328 +    #   before erase, stop service and remove log files
   1.329 +%if "%{with_server}" == "yes"
   1.330 +    [ $1 -eq 0 ] || exit 0
   1.331 +    %{l_rc} openldap stop 2>/dev/null
   1.332 +    rm -f $RPM_INSTALL_PREFIX/var/openldap/openldap.log* >/dev/null 2>&1 || true
   1.333 +    exit 0
   1.334 +%endif
   1.335 +

mercurial