openldap/openldap.spec

Sat, 04 Feb 2012 20:20:10 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 04 Feb 2012 20:20:10 +0200
changeset 586
e10b124b2f21
parent 380
4f3b1ee715dd
child 587
d0df67c21897
permissions
-rw-r--r--

Update version, adapt patch code, and correct typical german english mistakes.

     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.29
    35 Release:      20120208
    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 --disable-dynamic"
   127     ARGS="$ARGS --disable-shared"
   128 %if "%{with_server}" == "yes"
   129     ARGS="$ARGS --enable-slapd"
   130     ARGS="$ARGS --disable-modules"
   131     ARGS="$ARGS --enable-local"
   132     ARGS="$ARGS --enable-bdb"
   133     ARGS="$ARGS --enable-hdb"
   134     ARGS="$ARGS --enable-rewrite"
   135     ARGS="$ARGS --enable-ldap"
   136     ARGS="$ARGS --enable-meta"
   137     ARGS="$ARGS --enable-monitor"
   138     ARGS="$ARGS --enable-dnssrv"
   139     ARGS="$ARGS --enable-null"
   140     ARGS="$ARGS --enable-shell"
   141     ARGS="$ARGS --with-proxycache"
   142 %else
   143     ARGS="$ARGS --disable-slapd"
   144     ARGS="$ARGS --disable-modules"
   145 %endif
   147     #   configuration: force to use OSSP fsl
   148 %if "%{with_server}" == "yes"
   149     LDFLAGS="$LDFLAGS %{l_fsl_ldflags}"
   150     LIBS="$LIBS %{l_fsl_libs}"
   151 %endif
   153     #   configuration: force to use GNU pth if enabled
   154 %if "%{with_server}" == "yes"
   155 %if "%{with_pth}" == "yes"
   156     CFLAGS="$CFLAGS `%{l_prefix}/bin/pth-config --cflags`"
   157     CPPFLAGS="$CPPFLAGS -I`%{l_prefix}/bin/pth-config --includedir`"
   158     LDFLAGS="$LDFLAGS `%{l_prefix}/bin/pth-config --ldflags`"
   159     LIBS="`%{l_prefix}/bin/pth-config --libs` $LIBS"
   160     ARGS="$ARGS --with-threads=pth"
   161     ( echo "ac_cv_header_sys_devpoll_h=no"
   162       echo "ac_cv_header_sys_epoll_h=no"
   163     ) >>config.cache
   164 %else
   165 %if "%{with_pthreads}" == "yes"
   166     ARGS="$ARGS --with-threads=posix"
   167 %else
   168     ARGS="$ARGS --with-threads=no"
   169 %endif
   170 %endif
   171 %endif
   173     #   configuration: optional overlay support
   174 %if "%{with_server}" == "yes" && "%{with_overlays}" == "yes"
   175     ARGS="$ARGS --enable-overlays=yes"
   176 %endif
   178     #   configuration: optional SASL support
   179 %if "%{with_sasl}" == "yes"
   180     ( echo "ac_cv_lib_sasl2_sasl_client_init=yes"
   181     ) >>config.cache
   182     CPPFLAGS="%{l_cppflags sasl} $CPPFLAGS"
   183     ARGS="$ARGS --with-cyrus-sasl --enable-spasswd"
   184 %else
   185     ARGS="$ARGS --without-cyrus-sasl --disable-spasswd"
   186 %endif
   188     #   configuration: optional crypt(3) support
   189 %if "%{with_crypt}" == "yes"
   190     ARGS="$ARGS --enable-crypt"
   191 %endif
   193     #   configuration: optional Perl support
   194 %if "%{with_server}" == "yes" && "%{with_perl}" == "yes"
   195     ARGS="$ARGS --enable-perl"
   196 %endif
   198     #   configuration: optional ODBC-based RDBMS support
   199 %if "%{with_server}" == "yes" && "%{with_odbc}" == "yes"
   200     ARGS="$ARGS --enable-sql"
   201 %endif
   203     #   configuration: special platform support
   204     case "%{l_platform -t}" in
   205         *-sunos* ) CFLAGS="$CFLAGS -D_AVL_H"; LIBS="$LIBS -lrt" ;;
   206     esac
   208     #   configuration: use hard links and make sure our Berkeley-DB is picked up first
   209     %{l_shtool} subst \
   210         -e 's;ln -s;ln;g' \
   211         -e 's;-ldb4[1-9];%{l_prefix}/lib/libdb.a;g' \
   212         -e 's;<db\.h>;"db.h";g' \
   213         configure
   215     #   configuration
   216     ./configure --cache-file=./config.cache $ARGS
   218     #   build toolkit
   219     %{l_make} %{l_mflags} depend
   220     %{l_make} %{l_mflags}
   222 %install
   223     #   clean build cruft
   224     rm -rf $RPM_BUILD_ROOT
   226     #   install toolkit
   227     %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   229     #   post adjustment: remove extra files
   230     rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/*.default
   231     rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/*/*.default
   233     #   post adjustment: move files
   234     rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/DB_CONFIG.example
   235 %if "%{with_server}" == "yes"
   236     mv  $RPM_BUILD_ROOT%{l_prefix}/var/openldap/openldap-data/DB_CONFIG.example \
   237         $RPM_BUILD_ROOT%{l_prefix}/var/openldap/openldap-data/DB_CONFIG
   238 %endif
   240     #   post adjustment: enable and correct slapd.pid
   241 %if "%{with_server}" == "yes"
   242     %{l_shtool} subst \
   243         -e 's;^[ #]*\(pidfile\).*$;\1 %{l_prefix}/var/openldap/run/slapd.pid;' \
   244         -e 's;^\(argsfile\).*$;\1 %{l_prefix}/var/openldap/run/slapd.args;' \
   245         $RPM_BUILD_ROOT%{l_prefix}/etc/openldap/slapd.conf
   246 %endif
   248     #   post adjustment: remove OSSP fsl dependency from libtool files
   249 %if "%{with_server}" == "yes"
   250     %{l_shtool} subst \
   251         -e 's;-lfsl *;;' \
   252         $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
   253 %endif
   255     #   install run-command script
   256 %if "%{with_server}" == "yes"
   257     %{l_shtool} mkdir -f -p -m 755 \
   258         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   259     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   260         %{SOURCE rc.openldap} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   261 %endif
   263     #   install OSSP fsl configuration
   264 %if "%{with_server}" == "yes"
   265     %{l_shtool} mkdir -f -p -m 755 \
   266         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   267     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   268         %{SOURCE fsl.openldap} \
   269         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   270 %endif
   272     #   install pkg-config configuration
   273     %{l_shtool} mkdir -f -p -m 755 \
   274         $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig
   275     libs="-lldap -llber"
   276 %if "%{with_sasl}" == "yes"
   277     libs="$libs -lsasl2"
   278 %endif
   279     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   280         -e "s;@version@;%{version};" \
   281         -e "s;@libs@;$libs;" \
   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
   309     rm -rf $RPM_BUILD_ROOT
   311 %pre
   312 %if "%{with_server}" == "yes"
   313     #   before upgrade, save status and stop service
   314     [ $1 -eq 2 ] || exit 0
   315     eval `%{l_rc} openldap status 2>/dev/null | tee %{l_tmpfile}`
   316     %{l_rc} openldap stop 2>/dev/null
   317     exit 0
   318 %endif
   320 %post
   321     #   after upgrade, restore status
   322 %if "%{with_server}" == "yes"
   323     [ $1 -eq 2 ] || exit 0
   324     { eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1
   325     [ ".$openldap_active" = .yes ] && %{l_rc} openldap start
   326     exit 0
   327 %endif
   329 %preun
   330     #   before erase, stop service and remove log files
   331 %if "%{with_server}" == "yes"
   332     [ $1 -eq 0 ] || exit 0
   333     %{l_rc} openldap stop 2>/dev/null
   334     rm -f $RPM_INSTALL_PREFIX/var/openldap/openldap.log* >/dev/null 2>&1 || true
   335     exit 0
   336 %endif

mercurial