grip.SlackBuild 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #!/bin/bash
  2. # Slackware build script for grip
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20211213 bkw: This replaces the ancient grip2 build. We didn't have
  6. # grip 3.x builds because they had too many gnome dependencies; the
  7. # 4.x series dropped those and is a pure GTK+ application. Except for
  8. # its Help option, which requires yelp. To avoid a dependency on yelp,
  9. # I convert the docs to HTML and patch grip to open a browser.
  10. cd $(dirname $0) ; CWD=$(pwd)
  11. PRGNAM=grip
  12. VERSION=${VERSION:-4.2.3}
  13. BUILD=${BUILD:-1}
  14. TAG=${TAG:-_SBo}
  15. PKGTYPE=${PKGTYPE:-tgz}
  16. if [ -z "$ARCH" ]; then
  17. case "$( uname -m )" in
  18. i?86) ARCH=i586 ;;
  19. arm*) ARCH=arm ;;
  20. *) ARCH=$( uname -m ) ;;
  21. esac
  22. fi
  23. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  24. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  25. exit 0
  26. fi
  27. TMP=${TMP:-/tmp/SBo}
  28. PKG=$TMP/package-$PRGNAM
  29. OUTPUT=${OUTPUT:-/tmp}
  30. if [ "$ARCH" = "i586" ]; then
  31. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  32. elif [ "$ARCH" = "i686" ]; then
  33. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  34. elif [ "$ARCH" = "x86_64" ]; then
  35. SLKCFLAGS="-O2 -fPIC"
  36. fi
  37. set -e
  38. rm -rf $PKG
  39. mkdir -p $TMP $PKG $OUTPUT
  40. cd $TMP
  41. rm -rf $PRGNAM-$VERSION
  42. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  43. cd $PRGNAM-$VERSION
  44. chown -R root:root .
  45. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  46. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  47. # The icons aren't quite correctly sized, e.g. the 64x64 one is really 64x67.
  48. for i in pixmaps/*/apps/$PRGNAM.png; do
  49. size="$( echo $i | cut -d/ -f2 )"
  50. convert -crop $size+0+1 $i $i.new.png
  51. mv $i.new.png $i
  52. done
  53. # Patch makes grip open the help table of contents in a browser, if
  54. # yelp is not installed. Have to convert the help to HTML, see below.
  55. patch -p1 < $CWD/help_fallback_html.diff
  56. mkdir build
  57. cd build
  58. CFLAGS="$SLKCFLAGS" \
  59. CXXFLAGS="$SLKCFLAGS" \
  60. meson .. \
  61. --buildtype=release \
  62. --infodir=/usr/info \
  63. --libdir=/usr/lib${LIBDIRSUFFIX} \
  64. --localstatedir=/var \
  65. --mandir=/usr/man \
  66. --prefix=/usr \
  67. --sysconfdir=/etc \
  68. -Dstrip=true
  69. "${NINJA:=ninja}" -v
  70. DESTDIR=$PKG $NINJA -v install
  71. cd ..
  72. PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
  73. mkdir -p $PKGDOC/html
  74. # Generate HTML documentation, so we don't need yelp.
  75. # 2 choices here: docbook2html or xmlto. I go with xmlto because
  76. # docbook2html (a) doesn't handle UTF-8 input, and (b) wants to
  77. # do network access to download the DTD.
  78. # The documentation is short enough that there's no point having
  79. # separate HTML pages for each section. html-nochunks gives us
  80. # one HTML file with all the content.
  81. cd doc/C
  82. xmlto --stringparam chunker.output.encoding=UTF-8 html-nochunks grip.xml
  83. # While we're at it, make the smilie images easier to see on modern hi-res
  84. # screens (I have to squint).
  85. for i in smile*.png; do
  86. convert \
  87. -resize 36x36 \
  88. -extent 40x40 \
  89. -background '#808080' \
  90. -gravity center \
  91. $i $i.new.png
  92. mv $i.new.png $i
  93. done
  94. cp -a *.html *.png $PKGDOC/html
  95. cd -
  96. # NEWS is 0-byte placeholder in 4.2.3.
  97. cp -a AUTHORS COPYING* CREDITS ChangeLog README TODO $PKGDOC
  98. cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
  99. mkdir -p $PKG/install
  100. cat $CWD/slack-desc > $PKG/install/slack-desc
  101. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  102. cd $PKG
  103. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE