You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

131 lines
3.9 KiB

  1. #!/bin/bash
  2. # Slackware build script for pysolfc
  3. # Originally written by Matthew "mfillpot" Fillpot.
  4. # Now maintained by B. Watson <urchlay@slackware.uk>
  5. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  6. # 20250819 bkw: update for v3.4.0 (and cardset-minimal 3.1.0).
  7. # 20250329 bkw: update for v3.2.0 (cardset-minimal still 3.0.0).
  8. # 20240824 bkw: update for v3.0.0 (and cardset-minimal 3.0.0).
  9. # 20231216 bkw: update for v2.21.0 (and cardset-minimal 2.2.0),
  10. # fix broken permissions for cardsets.
  11. # 20230111 bkw: update for v2.18.0 (and cardset-minimal 2.1.0).
  12. # 20211228 bkw: update for v2.14.1.
  13. # - relicensed as WTFPL with permission from Matthew.
  14. # - we now use python3 and -current's python-pillow, no need for
  15. # pillow6 patch, six, etc.
  16. # - document optional dep pygame in README.
  17. # 20181206 bkw:
  18. # - Add missing 'six' dependency. Thanks to Carsten Boysen Jensen for
  19. # the bug report. BUILD=2
  20. # 20181013 bkw:
  21. # - Take over maintenance.
  22. # - Update for v2.4.0. Incompatible changes, can't build the old
  23. # version with VERSION=2.0, sorry.
  24. # - Upstream removed all the cardsets from the source tarball, moved
  25. # them to a separate "minimal" cardset tarball, so add it to DOWNLOAD
  26. # and script stuff to handle it.
  27. # - Get rid of the option to include the complete cardsets tarball. Moved
  28. # to a separate pysylfc-extra-cardsets build.
  29. # - Install the correct man page for the FC edition, not the old pre-fork
  30. # pysol one.
  31. # - Include all_games.html in the docdir (with fixed paths for the links).
  32. # - Update README and slack-desc.
  33. cd $(dirname $0) ; CWD=$(pwd)
  34. PRGNAM=pysolfc
  35. SRCNAM=PySolFC
  36. VERSION=${VERSION:-3.4.0}
  37. BUILD=${BUILD:-1}
  38. TAG=${TAG:-_SBo}
  39. PKGTYPE=${PKGTYPE:-tgz}
  40. CARDSETVER=${CARDSETVER:-3.1.0}
  41. CARDSETS=$SRCNAM-Cardsets--Minimal-$CARDSETVER
  42. if [ -z "$ARCH" ]; then
  43. case "$( uname -m )" in
  44. i?86) ARCH=i586 ;;
  45. arm*) ARCH=arm ;;
  46. *) ARCH=$( uname -m ) ;;
  47. esac
  48. fi
  49. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  50. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  51. exit 0
  52. fi
  53. TMP=${TMP:-/tmp/SBo}
  54. PKG=$TMP/package-$PRGNAM
  55. OUTPUT=${OUTPUT:-/tmp}
  56. set -e
  57. # 20230111 bkw: upstream starting using "pysol-x.x.x" for the tag.
  58. # handle either name for the tarball, because I probably want to keep
  59. # running the old version.
  60. TARBALL=$CWD/$SRCNAM-$PRGNAM-$VERSION.tar.gz
  61. [ -e $TARBALL ] || TARBALL=$CWD/$SRCNAM-$VERSION.tar.gz
  62. TARDIR=$( basename $TARBALL .tar.gz )
  63. fixperms() {
  64. chown -R root:root $1
  65. find -L $1 -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + -o \
  66. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} +
  67. }
  68. rm -rf $PKG
  69. mkdir -p $TMP $PKG $OUTPUT
  70. cd $TMP
  71. rm -rf $TARDIR
  72. tar xvf $TARBALL
  73. cd $TARDIR
  74. fixperms .
  75. # do not use 'make install', it has no way to pass --root to setup.py.
  76. # "mo" creates the UI translations. "rules" and "all_games_html" make
  77. # the docs. setup.py will install the docs & translations if they
  78. # exist.
  79. make mo
  80. make rules
  81. make all_games_html
  82. python3 setup.py install --root $PKG
  83. mkdir -p $PKG/usr/man/man6
  84. gzip -9c < docs/$PRGNAM.6 > $PKG/usr/man/man6/$PRGNAM.6.gz
  85. # Executable is called pysol.py, there damn well better be a man
  86. # page with the same name.
  87. ln -s $PRGNAM.6.gz $PKG/usr/man/man6/pysol.py.6
  88. # The minimal cardsets are now required, since the source tarball
  89. # has none. Extract directly to $PKG instead of extracting and copying.
  90. tar xvf $CWD/$CARDSETS.tar.xz -C $PKG/usr/share/$SRCNAM/ --strip-components=1
  91. fixperms $PKG/usr/share/$SRCNAM
  92. # old-style icon, in case something needs it.
  93. mkdir -p $PKG/usr/share/pixmaps
  94. ln -s ../icons/hicolor/48x48/apps/pysol.png $PKG/usr/share/pixmaps/pysol.png
  95. PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
  96. mkdir -p $PKGDOC
  97. cp -a contrib/*.asciidoc *.md NEWS.* COPYING docs/README $PKGDOC
  98. cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
  99. mkdir -p $PKG/install
  100. cat $CWD/slack-desc > $PKG/install/slack-desc
  101. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  102. cd $PKG
  103. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE