povray.SlackBuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #!/bin/sh
  2. # Slackware build script for povray:
  3. # the Persistence of Vision Raytracer
  4. # Copyright 2009,2011 Niels Horn, Rio de Janeiro, RJ, Brazil
  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. # revision date 2011/12/09
  24. PRGNAM=povray
  25. VERSION=${VERSION:-3.7.0.RC3}
  26. BUILD=${BUILD:-1}
  27. TAG=${TAG:-_SBo}
  28. # The "short" version number is needed later:
  29. SHORT_VERSION=$( echo $VERSION | cut -f1-2 -d. )
  30. if [ -z "$ARCH" ]; then
  31. case "$( uname -m )" in
  32. i?86) ARCH=i486 ;;
  33. arm*) ARCH=arm ;;
  34. *) ARCH=$( uname -m ) ;;
  35. esac
  36. fi
  37. CWD=$(pwd)
  38. TMP=${TMP:-/tmp/SBo}
  39. PKG=$TMP/package-$PRGNAM
  40. OUTPUT=${OUTPUT:-/tmp}
  41. POVRAY_BUILDER=${POVRAY_BUILDER:-"$(whoami) on $(hostname)"}
  42. # povray prefers -O3 to build, so we do not use the -O2 flag
  43. if [ "$ARCH" = "i486" ]; then
  44. SLKCFLAGS="-march=i486 -mtune=i686"
  45. LIBDIRSUFFIX=""
  46. elif [ "$ARCH" = "i686" ]; then
  47. SLKCFLAGS="-march=i686 -mtune=i686"
  48. LIBDIRSUFFIX=""
  49. elif [ "$ARCH" = "x86_64" ]; then
  50. SLKCFLAGS="-fPIC"
  51. LIBDIRSUFFIX="64"
  52. else
  53. SLKCFLAGS="-O2"
  54. LIBDIRSUFFIX=""
  55. fi
  56. set -e
  57. rm -rf $TMP/$PRGNAM-$VERSION $PKG
  58. mkdir -p $TMP $PKG $OUTPUT
  59. cd $TMP
  60. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  61. cd $PRGNAM-$VERSION
  62. chown -R root:root .
  63. chmod -R u+w,go+r-w,a-s .
  64. # Need to specify boost_thread for 64-bits
  65. # (upstream is aware of this glitch)
  66. if [ "$ARCH" = "x86_64" ]; then
  67. BOOST64="--with-boost-thread=boost_thread"
  68. else
  69. BOOST64=""
  70. fi
  71. CXXFLAGS="$SLKCFLAGS" \
  72. ./configure \
  73. --prefix=/usr \
  74. --libdir=/usr/lib${LIBDIRSUFFIX} \
  75. --sysconfdir=/etc \
  76. --localstatedir=/var \
  77. --mandir=/usr/man \
  78. --build=$ARCH-slackware-linux \
  79. $BOOST64 \
  80. COMPILED_BY="$POVRAY_BUILDER"
  81. make
  82. make install DESTDIR=$PKG
  83. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  84. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  85. find $PKG/usr/man -type f -exec gzip -9 {} \;
  86. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  87. # Rename configuration files to .new, will be checked by doinst.sh
  88. mv $PKG/etc/$PRGNAM/$SHORT_VERSION/$PRGNAM.conf \
  89. $PKG/etc/$PRGNAM/$SHORT_VERSION/$PRGNAM.conf.new
  90. mv $PKG/etc/$PRGNAM/$SHORT_VERSION/$PRGNAM.ini \
  91. $PKG/etc/$PRGNAM/$SHORT_VERSION/$PRGNAM.ini.new
  92. # ./configure does not accept "--docdir=", so we'll move the docdir manually
  93. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  94. mv $PKG/usr/share/doc/$PRGNAM-$SHORT_VERSION/* $PKG/usr/doc/$PRGNAM-$VERSION/
  95. rm -r $PKG/usr/share/doc
  96. cp -a COPYING INSTALL $PKG/usr/doc/$PRGNAM-$VERSION
  97. find $PKG/usr/doc/$PRGNAM-$VERSION -type f -exec chmod 644 {} \;
  98. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  99. mkdir -p $PKG/install
  100. cat $CWD/slack-desc > $PKG/install/slack-desc
  101. sed "s,@VERSION@,$SHORT_VERSION,g" $CWD/doinst.sh > $PKG/install/doinst.sh
  102. cd $PKG
  103. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}