qiv.SlackBuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #!/bin/bash
  2. # Slackware build script for qiv
  3. # Written by Pablo Santamaria (email removed)
  4. # Modified & now maintained by B. Watson <yalhcru@gmail.com>. Original
  5. # version had no license, modified version released under the WTFPL. See
  6. # http://www.wtfpl.net/txt/copying/ for details.
  7. # 20191231 bkw:
  8. # - Add libopenraw (raw camera image) formats, BUILD=2.
  9. # - Remove mention of wmf-pixbuf loader from README and .sqf
  10. # since there's a Slackware update that removes the need for it.
  11. # 20191226 bkw:
  12. # - Upgrade for v2.3.2. This was released a month after my last update,
  13. # but the download page on the site doesn't link to it (found it just
  14. # now by editing the URL for v2.3.1), so my update-checker script
  15. # never saw it...
  16. # - As compensation for my tardiness, add support for a bunch of new
  17. # image types.
  18. # 20170209 bkw:
  19. # - Take over maintenance
  20. # - i486 => i586
  21. # - Add latest fixes from upstream's git
  22. # - Get rid of redundant stripping of binaries and gzipping
  23. # of man pages (upstream's 'make install' already does it)
  24. # - Don't install README.INSTALL
  25. cd $(dirname $0) ; CWD=$(pwd)
  26. PRGNAM=qiv
  27. VERSION=${VERSION:-2.3.2}
  28. BUILD=${BUILD:-2}
  29. TAG=${TAG:-_SBo}
  30. PKGTYPE=${PKGTYPE:-tgz}
  31. if [ -z "$ARCH" ]; then
  32. case "$( uname -m )" in
  33. i?86) ARCH=i586 ;;
  34. arm*) ARCH=arm ;;
  35. *) ARCH=$( uname -m ) ;;
  36. esac
  37. fi
  38. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  39. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  40. exit 0
  41. fi
  42. TMP=${TMP:-/tmp/SBo}
  43. PKG=$TMP/package-$PRGNAM
  44. OUTPUT=${OUTPUT:-/tmp}
  45. if [ "$ARCH" = "i586" ]; then
  46. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  47. LIBDIRSUFFIX=""
  48. elif [ "$ARCH" = "i686" ]; then
  49. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  50. LIBDIRSUFFIX=""
  51. elif [ "$ARCH" = "x86_64" ]; then
  52. SLKCFLAGS="-O2 -fPIC"
  53. LIBDIRSUFFIX="64"
  54. else
  55. SLKCFLAGS="-O2"
  56. LIBDIRSUFFIX=""
  57. fi
  58. set -e
  59. rm -rf $PKG
  60. mkdir -p $TMP $PKG $OUTPUT
  61. cd $TMP
  62. rm -rf $PRGNAM-$VERSION
  63. tar xvf $CWD/$PRGNAM-$VERSION.tgz
  64. cd $PRGNAM-$VERSION
  65. chown -R root:root .
  66. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  67. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  68. # Patch to add potential support for various image formats. This patch
  69. # doesn't actually contain any code for decoding/displaying new image
  70. # formats. All it does is add file extensions and magic to the list
  71. # of filetypes qiv will attempt to display via imlib and/or pixbuf.
  72. # It's up to imlib/pixbuf to actually support the image types. Some of
  73. # these are already supported in Slackware, a few require optional deps
  74. # (see README).
  75. # For the optional ones (e.g. webp), this patch doesn't do any harm
  76. # if the support library's not installed. All it does is make qiv warn
  77. # "Unable to read file" on stderr, instead of silently skipping it.
  78. patch -p1 < $CWD/new_formats.diff
  79. # Three sed expressions here. In order:
  80. # 1. Make qiv build with our compiler flags.
  81. # 2. Disable the test, since it requires X to be running and
  82. # accepting connections from root.
  83. # 3. Put man page where Slackware likes them.
  84. sed -i -e "s/-O2 -Wall/$SLKCFLAGS/" \
  85. -e "s|\./qiv|echo &|" \
  86. -e 's,/share/man,/man,g' \
  87. Makefile
  88. make
  89. make install PREFIX=$PKG/usr
  90. # binary already stripped, man pages already gzipped
  91. rm -f README.INSTALL # don't need this in a binary package
  92. chmod 644 contrib/* # docs shouldn't be executable even if they're scripts
  93. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  94. cp -a Changelog README* intro.jpg contrib/ $PKG/usr/doc/$PRGNAM-$VERSION
  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