rott.SlackBuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #!/bin/bash
  2. # Slackware build script for rott
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20211025 bkw: BUILD=2
  6. # - new-style icons.
  7. # - .desktop file starts in windowed mode, not fullscreen.
  8. cd $(dirname $0) ; CWD=$(pwd)
  9. PRGNAM=rott
  10. VERSION=${VERSION:-1.1.2}
  11. BUILD=${BUILD:-1}
  12. TAG=${TAG:-_SBo}
  13. PKGTYPE=${PKGTYPE:-tgz}
  14. if [ -z "$ARCH" ]; then
  15. case "$( uname -m )" in
  16. i?86) ARCH=i586 ;;
  17. arm*) ARCH=arm ;;
  18. *) ARCH=$( uname -m ) ;;
  19. esac
  20. fi
  21. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  22. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  23. exit 0
  24. fi
  25. TMP=${TMP:-/tmp/SBo}
  26. PKG=$TMP/package-$PRGNAM
  27. OUTPUT=${OUTPUT:-/tmp}
  28. # LIBDIRSUFFIX not needed
  29. if [ "$ARCH" = "i586" ]; then
  30. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  31. elif [ "$ARCH" = "i686" ]; then
  32. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  33. elif [ "$ARCH" = "x86_64" ]; then
  34. SLKCFLAGS="-O2 -fPIC"
  35. else
  36. SLKCFLAGS="-O2"
  37. fi
  38. set -e
  39. rm -rf $PKG
  40. mkdir -p $TMP $PKG $OUTPUT
  41. cd $TMP
  42. rm -rf $PRGNAM-$VERSION
  43. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  44. cd $PRGNAM-$VERSION
  45. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  46. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  47. patch -p1 < $CWD/manpage.diff
  48. # 1.1.2 now lets us define SHAREWARE and SUPERROTT as make options,
  49. # no more patching rott/develop.h
  50. # The shareware/demo binary
  51. make -j1 -C $PRGNAM clean all \
  52. SHAREWARE=1 SUPERROTT=0 \
  53. EXTRACFLAGS="$SLKCFLAGS -DDATADIR=\\\"/usr/share/games/$PRGNAM/\\\""
  54. mkdir -p $PKG/usr/games
  55. install -s -m0755 $PRGNAM/$PRGNAM $PKG/usr/games/$PRGNAM-demo
  56. # The registered binary
  57. make -j1 -C $PRGNAM clean all \
  58. SHAREWARE=0 SUPERROTT=0 \
  59. EXTRACFLAGS="$SLKCFLAGS -DDATADIR=\\\"/usr/share/games/$PRGNAM/\\\""
  60. install -s -m0755 $PRGNAM/$PRGNAM $PKG/usr/games/$PRGNAM-reg
  61. # The retail/cdrom binary
  62. make -j1 -C $PRGNAM clean all \
  63. SHAREWARE=0 SUPERROTT=1 \
  64. EXTRACFLAGS="$SLKCFLAGS -DDATADIR=\\\"/usr/share/games/$PRGNAM/\\\""
  65. install -s -m0755 $PRGNAM/$PRGNAM $PKG/usr/games/$PRGNAM-cdrom
  66. # Not going to bother with the "Site License" binary: doubt anyone
  67. # will have any use for it, since multiplayer isn't supported. If you need
  68. # it, build with SHAREWARE=0 SUPERROTT=0 SITELICENSE=1
  69. # Man page is modified from the original version.
  70. MANDIR=$PKG/usr/man/man6
  71. mkdir -p $MANDIR
  72. gzip -9c doc/$PRGNAM.6 > $MANDIR/$PRGNAM.6.gz
  73. ln -s $PRGNAM.6.gz $MANDIR/$PRGNAM-demo.6.gz
  74. ln -s $PRGNAM.6.gz $MANDIR/$PRGNAM-reg.6.gz
  75. ln -s $PRGNAM.6.gz $MANDIR/$PRGNAM-cdrom.6.gz
  76. # Shareware game data. Used to be optional, always included now.
  77. mkdir -p $PKG/usr/share/games/$PRGNAM
  78. if [ -e $CWD/1rott13.zip ]; then
  79. unzip $CWD/1rott13.zip ROTTSW13.SHR
  80. unzip ROTTSW13.SHR '*.WAD' '*.RTS' '*.RTL' '*.RTC'
  81. cp *.WAD *.RTS *.RTL *.RTC $PKG/usr/share/games/$PRGNAM
  82. chmod 644 $PKG/usr/share/games/$PRGNAM/*
  83. fi
  84. # Wrapper script
  85. install -m0755 -oroot -groot $CWD/$PRGNAM.sh $PKG/usr/games/$PRGNAM
  86. mkdir -p $PKG/usr/share/applications $PKG/usr/share/pixmaps
  87. sed -e 's,Exec=,&/usr/games/,' \
  88. -e 's,-window,,' \
  89. < misc/$PRGNAM.desktop \
  90. > $PKG/usr/share/applications/$PRGNAM.desktop
  91. # Icon made for this SlackBuild.
  92. for px in 16 32 48 64 128; do
  93. size=${px}x${px}
  94. dir=$PKG/usr/share/icons/hicolor/$size/apps
  95. mkdir -p $dir
  96. convert -resize $size $CWD/$PRGNAM.png $dir/$PRGNAM.png
  97. done
  98. ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
  99. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  100. cp COPYING README doc/*.txt $PKG/usr/doc/$PRGNAM-$VERSION
  101. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  102. cat $CWD/README_gamedata.txt > $PKG/usr/doc/$PRGNAM-$VERSION/README_gamedata.txt
  103. mkdir -p $PKG/install
  104. cat $CWD/slack-desc > $PKG/install/slack-desc
  105. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  106. cd $PKG
  107. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE