PageRenderTime 49ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/network/squid/squid.SlackBuild

https://bitbucket.org/yht/slackbuilds
Shell | 139 lines | 92 code | 21 blank | 26 comment | 4 complexity | 044e6be620dcd4fa80508ea46f191cd3 MD5 | raw file
Possible License(s): MIT, GPL-3.0, GPL-2.0, MPL-2.0-no-copyleft-exception
  1. #!/bin/sh
  2. # Slackware build script for squid
  3. # http://www.squid-cache.org/
  4. # Copyright 2006-2011 David Somero (dsomero@hotmail.com) Athens,TN USA
  5. # All rights reserved.
  6. #
  7. # Redistribution and use of this script, with or without modification, is
  8. # permitted provided that the following conditions are met:
  9. #
  10. # 1. Redistributions of this script must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. #
  13. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  14. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  15. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  16. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  18. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  19. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  20. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  21. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  22. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. PRGNAM=squid
  24. VERSION=3.1.12
  25. BUILD=${BUILD:-1}
  26. TAG=${TAG:-_SBo}
  27. if [ -z "$ARCH" ]; then
  28. case "$( uname -m )" in
  29. i?86) ARCH=i486 ;;
  30. arm*) ARCH=arm ;;
  31. *) ARCH=$( uname -m ) ;;
  32. esac
  33. fi
  34. CWD=$(pwd)
  35. TMP=${TMP:-/tmp/SBo}
  36. PKG=$TMP/package-$PRGNAM
  37. OUTPUT=${OUTPUT:-/tmp}
  38. SQUIDUSER=${SQUIDUSER:-nobody}
  39. SQUIDGROUP=${SQUIDGROUP:-nobody}
  40. if [ "$ARCH" = "i486" ]; then
  41. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  42. LIBDIRSUFFIX=""
  43. elif [ "$ARCH" = "i686" ]; then
  44. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  45. LIBDIRSUFFIX=""
  46. elif [ "$ARCH" = "x86_64" ]; then
  47. SLKCFLAGS="-O2 -fPIC"
  48. LIBDIRSUFFIX="64"
  49. else
  50. SLKCFLAGS="-O2"
  51. LIBDIRSUFFIX=""
  52. fi
  53. set -e
  54. rm -rf $PKG
  55. mkdir -p $TMP $PKG $OUTPUT
  56. cd $TMP
  57. rm -rf $PRGNAM-$VERSION
  58. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  59. cd $PRGNAM-$VERSION
  60. chown -R root:root .
  61. find . \
  62. \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  63. -exec chmod 755 {} \; -o \
  64. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  65. -exec chmod 644 {} \;
  66. CFLAGS="$SLKCFLAGS" \
  67. CXXFLAGS="$SLKCFLAGS" \
  68. ./configure \
  69. --prefix=/usr \
  70. --libdir=/usr/lib${LIBDIRSUFFIX} \
  71. --sysconfdir=/etc/squid \
  72. --localstatedir=/var/log/squid \
  73. --datadir=/usr/share/squid \
  74. --with-pidfile=/var/run/squid \
  75. --mandir=/usr/man \
  76. --with-logdir=/var/log/squid \
  77. --enable-snmp \
  78. --enable-auth="basic" \
  79. --enable-basic-auth-helpers="NCSA" \
  80. --enable-linux-netfilter \
  81. --enable-async-io \
  82. --build=$ARCH-slackware-linux
  83. make all
  84. make install DESTDIR=$PKG
  85. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  86. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  87. find $PKG/usr/man -type f -exec gzip -9 {} \;
  88. for i in $(find $PKG/usr/man -type l); do ln -s $(readlink $i).gz $i.gz; rm $i; done
  89. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  90. cp -a \
  91. CONTRIBUTORS COPYING COPYRIGHT CREDITS ChangeLog INSTALL \
  92. QUICKSTART README RELEASENOTES.html SPONSORS $CWD/README.SBo \
  93. $PKG/usr/doc/$PRGNAM-$VERSION
  94. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  95. chown root:root $PKG/usr/doc/$PRGNAM-$VERSION/*
  96. mkdir -p $PKG/etc/{logrotate.d,rc.d}
  97. cat $CWD/rc.squid > $PKG/etc/rc.d/rc.squid.new
  98. # Note that the .new file left hanging around in /etc/logrotate.d/ will
  99. # probably/surely make cron'd logrotations fail, but not installing it
  100. # as .new here will clobber a potentially custom file.
  101. cat $CWD/squid.logrotate > $PKG/etc/logrotate.d/squid.new
  102. mv $PKG/etc/squid/mime.conf $PKG/etc/squid/mime.conf.new
  103. mv $PKG/etc/squid/cachemgr.conf $PKG/etc/squid/cachemgr.conf.new
  104. rm $PKG/etc/squid/squid.conf
  105. cat $CWD/squid.conf > $PKG/etc/squid/squid.conf.new
  106. cat $CWD/squid.conf.documented > $PKG/etc/squid/squid.conf.documented
  107. mkdir -p $PKG/var/{cache,run}/squid
  108. chown $SQUIDUSER:$SQUIDGROUP $PKG/var/{cache,log,run}/squid
  109. ## Edit the config file to set the user and group to run as
  110. sed -i -e 's%^cache_effective_user nobody%cache_effective_user '"$SQUIDUSER"'%g' \
  111. $PKG/etc/squid/squid.conf.new
  112. sed -i -e 's%^cache_effective_group nobody%cache_effective_group '"$SQUIDGROUP"'%g' \
  113. $PKG/etc/squid/squid.conf.new
  114. mkdir -p $PKG/install
  115. cat $CWD/slack-desc > $PKG/install/slack-desc
  116. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  117. cd $PKG
  118. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}