ldapvi.SlackBuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #!/bin/bash
  2. # Slackware build script for ldapvi
  3. # Copyright (c) 2009,2011, Tom Canich, State College, Pennsylvania, USA
  4. # All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions
  8. # are met:
  9. # * Redistributions of source code must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. # * Redistributions in binary form must reproduce the above
  12. # copyright notice, this list of conditions and the following
  13. # disclaimer in the documentation and/or other materials provided
  14. # with the distribution.
  15. # * Neither the name of Tom Canich nor the names of other
  16. # contributors may be used to endorse or promote products derived
  17. # from this software without specific prior written permission.
  18. #
  19. # THIS SOFTWARE IS PROVIDED BY Tom Canich ''AS IS'' AND ANY
  20. # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  22. # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Tom Canich BE LIABLE FOR
  23. # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24. # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  25. # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  26. # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  27. # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  28. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  29. # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. cd $(dirname $0) ; CWD=$(pwd)
  31. PRGNAM=ldapvi
  32. VERSION=${VERSION:-1.7}
  33. BUILD=${BUILD:-1}
  34. TAG=${TAG:-_SBo}
  35. PKGTYPE=${PKGTYPE:-tgz}
  36. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  37. # the name of the created package would be, and then exit. This information
  38. # could be useful to other scripts.
  39. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  40. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  41. exit 0
  42. fi
  43. TMP=${TMP:-/tmp/SBo}
  44. PKG=$TMP/package-$PRGNAM
  45. OUTPUT=${OUTPUT:-/tmp}
  46. if [ -z "$ARCH" ]; then
  47. case "$( uname -m )" in
  48. i?86) ARCH=i486 ;;
  49. arm*) ARCH=arm ;;
  50. *) ARCH=$( uname -m ) ;;
  51. esac
  52. fi
  53. if [ "$ARCH" = "i486" ]; then
  54. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  55. LIBDIRSUFFIX=""
  56. elif [ "$ARCH" = "i686" ]; then
  57. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  58. LIBDIRSUFFIX=""
  59. elif [ "$ARCH" = "x86_64" ]; then
  60. SLKCFLAGS="-O2 -fPIC"
  61. LIBDIRSUFFIX="64"
  62. fi
  63. set -e
  64. rm -rf $PKG
  65. mkdir -p $TMP $PKG $OUTPUT
  66. cd $TMP
  67. rm -rf $PRGNAM-$VERSION
  68. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  69. cd $PRGNAM-$VERSION
  70. patch -p0 < $CWD/ldapvi_getline.patch
  71. CFLAGS="$SLKCFLAGS" \
  72. CXXFLAGS="$SLKCFLAGS" \
  73. ./configure \
  74. --prefix=/usr \
  75. --libdir=/usr/lib${LIBDIRSUFFIX} \
  76. --sysconfdir=/etc \
  77. --localstatedir=/var \
  78. --mandir=/usr/man \
  79. --docdir=/usr/doc/$PRGNAM-$VERSION \
  80. --build=$ARCH-slackware-linux
  81. make
  82. # Upstream install target doesn't honor docdir or DESTDIR
  83. # Patch has been submitted to upstream vendor.
  84. # Rolling our own... TC
  85. install -d -m 0755 $PKG/usr/bin $PKG/usr/man/man1 $PKG/usr/doc/$PRGNAM-$VERSION
  86. install -m 0755 ldapvi $PKG/usr/bin
  87. install -m 0644 ldapvi.1 $PKG/usr/man/man1
  88. install -m 0644 \
  89. manual/manual.css manual/manual.xml manual/bg.png manual/html.xsl \
  90. $PKG/usr/doc/$PRGNAM-$VERSION
  91. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  92. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  93. find $PKG/usr/man -type f -exec gzip -9 {} \;
  94. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  95. cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README
  96. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  97. mkdir -p $PKG/install
  98. cat $CWD/slack-desc > $PKG/install/slack-desc
  99. cd $PKG
  100. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE