parcellite.SlackBuild 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #!/bin/bash
  2. # Slackware build script for parcellite
  3. # Written by Phillip Warner <pc_warner@yahoo.com>
  4. cd $(dirname $0) ; CWD=$(pwd)
  5. PRGNAM=parcellite
  6. VERSION=${VERSION:-1.1.9}
  7. BUILD=${BUILD:-1}
  8. TAG=${TAG:-_SBo}
  9. PKGTYPE=${PKGTYPE:-tgz}
  10. if [ -z "$ARCH" ]; then
  11. case "$( uname -m )" in
  12. i?86) ARCH=i486 ;;
  13. arm*) ARCH=arm ;;
  14. *) ARCH=$( uname -m ) ;;
  15. esac
  16. fi
  17. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  18. # the name of the created package would be, and then exit. This information
  19. # could be useful to other scripts.
  20. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  21. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  22. exit 0
  23. fi
  24. TMP=${TMP:-/tmp/SBo}
  25. PKG=$TMP/package-$PRGNAM
  26. OUTPUT=${OUTPUT:-/tmp}
  27. # If set to "YES" then parcellite will use GTK Stock Icon based upon theme
  28. NOICON=${NOICON:-NO}
  29. if [ "$ARCH" = "i486" ]; then
  30. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  31. elif [ "$ARCH" = "i686" ]; then
  32. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  33. elif [ "$ARCH" = "x86_64" ]; then
  34. SLKCFLAGS="-O2 -fPIC"
  35. else
  36. SLKCFLAGS="-O2"
  37. fi
  38. set -e
  39. rm -rf $PKG
  40. mkdir -p $TMP $PKG $OUTPUT
  41. cd $TMP
  42. rm -rf $PRGNAM-$VERSION
  43. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  44. cd $PRGNAM-$VERSION
  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. if [ "$NOICON" = "YES" ]; then
  52. # Force parcellite to use the stock GTK icons
  53. sed -i "s/gtk_status_icon_new_from_icon_name(PARCELLITE_ICON)/gtk_status_icon_new_from_stock(PARCELLITE_ICON)/" src/main.c
  54. sed -i "s/PARCELLITE_ICON/GTK_STOCK_PASTE/" src/main.c
  55. sed -i "s/#define GTK_STOCK_PASTE \"parcellite\"//" src/main.c
  56. fi
  57. CFLAGS="$SLKCFLAGS" \
  58. CPPFLAGS="$SLKCFLAGS" \
  59. ./configure \
  60. --prefix=/usr \
  61. --sysconfdir=/etc \
  62. --mandir=/usr/man \
  63. --build=$ARCH-slackware-linux
  64. CFLAGS="$SLKCFLAGS" make
  65. make install DESTDIR=$PKG
  66. if [ "$NOICON" = "YES" ]; then
  67. sed -i "s/Icon=parcellite/Icon=gtk-paste/" $PKG/usr/share/applications/parcellite.desktop
  68. sed -i "s/Icon=parcellite/Icon=gtk-paste/" $PKG/etc/xdg/autostart/parcellite-startup.desktop
  69. # Remove the unused icons
  70. rm -rfv $PKG/usr/share/pixmaps/
  71. fi
  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. find $PKG/usr/man -type f -exec gzip -9 {} \;
  75. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  76. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  77. cp -a AUTHORS COPYING ChangeLog README TODO INSTALL NEWS $PKG/usr/doc/$PRGNAM-$VERSION
  78. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  79. mkdir -p $PKG/install
  80. cat $CWD/slack-desc > $PKG/install/slack-desc
  81. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  82. cd $PKG
  83. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE