povray.SlackBuild 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. #!/bin/bash
  2. # Slackware build script for povray:
  3. # the Persistence of Vision Raytracer
  4. # Maintainer: Klaatu <klaatu@member.fsf.org>
  5. # Thanks to Franzen
  6. # Copyright 2009,2011,2013 Niels Horn, Rio de Janeiro, RJ, Brazil
  7. # All rights reserved.
  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. cd $(dirname $0) ; CWD=$(pwd)
  25. PRGNAM=povray
  26. SRCNAM=povunix
  27. VERSION=${VERSION:-3.8.0_beta.2}
  28. SRCVER=${SRCVER:-v3.8.0-beta.2}
  29. BUILD=${BUILD:-1}
  30. TAG=${TAG:-_SBo}
  31. PKGTYPE=${PKGTYPE:-tgz}
  32. DOCDIR=${DOCDIR:-/usr/doc}
  33. MANDIR=${MANDIR:-/usr/man}
  34. # Short version number is generated during compilation
  35. SHORTVER=$( echo $VERSION | cut -f1-2 -d. )
  36. if [ -z "$ARCH" ]; then
  37. case "$( uname -m )" in
  38. i?86) ARCH=i586 ;;
  39. arm*) ARCH=arm ;;
  40. *) ARCH=$( uname -m ) ;;
  41. esac
  42. fi
  43. # If PRINT_PACKAGE_NAME is set, print the name of the package
  44. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  45. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  46. exit 0
  47. fi
  48. TMP=${TMP:-/tmp/SBo}
  49. PKG=$TMP/package-$PRGNAM
  50. OUTPUT=${OUTPUT:-/tmp}
  51. POVRAY_BUILDER=${POVRAY_BUILDER:-"$(whoami) on $(hostname)"}
  52. # povray prefers -O3 to build, so we do not use the -O2 flag
  53. if [ "$ARCH" = "i586" ]; then
  54. SLKCFLAGS="-march=i586 -mtune=i686"
  55. LIBDIRSUFFIX=""
  56. elif [ "$ARCH" = "i686" ]; then
  57. SLKCFLAGS="-march=i686 -mtune=i686"
  58. LIBDIRSUFFIX=""
  59. elif [ "$ARCH" = "x86_64" ]; then
  60. SLKCFLAGS="-fPIC"
  61. LIBDIRSUFFIX="64"
  62. else
  63. SLKCFLAGS="-O2"
  64. LIBDIRSUFFIX=""
  65. fi
  66. set -e
  67. rm -rf $TMP/$PRGNAM-$VERSION $PKG
  68. mkdir -p $TMP $PKG $OUTPUT
  69. cd $TMP
  70. mkdir $PRGNAM-$VERSION
  71. tar xvf $CWD/$SRCNAM-$SRCVER-src.tar.?z* \
  72. --strip-components=1 -C $PRGNAM-$VERSION
  73. cd $PRGNAM-$VERSION
  74. chown -R root:root .
  75. find -L . \
  76. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  77. -o -perm 511 \) -exec chmod 755 {} \; -o \
  78. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  79. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  80. (
  81. cd unix
  82. # Prevent march=nativ for compatibility
  83. sed "s/native/$ARCH/g" -i configure.ac
  84. # By disabling march=nativ, compatibility-breaking optimizations may arise
  85. sed "s/ax_x86_cpuflags=.*/unset ax_x86_cpuflags/g" -i config/ax_x86_arch.m4
  86. )
  87. CXXFLAGS="$SLKCFLAGS" \
  88. ./configure \
  89. --prefix=/usr \
  90. --libdir=/usr/lib${LIBDIRSUFFIX} \
  91. --sysconfdir=/etc \
  92. --localstatedir=/var \
  93. --docdir=$DOCDIR \
  94. --mandir=$MANDIR \
  95. --build=$ARCH-slackware-linux \
  96. LIBS="-lboost_system -lboost_thread" \
  97. COMPILED_BY="$POVRAY_BUILDER"
  98. make
  99. make install DESTDIR=$PKG
  100. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  101. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  102. find $PKG/$MANDIR -type f -exec gzip -9 {} \;
  103. for i in $( find $PKG/$MANDIR -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  104. # Rename configuration files to .new, will be checked by doinst.sh
  105. mv $PKG/etc/$PRGNAM/$SHORTVER/$PRGNAM.conf \
  106. $PKG/etc/$PRGNAM/$SHORTVER/$PRGNAM.conf.new
  107. mv $PKG/etc/$PRGNAM/$SHORTVER/$PRGNAM.ini \
  108. $PKG/etc/$PRGNAM/$SHORTVER/$PRGNAM.ini.new
  109. # fix scripts
  110. find $PKG/usr/share/$PRGNAM-$SHORTVER/scripts/ -type f \
  111. -name "*.sh" | xargs sed -i "s/\r//"
  112. # ./configure ignores DOCDIR; move docs manually
  113. if [ "$DOCDIR" != "/usr/share/doc" ]; then
  114. mkdir -p $PKG/$DOCDIR/$PRGNAM-$VERSION
  115. mv $PKG/usr/share/doc/$PRGNAM-$SHORTVER $PKG/$DOCDIR/$PRGNAM-$VERSION
  116. rmdir $PKG/usr/share/doc
  117. fi
  118. cp -a COPYING INSTALL AUTHORS changes.txt revision.txt \
  119. README.md kde_install.sh $PKG/$DOCDIR/$PRGNAM-$VERSION
  120. find $PKG/$DOCDIR/$PRGNAM-$VERSION -type f -exec chmod 644 {} \;
  121. cat $CWD/$PRGNAM.SlackBuild > $PKG/$DOCDIR/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  122. mkdir -p $PKG/install
  123. cat $CWD/slack-desc > $PKG/install/slack-desc
  124. sed "s,@VERSION@,$VERSION,g" $CWD/doinst.sh > $PKG/install/doinst.sh
  125. cd $PKG
  126. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE