Advertisement
Guest User

zlib.SlackBuild

a guest
Oct 12th, 2010
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.07 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Copyright 2005-2009  Patrick J. Volkerding, Sebeka, MN, 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.  
  23.  
  24. VERSION=1.2.5
  25. ARCH=${ARCH:-i486}
  26. BUILD=${BUILD:-1}
  27.  
  28. CWD=$(pwd)
  29. TMP=${TMP:-/tmp}
  30. PKG=$TMP/package-zlib
  31.  
  32. if [ "$ARCH" = "i386" ]; then
  33.   SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
  34.   LIBDIRSUFFIX=""
  35. elif [ "$ARCH" = "i486" ]; then
  36.   SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  37.   LIBDIRSUFFIX=""
  38. elif [ "$ARCH" = "i686" ]; then
  39.     SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  40.     LIBDIRSUFFIX=""
  41. elif [ "$ARCH" = "s390" ]; then
  42.   SLKCFLAGS="-O2"
  43.   LIBDIRSUFFIX=""
  44. elif [ "$ARCH" = "x86_64" ]; then
  45.   SLKCFLAGS="-O2 -fPIC"
  46.   LIBDIRSUFFIX="64"
  47. else
  48.   SLKCFLAGS="-O2"
  49.   LIBDIRSUFFIX=""
  50. fi
  51.  
  52. rm -rf $PKG
  53. mkdir -p $TMP $PKG
  54.  
  55. cd $TMP
  56. rm -rf zlib-$VERSION
  57. tar xjvf $CWD/zlib-$VERSION.tar.bz2
  58. cd zlib-$VERSION
  59. chown -R root:root .
  60. find . \
  61.   \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  62.   -exec chmod 755 {} \; -o \
  63.   \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  64.   -exec chmod 644 {} \;
  65.  
  66. CFLAGS="$SLKCFLAGS" \
  67. ./configure \
  68.   --prefix=/usr
  69. make clean
  70. make || exit 1
  71. CFLAGS="$SLKCFLAGS" \
  72. ./configure \
  73.   --prefix=/usr \
  74.   --libdir=/usr/lib${LIBDIRSUFFIX} \
  75.   --shared
  76. make || exit 1
  77. mkdir -p $PKG/usr/include
  78. cp -a zlib.h zconf.h $PKG/usr/include
  79. chmod 644 $PKG/usr/include/*
  80. mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}
  81. cp -a libz.a libz.so* $PKG/usr/lib${LIBDIRSUFFIX}
  82. chmod 755 $PKG/usr/lib${LIBDIRSUFFIX}/*
  83. chmod 644 $PKG/usr/lib${LIBDIRSUFFIX}/libz.a
  84. mkdir -p $PKG/usr/man/man3
  85. cat zlib.3 | gzip -9c > $PKG/usr/man/man3/zlib.3.gz
  86. ( cd $PKG
  87.   find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  88.   find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  89. )
  90. mkdir -p $PKG/usr/doc/zlib-$VERSION
  91. cp -a \
  92.   ChangeLog FAQ INDEX README \
  93.   $PKG/usr/doc/zlib-$VERSION
  94. mkdir -p $PKG/install
  95. cat $CWD/slack-desc > $PKG/install/slack-desc
  96.  
  97. cd $PKG
  98. makepkg -l y -c n $TMP/zlib-$VERSION-$ARCH-$BUILD.txz
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement