tuxmath.SlackBuild 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #!/bin/bash
  2. # Slackware build script for tuxmath
  3. # Written by Larry Hajali <larryhaja[at]gmail[dot]com>
  4. cd $(dirname $0) ; CWD=$(pwd)
  5. PRGNAM=tuxmath
  6. VERSION=${VERSION:-2.0.3}
  7. BUILD=${BUILD:-2}
  8. TAG=${TAG:-_SBo}
  9. PKGTYPE=${PKGTYPE:-tgz}
  10. if [ -z "$ARCH" ]; then
  11. case "$( uname -m )" in
  12. i?86) ARCH=i586 ;;
  13. arm*) ARCH=arm ;;
  14. *) ARCH=$( uname -m ) ;;
  15. esac
  16. fi
  17. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  18. # the name of the created package would be, and then exit. This information
  19. # could be useful to other scripts.
  20. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  21. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  22. exit 0
  23. fi
  24. TMP=${TMP:-/tmp/SBo}
  25. PKG=$TMP/package-$PRGNAM
  26. OUTPUT=${OUTPUT:-/tmp}
  27. if [ "$ARCH" = "i586" ]; then
  28. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  29. elif [ "$ARCH" = "i686" ]; then
  30. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  31. elif [ "$ARCH" = "x86_64" ]; then
  32. SLKCFLAGS="-O2 -fPIC"
  33. fi
  34. set -e
  35. rm -rf $PKG
  36. mkdir -p $TMP $PKG $OUTPUT
  37. cd $TMP
  38. rm -rf ${PRGNAM}_w_fonts-$VERSION
  39. tar xvf $CWD/${PRGNAM}_w_fonts-$VERSION.tar.gz
  40. cd ${PRGNAM}_w_fonts-$VERSION
  41. chown -R root:root .
  42. find -L . \
  43. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  44. -exec chmod 755 {} \; -o \
  45. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  46. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  47. # Fix .desktop.
  48. sed -i -e '/^##/d' -e '/^X/d' -e 's|Math;||' $PRGNAM.desktop
  49. patch -p1 < $CWD/0001-src-menu_lan.c-Remove-unused-duplicate-lan_player_in.patch
  50. patch -p1 < $CWD/0002-rename-blits-to-tmblits.patch
  51. LDFLAGS="-std=gnu11" \
  52. CFLAGS="$SLKCFLAGS -std=gnu11 -fcommon" \
  53. CXXFLAGS="$SLKCFLAGS" \
  54. ./configure \
  55. --prefix=/usr \
  56. --localstatedir=/var \
  57. --docdir=/usr/doc/$PRGNAM-$VERSION \
  58. --disable-sdltest \
  59. --disable-dependency-tracking \
  60. --build=$ARCH-slackware-linux
  61. make
  62. make install DESTDIR=$PKG
  63. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  64. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  65. install -D -m 0644 $PRGNAM.desktop $PKG/usr/share/applications/$PRGNAM.desktop
  66. for i in 16 24 32 48 64 96 128; do
  67. convert data/images/icons/$PRGNAM.svg -resize ${i}x${i}! $PRGNAM-$i.png
  68. install -D -m 0644 $PRGNAM-$i.png \
  69. $PKG/usr/share/icons/hicolor/${i}x${i}/apps/$PRGNAM.png
  70. done
  71. install -D -m 0644 data/images/icons/$PRGNAM.svg \
  72. $PKG/usr/share/icons/hicolor/scalable/apps/$PRGNAM.svg
  73. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  74. mkdir -p $PKG/install
  75. cat $CWD/slack-desc > $PKG/install/slack-desc
  76. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  77. cd $PKG
  78. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE