stratagus.SlackBuild 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #!/bin/bash
  2. # Slackware build script for stratagus
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # Note to future maintainers (in case I get hit by a bus or something):
  6. # If you update this, you need to update wargus to the same version. If
  7. # you see a newer stratagus release but wargus hasn't yet been updated,
  8. # resist the temptation to update to the new stratagus until the wargus
  9. # devs have made a release with the same version number. Failure to do
  10. # this will cause breakage...
  11. # Build option notes:
  12. # - technically libmikmod is optional, but it's a small lib with no deps
  13. # of its own. Games might need it, better to make it a hard dep.
  14. # - fluidsynth is also technically optional, but the #1 use for
  15. # stratagus is to play wargus, which requires it.
  16. # - upx is disabled, it's only used for packing the stratagus executable,
  17. # which we don't do in SlackBuilds.
  18. # - touchscreen support is disabled. I have no hardware to test it on,
  19. # and generally Slackware isn't used on touchscreen devices. If you
  20. # want to play with it, add -DENABLE_TOUCHSCREEN=ON in the cmake
  21. # command below.
  22. # 20180915 bkw: updated for v2.4.1
  23. cd $(dirname $0) ; CWD=$(pwd)
  24. PRGNAM=stratagus
  25. VERSION=${VERSION:-2.4.1}
  26. BUILD=${BUILD:-1}
  27. TAG=${TAG:-_SBo}
  28. PKGTYPE=${PKGTYPE:-tgz}
  29. if [ -z "$ARCH" ]; then
  30. case "$( uname -m )" in
  31. i?86) ARCH=i586 ;;
  32. arm*) ARCH=arm ;;
  33. *) ARCH=$( uname -m ) ;;
  34. esac
  35. fi
  36. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  37. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  38. exit 0
  39. fi
  40. TMP=${TMP:-/tmp/SBo}
  41. PKG=$TMP/package-$PRGNAM
  42. OUTPUT=${OUTPUT:-/tmp}
  43. if [ "$ARCH" = "i586" ]; then
  44. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  45. LIBDIRSUFFIX=""
  46. elif [ "$ARCH" = "i686" ]; then
  47. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  48. LIBDIRSUFFIX=""
  49. elif [ "$ARCH" = "x86_64" ]; then
  50. SLKCFLAGS="-O2 -fPIC"
  51. LIBDIRSUFFIX="64"
  52. else
  53. SLKCFLAGS="-O2"
  54. LIBDIRSUFFIX=""
  55. fi
  56. set -e
  57. rm -rf $PKG
  58. mkdir -p $TMP $PKG $OUTPUT
  59. cd $TMP
  60. rm -rf $PRGNAM-$VERSION
  61. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  62. cd $PRGNAM-$VERSION
  63. chown -R root:root .
  64. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  65. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  66. # -DDOCDIR isn't 100% respected, some of the docs end up in hardcoded
  67. # share/doc/$PRGNAM, so:
  68. sed -i "s,share/doc/$PRGNAM,doc/$PRGNAM-$VERSION," CMakeLists.txt
  69. # 20211119 bkw: fix compile with -current's gcc.
  70. sed -i 's,"_C_," _C_,' src/ai/ai_plan.cpp src/stratagus/script.cpp
  71. mkdir -p build
  72. cd build
  73. cmake \
  74. -DENABLE_DOC=ON \
  75. -DENABLE_DEV=ON \
  76. -DENABLE_STRIP=ON \
  77. -DBINDIR=/usr/games \
  78. -DGAMEDIR=/usr/games \
  79. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  80. -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
  81. -DCMAKE_INSTALL_PREFIX=/usr \
  82. -DMANDIR:PATH=man/man6 \
  83. -DDOCDIR:PATH=doc/$PRGNAM-$VERSION \
  84. -DCMAKE_BUILD_TYPE=Release ..
  85. make
  86. make install DESTDIR=$PKG
  87. cd ..
  88. # get rid of empty useless file
  89. rm -f $PKG/usr/include/*.nsi
  90. gzip -9 $PKG/usr/man/man6/$PRGNAM.6
  91. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  92. cp -a README* COPYING $PKG/usr/doc/$PRGNAM-$VERSION
  93. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  94. mkdir -p $PKG/install
  95. cat $CWD/slack-desc > $PKG/install/slack-desc
  96. cd $PKG
  97. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE