klog.SlackBuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #!/bin/bash
  2. # Slackbuild for klog
  3. # Written by JK Wood <joshuakwood@gmail.com>
  4. # Slackbuild is released under the Dog-on-Fire License:
  5. # If use of this script causes your dog to catch on fire,
  6. # you agree to send me five dollars. Or a picture
  7. # of the dog on fire.
  8. # Otherwise, you're on your own. I've tested the script
  9. # on my own computer, and it hasn't broken anything.
  10. # So if it does it on your computer, that falls in
  11. # the realm of "Not my problem."
  12. #
  13. # Of course, if you'll send a bug report to the above
  14. # email address, I may be able to see what you did
  15. # wrong and prevent it from happening in the future.
  16. # In which case, I may just send YOU five dollars.
  17. # Oh, and feel free to copy it and modify it as you
  18. # see fit. Or as I see fit. Or as I fit. Although
  19. # that is unlikely, as I am rather tall.
  20. cd $(dirname $0) ; CWD=$(pwd)
  21. PRGNAM=klog
  22. VERSION=${VERSION:-1.8.7}
  23. BUILD=${BUILD:-1}
  24. TAG=${TAG:-_SBo}
  25. PKGTYPE=${PKGTYPE:-tgz}
  26. if [ -z "$ARCH" ]; then
  27. case "$( uname -m )" in
  28. i?86) ARCH=i586 ;;
  29. arm*) ARCH=arm ;;
  30. *) ARCH=$( uname -m ) ;;
  31. esac
  32. fi
  33. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  34. # the name of the created package would be, and then exit. This information
  35. # could be useful to other scripts.
  36. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  37. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  38. exit 0
  39. fi
  40. TMP=${TMP:-/tmp/SBo}
  41. PKG=$TMP/package-$PRGNAM
  42. OUTPUT=${OUTPUT:-/tmp}
  43. if [ "$ARCH" = "i586" ]; then
  44. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  45. LIBDIRSUFFIX=""
  46. elif [ "$ARCH" = "i686" ]; then
  47. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  48. LIBDIRSUFFIX=""
  49. elif [ "$ARCH" = "x86_64" ]; then
  50. SLKCFLAGS="-O2 -fPIC"
  51. LIBDIRSUFFIX="64"
  52. else
  53. SLKCFLAGS="-O2"
  54. LIBDIRSUFFIX=""
  55. fi
  56. set -e
  57. rm -rf $PKG
  58. mkdir -p $TMP $PKG $OUTPUT
  59. cd $TMP
  60. rm -rf $PRGNAM-$VERSION
  61. TARBALL="$CWD/$VERSION.tar.gz"
  62. if [ ! -e "$TARBALL" ] ; then
  63. TARBALL="$CWD/$PRGNAM-$VERSION.tar.gz"
  64. fi
  65. tar -xvf $TARBALL
  66. cd $PRGNAM-$VERSION
  67. chown -R root:root .
  68. find -L . \
  69. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  70. -o -perm 511 \) -exec chmod 755 {} \; -o \
  71. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  72. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  73. CFLAGS="$SLKCFLAGS" \
  74. CXXFLAGS="$SLKCFLAGS" \
  75. qmake-qt5 PREFIX=$PKG/usr KLog.pro
  76. make
  77. make install DESTDIR=$PKG
  78. # this seems purposeless
  79. rm -r $PKG/usr/share/klog
  80. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  81. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  82. mkdir -p $PKG/usr/man/man1
  83. gzip -9c src/klog.1 > $PKG/usr/man/man1/klog.1.gz
  84. mkdir -p $PKG/usr/share/applications
  85. cat $CWD/klog.desktop > $PKG/usr/share/applications/klog.desktop
  86. mkdir -p $PKG/usr/share/icons/locolor/16x16/apps
  87. mkdir -p $PKG/usr/share/icons/locolor/32x32/apps
  88. cat $CWD/klog16x16.png > $PKG/usr/share/icons/locolor/16x16/apps/klog.png
  89. cat $CWD/klog32x32.png > $PKG/usr/share/icons/locolor/32x32/apps/klog.png
  90. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  91. for doc in AUTHORS COPYING Changelog NEWS README TODO; do
  92. cp -a "src/$doc" \
  93. $PKG/usr/doc/$PRGNAM-$VERSION
  94. done
  95. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  96. mkdir -p $PKG/install
  97. cat $CWD/slack-desc > $PKG/install/slack-desc
  98. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  99. cd $PKG
  100. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE