Advertisement
ponce

lighttpd.SlackBuild modified for user installation

Dec 9th, 2011
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.69 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Slackware build script for lighttpd
  4.  
  5. # Copyright (c) 2007 Daniel de Kok <moc.mikciat@leinad>
  6. # All rights reserved.
  7. #
  8. # Redistribution and use of this script, with or without modification, is
  9. # permitted provided that the following conditions are met:
  10. #
  11. # 1. Redistributions of this script must retain the above copyright
  12. # notice, this list of conditions and the following disclaimer.
  13. #
  14. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  15. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  16. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  17. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  18. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  20. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  21. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  22. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  23. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24.  
  25. # modified by ponce <matteo.bernardini@gmail.com> for user installation
  26. # in $MY_PREFIX
  27.  
  28. PRGNAM=lighttpd
  29. VERSION=1.4.29
  30. BUILD=${BUILD:-1}
  31. TAG=${TAG:-_custom}
  32.  
  33. MY_PREFIX=${MY_PREFIX:-/tmp/lighty}
  34.  
  35. if [ -z "$ARCH" ]; then
  36. case "$( uname -m )" in
  37. i?86) ARCH=i486 ;;
  38. arm*) ARCH=arm ;;
  39. *) ARCH=$( uname -m ) ;;
  40. esac
  41. fi
  42.  
  43. CWD=$(pwd)
  44. TMP=${TMP:-/tmp}
  45. PKGZ=$TMP/package-$PRGNAM
  46. PKG=$TMP/package-$PRGNAM/$MY_PREFIX
  47. OUTPUT=${OUTPUT:-/tmp}
  48.  
  49. if [ "$ARCH" = "i486" ]; then
  50. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  51. LIBDIRSUFFIX=""
  52. elif [ "$ARCH" = "i686" ]; then
  53. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  54. LIBDIRSUFFIX=""
  55. elif [ "$ARCH" = "x86_64" ]; then
  56. SLKCFLAGS="-O2 -fPIC"
  57. LIBDIRSUFFIX="64"
  58. else
  59. SLKCFLAGS="-O2"
  60. LIBDIRSUFFIX=""
  61. fi
  62.  
  63. set -e # Exit on most errors
  64.  
  65. rm -rf $PKGZ
  66. mkdir -p $TMP $PKG $OUTPUT
  67. cd $TMP
  68. rm -rf $PRGNAM-$VERSION
  69. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  70. cd $PRGNAM-$VERSION
  71. chmod -R u+w,go+r-w,a-s .
  72.  
  73. CFLAGS="$SLKCFLAGS" \
  74. CXXFLAGS="$SLKCFLAGS" \
  75. ./configure \
  76. --prefix=$MY_PREFIX/usr \
  77. --libdir=$MY_PREFIX/usr/lib${LIBDIRSUFFIX}/$PRGNAM \
  78. --sysconfdir=$MY_PREFIX/etc \
  79. --localstatedir=$MY_PREFIX/var \
  80. --mandir=$MY_PREFIX/usr/man \
  81. --with-pcre \
  82. --with-attr \
  83. --with-openssl \
  84. --build=$ARCH-slackware-linux
  85.  
  86. make
  87. make install-strip DESTDIR=$PKGZ
  88.  
  89. mkdir -p $PKG/var/{cache,log}/$PRGNAM
  90. chmod 0700 $PKG/var/cache/lighttpd
  91. mkdir -p $PKG/var/www/htdocs-lighttpd
  92. touch $PKG/var/log/lighttpd/{access,error}.log
  93.  
  94. # Create the default pid file directory (configurable in lighttpd.conf)
  95. mkdir -p $PKG/var/run/lighttpd
  96.  
  97. install -D -m 0755 $CWD/rc.$PRGNAM $PKG/etc/rc.d/rc.$PRGNAM
  98. install -D -m 0644 $CWD/$PRGNAM.conf $PKG/etc/$PRGNAM/$PRGNAM.conf
  99.  
  100. sed -i "s|/var/|$MY_PREFIX/var/|" $PKG/etc/rc.d/rc.$PRGNAM
  101. sed -i "s|/usr/|$MY_PREFIX/usr/|" $PKG/etc/rc.d/rc.$PRGNAM
  102. sed -i "s|/etc/|$MY_PREFIX/etc/|" $PKG/etc/rc.d/rc.$PRGNAM
  103. sed -i "s|/var/|$MY_PREFIX/var/|" $PKG/etc/$PRGNAM/$PRGNAM.conf
  104. sed -i "s|#server.port.*|server.port=1025|" $PKG/etc/$PRGNAM/$PRGNAM.conf
  105.  
  106. find $PKG/usr/man -type f -exec gzip -9 {} \;
  107.  
  108. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  109. cp -a AUTHORS COPYING INSTALL NEWS README doc/* \
  110. $PKG/usr/doc/$PRGNAM-$VERSION
  111. rm -f $PKG/usr/doc/$PRGNAM-$VERSION/Makefile*
  112. cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
  113. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  114.  
  115. cd $PKGZ
  116. tar Jcf $OUTPUT/lighttpd-user-$VERSION-$ARCH-$BUILD$TAG.txz *
  117. echo "tarball $OUTPUT/lighttpd-user-$VERSION-$ARCH-$BUILD$TAG.txz created."
  118.  
  119.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement