Browse Source

make build procedure more modular and cleanup some parts of the packaging

Ralf S. Engelschall 20 years ago
parent
commit
4b6c1d267e
1 changed files with 71 additions and 64 deletions
  1. 71 64
      openldap/openldap.spec

+ 71 - 64
openldap/openldap.spec

@@ -33,7 +33,7 @@ Class:        BASE
 Group:        Database
 License:      GPL
 Version:      2.3.14
-Release:      20051224
+Release:      20051225
 
 #   package options
 %option       with_fsl   yes
@@ -84,74 +84,83 @@ AutoReqProv:  no
     %patch -p0
 
 %build
-    #   configure toolkit
-    #   (1. use hard-links)
-    #   (2. make sure our Berkeley-DB is picked up first)
-    %{l_shtool} subst \
-        -e 's;ln -s;ln;g' \
-        -e 's;-ldb42;-ldb;g' \
-        -e 's;-ldb43;-ldb;g' \
-        -e 's;<db\.h>;"db.h";g' \
-        configure
+    #   configuration: standard build flags
+    export CC="%{l_cc}"
+    export CFLAGS="%{l_cflags -O}"
+    export CPPFLAGS="%{l_cppflags}"
+    export LDFLAGS="%{l_ldflags}"
+    export LIBS=""
+    export ARGS=""
+    ARGS="$ARGS --prefix=%{l_prefix}"
+    ARGS="$ARGS --libexecdir=%{l_prefix}/libexec/openldap"
+    ARGS="$ARGS --localstatedir=%{l_prefix}/var/openldap"
+    ARGS="$ARGS --enable-syslog"
+    ARGS="$ARGS --with-readline"
+    ARGS="$ARGS --with-tls"
+    ARGS="$ARGS --disable-dynamic"
+    ARGS="$ARGS --disable-shared"
+    ARGS="$ARGS --disable-modules"
+    ARGS="$ARGS --enable-ldbm"
+    ARGS="$ARGS --enable-ldbm-api=berkeley"
+    ARGS="$ARGS --enable-ldbm-type=btree"
+    ARGS="$ARGS --enable-bdb"
+    ARGS="$ARGS --enable-rewrite"
+    ARGS="$ARGS --enable-hdb"
+    ARGS="$ARGS --enable-ldap"
+    ARGS="$ARGS --enable-meta"
+    ARGS="$ARGS --enable-monitor"
+    ARGS="$ARGS --enable-dnssrv"
+    ARGS="$ARGS --enable-null"
+    ARGS="$ARGS --enable-shell"
+    ARGS="$ARGS --with-dyngroup"
+    ARGS="$ARGS --with-proxycache"
+    ARGS="$ARGS --enable-slurpd"
+
+    #   configuration: force to use OSSP fsl
+    LDFLAGS="$LDFLAGS %{l_fsl_ldflags}"
+    LIBS="$LIBS %{l_fsl_libs}"
+
+    #   configuration: force to use GNU pth
+    CFLAGS="$CFLAGS `%{l_prefix}/bin/pth-config --cflags`"
+    CPPFLAGS="$CPPFLAGS -I`%{l_prefix}/bin/pth-config --includedir`"
+    LDFLAGS="$LDFLAGS `%{l_prefix}/bin/pth-config --ldflags`"
+    LIBS="`%{l_prefix}/bin/pth-config --libs` $LIBS"
+    ARGS="$ARGS --with-threads=pth"
+
+    #   configuration: optional SASL support
 %if "%{with_sasl}" == "yes"
-    #   hard-code use of SASL2 library
     ( echo "ac_cv_lib_sasl2_sasl_client_init=yes"
     ) >config.cache
-    cf="%{l_cppflags sasl}"
-%else
-    cf="%{l_cppflags}"
-%endif
-    LOCLIBS=""
-    case "%{l_platform -t}" in
-        *-sunos* )
-            LOCLIBS="-lrt"
-        ;;
-    esac
-    CC="%{l_cc}" \
-    CFLAGS="%{l_cflags -O} `%{l_prefix}/bin/pth-config --cflags`" \
-    CPPFLAGS="$cf -I`%{l_prefix}/bin/pth-config --includedir`" \
-    LDFLAGS="%{l_ldflags} `%{l_prefix}/bin/pth-config --ldflags` %{l_fsl_ldflags}" \
-    LIBS="`%{l_prefix}/bin/pth-config --libs` %{l_fsl_libs} $LOCLIBS" \
-    ./configure \
-        --cache-file=./config.cache \
-        --prefix=%{l_prefix} \
-        --libexecdir=%{l_prefix}/libexec/openldap \
-        --localstatedir=%{l_prefix}/var/openldap \
-        --enable-syslog \
-        --with-readline \
-        --with-tls \
-%if "%{with_sasl}" == "yes"
-        --with-cyrus-sasl \
-        --enable-spasswd \
+    CPPFLAGS="%{l_cppflags sasl} $CPPFLAGS"
+    ARGS="$ARGS --with-cyrus-sasl --enable-spasswd"
 %else
-        --without-cyrus-sasl \
-        --disable-spasswd \
+    ARGS="$ARGS --without-cyrus-sasl --disable-spasswd"
 %endif
+
+    #   configuration: optional crypt(3) support
 %if "%{with_crypt}" == "yes"
-        --enable-crypt \
+    ARGS="$ARGS --enable-crypt"
 %endif
-        --disable-dynamic \
-        --disable-shared \
-        --disable-modules \
-        --enable-rewrite \
-        --enable-ldbm \
-        --enable-ldbm-api=berkeley \
-        --enable-ldbm-type=btree \
-        --enable-bdb \
-        --enable-hdb \
-        --enable-ldap \
-        --enable-meta \
-        --enable-monitor \
-        --enable-dnssrv \
-        --enable-null \
-        --enable-shell \
+
+    #   configuration: optional Perl support
 %if "%{with_perl}" == "yes"
-        --enable-perl \
+    ARGS="$ARGS --enable-perl"
 %endif
-        --with-dyngroup \
-        --with-proxycache \
-        --with-threads=pth \
-        --enable-slurpd
+
+    #   configuration: special platform support
+    case "%{l_platform -t}" in
+        *-sunos* ) LIBS="$LIBS -lrt" ;;
+    esac
+
+    #   configuration: use hard-links and make sure our Berkeley-DB is picked up first
+    %{l_shtool} subst \
+        -e 's;ln -s;ln;g' \
+        -e 's;-ldb4[234];-ldb;g' \
+        -e 's;<db\.h>;"db.h";g' \
+        configure
+
+    #   configuration
+    ./configure --cache-file=./config.cache $ARGS
 
     #   build toolkit
     %{l_make} %{l_mflags} depend
@@ -160,8 +169,6 @@ AutoReqProv:  no
 %install
     #   install toolkit
     rm -rf $RPM_BUILD_ROOT
-    %{l_shtool} mkdir -f -p -m 755 \
-        $RPM_BUILD_ROOT%{l_prefix}/var/openldap
     %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
 
     #   post adjustment: remove extra files
@@ -200,7 +207,7 @@ AutoReqProv:  no
     libs="$libs -lsasl2"
 %endif
     %{l_shtool} install -c -m 644 %{l_value -s -a} \
-        -e 's;@version@;%{version};' \
+        -e "s;@version@;%{version};" \
         -e "s;@libs@;$libs;" \
         %{SOURCE openldap.pc} \
         $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
@@ -226,8 +233,8 @@ AutoReqProv:  no
     exit 0
 
 %post
-    [ $1 -eq 2 ] || exit 0
     #   after upgrade, restore status
+    [ $1 -eq 2 ] || exit 0
     { eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1
     [ ".$openldap_active" = .yes ] && %{l_rc} openldap start
     exit 0