openldap/openldap.spec

Tue, 31 Jul 2012 12:27:54 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 31 Jul 2012 12:27:54 +0200
changeset 429
b363f8ef6dcb
parent 195
8f6a78b621a9
child 586
e10b124b2f21
permissions
-rw-r--r--

Correct '-rpath /opkg/lib64' because OpenPKG fails to support multiarch.

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

mercurial