xplanet.SlackBuild 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/bin/bash
  2. # Written by Benjamin Trigona-Harany <slackbuilds@jaxartes.net>
  3. # Based on http://slackbuilds.org/template.SlackBuild
  4. cd $(dirname $0) ; CWD=$(pwd)
  5. PRGNAM=xplanet
  6. VERSION=${VERSION:-1.3.1}
  7. BUILD=${BUILD:-1}
  8. TAG=${TAG:-_SBo}
  9. PKGTYPE=${PKGTYPE:-tgz}
  10. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  11. # the name of the created package would be, and then exit. This information
  12. # could be useful to other scripts.
  13. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  14. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  15. exit 0
  16. fi
  17. TMP=${TMP:-/tmp/SBo}
  18. PKG=$TMP/package-$PRGNAM
  19. OUTPUT=${OUTPUT:-/tmp}
  20. if [ -z "$ARCH" ]; then
  21. case "$( uname -m )" in
  22. i?86) export ARCH=i586 ;;
  23. arm*) export ARCH=arm ;;
  24. *) export ARCH=$( uname -m ) ;;
  25. esac
  26. fi
  27. if [ "$ARCH" = "i586" ]; then
  28. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  29. LIBDIRSUFFIX=""
  30. elif [ "$ARCH" = "i686" ]; then
  31. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  32. LIBDIRSUFFIX=""
  33. elif [ "$ARCH" = "x86_64" ]; then
  34. SLKCFLAGS="-O2 -fPIC"
  35. LIBDIRSUFFIX="64"
  36. else
  37. SLKCFLAGS="-O2"
  38. LIBDIRSUFFIX=""
  39. fi
  40. set -e
  41. rm -rf $PKG
  42. mkdir -p $TMP $PKG $OUTPUT
  43. cd $TMP
  44. rm -rf $PRGNAM-$VERSION
  45. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  46. cd $PRGNAM-$VERSION
  47. chown -R root:root .
  48. find -L . \
  49. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  50. -o -perm 511 \) -exec chmod 755 {} \; -o \
  51. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  52. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  53. patch -p1 < $CWD/null-comparison.patch
  54. # Patch for giflib 5.x from Arch Linux (thanks!)
  55. # https://projects.archlinux.org/svntogit/community.git/plain/trunk/giflib6.patch?h=packages/xplanet
  56. patch -p1 < $CWD/giflib6.patch
  57. CFLAGS="$SLKCFLAGS" \
  58. CXXFLAGS="$SLKCFLAGS" \
  59. ./configure \
  60. --prefix=/usr \
  61. --libdir=/usr/lib${LIBDIRSUFFIX} \
  62. --sysconfdir=/etc \
  63. --localstatedir=/var \
  64. --mandir=/usr/man \
  65. --docdir=/usr/doc/$PRGNAM-$VERSION \
  66. --build=$ARCH-slackware-linux
  67. make install DESTDIR=$PKG
  68. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  69. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  70. find $PKG/usr/man -type f -exec gzip -9 {} \;
  71. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  72. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  73. cp -a \
  74. README TODO AUTHORS COPYING NEWS ChangeLog \
  75. $PKG/usr/doc/$PRGNAM-$VERSION
  76. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  77. mkdir -p $PKG/install
  78. cat $CWD/slack-desc > $PKG/install/slack-desc
  79. cd $PKG
  80. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE