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.

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

mercurial