telegram.SlackBuild 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #!/bin/sh
  2. # Slackware build script for Telegram
  3. # Marco Ferraioli marcoferraioli@live.com
  4. # Willy Sudiarto Raharjo <willysr@slackbuilds.org>
  5. # Modified by Vasily Sora <khronosschoty@posteo.org>
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 3 of the License, or
  9. # (at your option) any later version, with the following exception:
  10. # the text of the GPL license may be omitted.
  11. # This program is distributed in the hope that it will be useful, but
  12. # without any warranty; without even the implied warranty of
  13. # merchantability or fitness for a particular purpose. Compiling,
  14. # interpreting, executing or merely reading the text of the program
  15. # may result in lapses of consciousness and/or very being, up to and
  16. # including the end of all existence and the Universe as we know it.
  17. # See the GNU General Public License for more details.
  18. # You may have received a copy of the GNU General Public License along
  19. # with this program (most likely, a file named COPYING). If not, see
  20. # <http://www.gnu.org/licenses/>.
  21. # Modified by Mario Preksavec <mario@slackware.hr>
  22. PRGNAM=telegram
  23. SRCNAM=tsetup
  24. SRCDIR=Telegram
  25. URLSRC=${URLSRC:-https://telegram.org/dl/desktop/linux}
  26. # VERSION=${VERSION:-2.1.10}
  27. BUILD=${BUILD:-1}
  28. TAG=${TAG:-_SBo}
  29. case "$( uname -m )" in
  30. i?86) ARCH=i586 ;;
  31. arm*) ARCH=arm ;;
  32. *) ARCH=$( uname -m ) ;;
  33. esac
  34. CWD=$(pwd)
  35. TMP=${TMP:-/tmp/SBo}
  36. PKG=$TMP/package-$PRGNAM
  37. OUTPUT=${OUTPUT:-/tmp}
  38. case "$ARCH" in
  39. x86_64)
  40. SRC="${SRCNAM}"
  41. LIBDIRSUFFIX="64"
  42. ;;
  43. i586)
  44. SRC="${SRCNAM}32"
  45. LIBDIRSUFFIX=""
  46. ;;
  47. *)
  48. echo "$ARCH is not supported."
  49. exit 1
  50. ;;
  51. esac
  52. set -e
  53. rm -rf $PKG
  54. mkdir -p $TMP $PKG $OUTPUT
  55. cd $TMP
  56. rm -rf $SRCDIR
  57. wget -c --content-disposition -P $CWD $URLSRC
  58. SRCNAM=$(ls -t $CWD/${SRCNAM}* | head -1)
  59. VERSION=$(echo $SRCNAM | cut -d '.' -f2-4)
  60. tar xvf $SRCNAM
  61. cd $SRCDIR
  62. chown -R root:root .
  63. find -L . \
  64. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  65. -o -perm 511 \) -exec chmod 755 {} \; -o \
  66. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  67. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  68. mkdir -p $PKG/opt/$PRGNAM
  69. cp -a * $PKG/opt/$PRGNAM
  70. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  71. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  72. mkdir -p $PKG/usr/bin
  73. ln -sf /opt/$PRGNAM/Telegram $PKG/usr/bin
  74. mkdir -p $PKG/usr/share/applications
  75. cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
  76. mkdir -p $PKG/usr/share/pixmaps
  77. cp $CWD/$PRGNAM.png $PKG/usr/share/pixmaps
  78. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  79. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  80. mkdir -p $PKG/install
  81. cat $CWD/slack-desc > $PKG/install/slack-desc
  82. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  83. cd $PKG
  84. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}