Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #!/bin/sh
  2.  
  3. # Copyright 2008, 2009  Patrick J. Volkerding, Sebeka, Minnesota, USA
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. #    notice, this list of conditions and the following disclaimer.
  11. #
  12. #  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
  13. #  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
  15. #  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. #  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. #  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. #  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. #  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. #  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. #  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. # By Thiago dos Santos Laurito <thiago.laurito@gmail.com> <slackdummies.blogspot.com>
  23.  
  24. # OpenLDAP
  25.  
  26.  
  27. VERSION=2.4.23
  28. ARCH=${ARCH:-i486}
  29. BUILD=${BUILD:-1lau}
  30.  
  31. if [ "$ARCH" = "i486" ]; then
  32.   SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  33.   LIBDIRSUFFIX=""
  34. elif [ "$ARCH" = "s390" ]; then
  35.   SLKCFLAGS="-O2"
  36.   LIBDIRSUFFIX=""
  37. elif [ "$ARCH" = "x86_64" ]; then
  38.   SLKCFLAGS="-O2 -fPIC"
  39.   LIBDIRSUFFIX="64"
  40. fi
  41.  
  42. CWD=$(pwd)
  43. TMP=${TMP:-/tmp}
  44. PKG=$TMP/package-openldap
  45.  
  46. rm -rf $PKG
  47. mkdir -p $TMP $PKG
  48. cd $TMP
  49. rm -rf openldap-$VERSION
  50. tar xzvf $CWD/openldap-$VERSION.tgz || exit 1
  51. cd openldap-$VERSION
  52. chown -R root:root .
  53. find . -perm 777 -exec chmod 755 {} \;
  54. find . -perm 664 -exec chmod 644 {} \;
  55. CFLAGS="-D_GNU_SOURCE $SLKCFLAGS" \
  56. ./configure \
  57.   --prefix=/usr \
  58.   --libdir=/usr/lib${LIBDIRSUFFIX} \
  59.   --localstatedir=/var/lib \
  60.   --sysconfdir=/etc \
  61.   --enable-overlays \
  62.   --enable-accesslog \
  63.   --enable-auditlog \
  64.   --enable-collect \
  65.   --enable-constraint \
  66.   --enable-dds \
  67.   --enable-deref \
  68.   --enable-dyngroup \
  69.   --enable-dynlist \
  70.   --enable-memberof \
  71.   --enable-ppolicy \
  72.   --enable-proxycache \
  73.   --enable-refint \
  74.   --enable-retcode \
  75.   --enable-rwm \
  76.   --enable-seqmode \
  77.   --enable-syncprov \
  78.   --enable-translucent \
  79.   --enable-uniq \
  80.   --enable-valsort \
  81.   --enable-debug \
  82.   --enable-syslog \
  83.   --enable-dynamic \
  84.   --enable-local \
  85.   --enable-proctitle \
  86.   --enable-shared \
  87.   --enable-slapd \
  88.   --enable-slurpd \
  89.   --enable-monitor \
  90.   --enable-crypt \
  91.   --disable-static \
  92.   --with-cyrus-sasl \
  93.   --with-tls \
  94.   --with-readline \
  95.   --with-threads
  96.  
  97. make depend || exit 1
  98. make -j4 || exit 1
  99. make test || exit 1
  100. make install DESTDIR=$PKG || exit 1
  101.  
  102. rm -f $PKG/etc/openldap/ldap.conf.default
  103. mv $PKG/etc/openldap/ldap.conf $PKG/etc/openldap/ldap.conf.new
  104. cat << EOF >> $PKG/etc/openldap/ldap.conf.new
  105.  
  106. # In order to avoid problems with self-signed certificates using TLS:
  107. # "TLS certificate verification: Error, self signed certificate"
  108. # See also 'man ldap.conf' or http://www.openldap.org/doc/admin/tls.html
  109. TLS_REQCERT allow
  110.  
  111. EOF
  112.  
  113. rm -f $PKG/etc/openldap/slapd.conf.default
  114. mv $PKG/etc/openldap/slapd.conf $PKG/etc/openldap/slapd.conf.new
  115.  
  116. mkdir -p $PKG/usr/doc/openldap-$VERSION
  117. cp -a \
  118.   ANNOUNCEMENT CHANGES COPYRIGHT LICENSE README \
  119.   $PKG/usr/doc/openldap-$VERSION
  120.  
  121. # Remove man pages for the servers (not currently supported or shipped...
  122. # do they even work properly without the evil PAM?)
  123. find $PKG/usr/man -name slap* -exec rm -f {} \;
  124. find $PKG/usr/man -name slurp* -exec rm -f {} \;
  125. find $PKG/usr/man -type d -empty -exec rmdir {} \;
  126.  
  127. # Compress and if needed symlink the man pages:
  128. if [ -d $PKG/usr/man ]; then
  129.   ( cd $PKG/usr/man
  130.     for manpagedir in $(find . -type d -name "man*") ; do
  131.       ( cd $manpagedir
  132.         for eachpage in $( find . -type l -maxdepth 1) ; do
  133.           ln -s $( readlink $eachpage ).gz $eachpage.gz
  134.           rm $eachpage
  135.         done
  136.         gzip -9 *.?
  137.       )
  138.     done
  139.   )
  140. fi
  141.  
  142. # Strip binaries
  143. ( cd $PKG
  144.   find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  145.   find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  146. )
  147.  
  148. mkdir -p $PKG/etc/rc.d
  149. cat $CWD/rc.slapd > $PKG/etc/rc.d/rc.slapd.new
  150.  
  151. mkdir $PKG/install
  152. cat $CWD/slack-desc > $PKG/install/slack-desc
  153. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  154.  
  155. cd $PKG
  156. makepkg -l y -c n $TMP/openldap-$VERSION-$ARCH-$BUILD.txz