tilem2.SlackBuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #!/bin/bash
  2. # Slackbuild for tilem2
  3. # Written by JK Wood <joshuakwood@gmail.com>
  4. # Slackbuild is released under the Dog-on-Fire License:
  5. # If use of this script causes your dog to catch on fire,
  6. # you agree to send me five dollars. Or a picture
  7. # of the dog on fire.
  8. # Otherwise, you're on your own. I've tested the script
  9. # on my own computer, and it hasn't broken anything.
  10. # So if it does it on your computer, that falls in
  11. # the realm of "Not my problem."
  12. #
  13. # Of course, if you'll send a bug report to the above
  14. # email address, I may be able to see what you did
  15. # wrong and prevent it from happening in the future.
  16. # In which case, I may just send YOU five dollars.
  17. # Oh, and feel free to copy it and modify it as you
  18. # see fit. Or as I see fit. Or as I fit. Although
  19. # that is unlikely, as I am rather tall.
  20. cd $(dirname $0) ; CWD=$(pwd)
  21. PRGNAM=tilem2
  22. SRCNAM=tilem
  23. VERSION=${VERSION:-2.0}
  24. BUILD=${BUILD:-1}
  25. TAG=${TAG:-_SBo}
  26. PKGTYPE=${PKGTYPE:-tgz}
  27. if [ -z "$ARCH" ]; then
  28. case "$( uname -m )" in
  29. i?86) ARCH=i586 ;;
  30. arm*) ARCH=arm ;;
  31. *) ARCH=$( uname -m ) ;;
  32. esac
  33. fi
  34. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  35. # the name of the created package would be, and then exit. This information
  36. # could be useful to other scripts.
  37. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  38. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  39. exit 0
  40. fi
  41. TMP=${TMP:-/tmp/SBo}
  42. PKG=$TMP/package-$PRGNAM
  43. OUTPUT=${OUTPUT:-/tmp}
  44. if [ "$ARCH" = "i586" ]; then
  45. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  46. LIBDIRSUFFIX=""
  47. elif [ "$ARCH" = "i686" ]; then
  48. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  49. LIBDIRSUFFIX=""
  50. elif [ "$ARCH" = "x86_64" ]; then
  51. SLKCFLAGS="-O2 -fPIC"
  52. LIBDIRSUFFIX="64"
  53. else
  54. SLKCFLAGS="-O2"
  55. LIBDIRSUFFIX=""
  56. fi
  57. set -e
  58. rm -rf $PKG
  59. mkdir -p $TMP $PKG $OUTPUT
  60. cd $TMP
  61. rm -rf $SRCNAM-$VERSION
  62. tar xvf $CWD/$SRCNAM-$VERSION.tar.bz2
  63. cd $SRCNAM-$VERSION
  64. chown -R root:root .
  65. find -L . \
  66. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  67. -exec chmod 755 {} \; -o \
  68. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  69. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  70. # A few necessary patches
  71. # This adds -lm to the linker flags - comes from revision 661
  72. patch -p1 < $CWD/patches/add_-lm_to_libs_r661.patch
  73. # Fix a sprintf error on 64-bit - comes from
  74. # http://svn.calcforge.org/viewvc/repo-specfiles/fedora/tilem/tilem-2.0-64bit.patch
  75. patch -p1 < $CWD/patches/tilem-2.0-64bit.patch
  76. # Correct a non-fatal but annoying error in the .desktop file - comes from revision 668
  77. patch -p1 < $CWD/patches/desktop_file_fix_r668.patch
  78. # Don't force -O3
  79. sed -i 's|OPT_CFLAGS="-O3"|OPT_CFLAGS=""|' configure
  80. OPT_CFLAGS="" \
  81. CFLAGS="$SLKCFLAGS" \
  82. CXXFLAGS="$SLKCFLAGS" \
  83. ./configure \
  84. --prefix=/usr \
  85. --sysconfdir=/etc \
  86. --libdir=/usr/lib${LIBDIRSUFFIX} \
  87. --build=$ARCH-slackware-linux \
  88. make
  89. DESTDIR=$PKG make install
  90. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  91. cp -a CHANGELOG COPYING INSTALL KEYS NEWS README THANKS TODO \
  92. $PKG/usr/doc/$PRGNAM-$VERSION
  93. cp $CWD/user_manual.pdf $PKG/usr/doc/$PRGNAM-$VERSION
  94. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  95. find $PKG/usr/doc -name "Makefile" -exec rm {} \;
  96. find $PKG/usr/doc -type f -exec chmod 644 {} \;
  97. mkdir -p $PKG/install
  98. cat $CWD/slack-desc > $PKG/install/slack-desc
  99. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  100. cd $PKG
  101. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE