marathon-rubicon-data.SlackBuild 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #!/bin/sh
  2. # Slackware build script for Marathon: Rubicon X
  3. # Copyright 2015, 2018 Hunter Sezen California, USA
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  13. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  15. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. PRGNAM=marathon-rubicon-data
  23. VERSION=${VERSION:-20060807} # Last modified date from the zipfile's http header
  24. BUILD=${BUILD:-3}
  25. TAG=${TAG:-_SBo}
  26. ARCH=noarch
  27. CWD=$(pwd)
  28. TMP=${TMP:-/tmp/SBo}
  29. PKG=$TMP/package-$PRGNAM
  30. OUTPUT=${OUTPUT:-/tmp}
  31. set -eu
  32. # install gamedata in opt instead of usr
  33. if [ "${OPT:-0}" != 0 ]; then
  34. DATA='/opt/AlephOne'
  35. else
  36. DATA='/usr/share/AlephOne/gamedata'
  37. fi
  38. ZIPNAME=marathonRubiconX
  39. ZIPFILE=$ZIPNAME.zip
  40. WRAPPER=marathon-rubicon
  41. DATADIR=$PKG$DATA
  42. rm -rf $PKG
  43. mkdir -p $TMP $PKG $OUTPUT $DATADIR
  44. cd $TMP
  45. unzip $CWD/$ZIPFILE -d $DATADIR
  46. chown -R root:root $DATADIR
  47. # NB: the usual find predicate is different (zipfile stores +x permissions
  48. # on some files for no good reason)
  49. find $DATADIR \
  50. \( -type f -exec chmod 644 {} \; \) -o \
  51. \( -type d -exec chmod 755 {} \; \)
  52. # Write launcher script to the user's path
  53. mkdir -p $PKG/usr/games
  54. cat > $PKG/usr/games/$WRAPPER <<EOF
  55. #!/bin/sh
  56. ALEPHONE_DATA="$DATA/Rubicon X ƒ"
  57. export ALEPHONE_DATA
  58. exec alephone "\$@"
  59. EOF
  60. chmod 0755 $PKG/usr/games/$WRAPPER
  61. # Write a desktop file
  62. mkdir -p $PKG/usr/share/applications
  63. cat > $PKG/usr/share/applications/$WRAPPER.desktop <<EOF
  64. [Desktop Entry]
  65. Name=Marathon Rubicon X
  66. Exec=$WRAPPER
  67. Icon=alephone
  68. Type=Application
  69. Comment=Marathon: Rubicon X (first-person shooter game)
  70. Categories=Game;ActionGame;
  71. EOF
  72. # Restore the old AI limits
  73. # https://github.com/Aleph-One-Marathon/alephone/issues/62
  74. cat > $DATADIR/Rubicon\ X\ ƒ/Scripts/AI <<EOF
  75. <marathon>
  76. <dynamic_limits>
  77. <paths value="128"/>
  78. </dynamic_limits>
  79. </marathon>
  80. EOF
  81. # Don't want this
  82. rm -rf $DATADIR/__MACOSX
  83. # Remove unneeded hidden files
  84. find $DATADIR -name ".[^.]*" -mindepth 1 -print0 | xargs -0r rm -rf
  85. # Fix windows formatted scripts
  86. set -- $DATADIR/*/Scripts/*
  87. for script do
  88. tr '\r' '\n' < "$script" > "$script-tmp"
  89. mv -- "$script-tmp" "$script"
  90. done
  91. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  92. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  93. mkdir -p $PKG/install
  94. cat $CWD/slack-desc > $PKG/install/slack-desc
  95. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  96. cd $PKG
  97. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}