sublime_merge.SlackBuild 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/bin/bash
  2. # Slackware build script for Sublime Merge
  3. # Builds a Slackware package from the Sublime Merge binary tarballs.
  4. # Anyone can freely modify and/or distribute this script without restrictions
  5. #
  6. # Originally written by Luke Williams (xocel@iquidus.org)
  7. # Currently maintained by Bruno Queiros (bqueiros@gmail.com)
  8. cd $(dirname $0) ; CWD=$(pwd)
  9. PRGNAM=sublime_merge
  10. VERSION=${VERSION:-2054}
  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 the variable PRINT_PACKAGE_NAME is set, then this script will report what
  22. # the name of the created package would be, and then exit. This information
  23. # could be useful to other scripts.
  24. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  25. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  26. exit 0
  27. fi
  28. TMP=${TMP:-/tmp/SBo}
  29. PKG=$TMP/package-$PRGNAM
  30. OUTPUT=${OUTPUT:-/tmp}
  31. TARBALL="sublime_merge_build_2054_x64.tar.xz" # Name of 64bit tarball
  32. TARBALL_ROOT="sublime_merge" # Name of tarballs root directory
  33. LIBDIRSUFFIX="64"
  34. if [ "$ARCH" != "x86_64" ]; then
  35. echo "$ARCH is not supported."
  36. exit 1
  37. fi
  38. set -eu
  39. rm -rf $PKG
  40. mkdir -p $TMP $PKG $OUTPUT
  41. cd $TMP
  42. rm -rf "$TARBALL_ROOT"
  43. tar -xvf "$CWD/$TARBALL"
  44. cd "$TARBALL_ROOT"
  45. chown -R root:root .
  46. find -L . \
  47. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  48. -o -perm 511 \) -exec chmod 755 {} \; -o \
  49. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  50. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  51. mkdir -p $PKG/opt/$PRGNAM
  52. cp -a * $PKG/opt/$PRGNAM
  53. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  54. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  55. mkdir -p $PKG/usr/bin
  56. ln -sf /opt/$PRGNAM/sublime_merge $PKG/usr/bin
  57. mkdir -p $PKG/usr/share/applications
  58. cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
  59. mkdir -p $PKG/usr/share/pixmaps
  60. install -D -m0644 Icon/48x48/sublime-merge.png $PKG/usr/share/pixmaps/${PRGNAM}.png
  61. for size in 16x16 32x32 48x48 128x128 256x256 ; do
  62. mkdir -p $PKG/usr/share/icons/hicolor/$size/apps
  63. ln -s /opt/$PRGNAM/Icon/$size/sublime-merge.png \
  64. $PKG/usr/share/icons/hicolor/$size/apps/ ;
  65. done
  66. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  67. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  68. mkdir -p $PKG/install
  69. cat $CWD/slack-desc > $PKG/install/slack-desc
  70. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  71. cd $PKG
  72. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE