pcgen.SlackBuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/bin/bash
  2. # Slackware build script for pcgen
  3. # Copyright 2017-22 klaatu @ member.fsf.org
  4. #
  5. # GNU All-Permissive License
  6. # Copying and distribution of this file, with or without modification,
  7. # are permitted in any medium without royalty provided the copyright
  8. # notice and this notice are preserved. This file is offered as-is,
  9. # without any warranty.
  10. # 20220505 bkw: Modified by SlackBuilds.org, BUILD=2:
  11. # - this is not noarch. force ARCH=x86_64, and warn user if on some other arch.
  12. # - reword README slightly.
  13. # - don't install windows .exe or .bat launcher.
  14. # - symlink executable to $PATH so command-line users can find it.
  15. # - strip binaries and libraries.
  16. cd $(dirname $0) ; CWD=$(pwd)
  17. PRGNAM=pcgen
  18. VERSION=${VERSION:-"6.09.05"}
  19. BUILD=${BUILD:-2}
  20. TAG=${TAG:-_SBo}
  21. PKGTYPE=${PKGTYPE:-tgz}
  22. ARCH="x86_64"
  23. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  24. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  25. exit 0
  26. fi
  27. U="$( uname -m )"
  28. if [ "$ARCH" != "$U" ]; then
  29. cat <<EOF
  30. *********************************************************************
  31. $0: building $ARCH package on a $U system.
  32. The package will work if you install it on a $ARCH system, but not
  33. on this system.
  34. Press ^C within 10 seconds to abort.
  35. *********************************************************************
  36. EOF
  37. sleep 10
  38. fi
  39. TMP=${TMP:-/tmp/SBo}
  40. PKG=$TMP/package-$PRGNAM
  41. OUTPUT=${OUTPUT:-/tmp}
  42. set -e
  43. rm -rf $PKG
  44. mkdir -p $TMP $PKG $OUTPUT
  45. cd $TMP
  46. rm -rf $PRGNAM-$VERSION
  47. mkdir $PRGNAM-$VERSION
  48. unzip $CWD/image-linux-x64.zip -d $PRGNAM-$VERSION
  49. cd $PRGNAM-$VERSION
  50. chown -R root:root .
  51. find -L . \
  52. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  53. -o -perm 511 \) -exec chmod 755 {} \+ -o \
  54. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  55. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
  56. mkdir -p $PKG/opt/
  57. mv $PRGNAM-linux-x64 $PKG/opt/$PRGNAM
  58. # fix launcher script
  59. cd $PKG/opt/$PRGNAM
  60. patch < $CWD/pcgen.patch
  61. # 20220505 bkw: do not need windows stuff:
  62. rm -f *.exe *.bat
  63. # desktop file, added to SlackBuild for convenience
  64. mkdir -p $PKG/usr/share/applications/
  65. cp $CWD/$PRGNAM.desktop $PKG/usr/share/applications/
  66. # 20220505 bkw: symlink to somewhere that's normally in $PATH. not
  67. # everyone uses a desktop environment with a start menu.
  68. mkdir -p $PKG/usr/games
  69. ln -s ../../opt/$PRGNAM/$PRGNAM $PKG/usr/games/$PRGNAM
  70. # 20220505 bkw: shipped bins/libs aren't stripped, but stripping
  71. # them does no harm.
  72. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  73. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  74. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/
  75. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  76. mkdir -p $PKG/install
  77. cat $CWD/slack-desc > $PKG/install/slack-desc
  78. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  79. cd $PKG
  80. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE