imv.SlackBuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #!/bin/bash
  2. # Slackware build script for imv
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20210909 bkw:
  6. # - update for v4.3.0.
  7. # - upstream switched to meson, can't build old versions with this script.
  8. # - meson autodetects all the optional libs properly, get rid of the
  9. # messy shell script code that used to do it.
  10. # - add new optional dep libheif.
  11. # - get rid of squelch_libtiff_warnings.diff (upstream fixed it).
  12. # - rework README.
  13. cd $(dirname $0) ; CWD=$(pwd)
  14. PRGNAM=imv
  15. VERSION=${VERSION:-4.3.0}
  16. BUILD=${BUILD:-1}
  17. TAG=${TAG:-_SBo}
  18. PKGTYPE=${PKGTYPE:-tgz}
  19. if [ -z "$ARCH" ]; then
  20. case "$( uname -m )" in
  21. i?86) ARCH=i586 ;;
  22. arm*) ARCH=arm ;;
  23. *) ARCH=$( uname -m ) ;;
  24. esac
  25. fi
  26. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  27. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  28. exit 0
  29. fi
  30. TMP=${TMP:-/tmp/SBo}
  31. PKG=$TMP/package-$PRGNAM
  32. OUTPUT=${OUTPUT:-/tmp}
  33. if [ "$ARCH" = "i586" ]; then
  34. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  35. LIBDIRSUFFIX=""
  36. elif [ "$ARCH" = "i686" ]; then
  37. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  38. LIBDIRSUFFIX=""
  39. elif [ "$ARCH" = "x86_64" ]; then
  40. SLKCFLAGS="-O2 -fPIC"
  41. LIBDIRSUFFIX="64"
  42. else
  43. SLKCFLAGS="-O2"
  44. LIBDIRSUFFIX=""
  45. fi
  46. set -e
  47. rm -rf $PKG
  48. mkdir -p $TMP $PKG $OUTPUT
  49. cd $TMP
  50. rm -rf $PRGNAM-$VERSION
  51. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  52. cd $PRGNAM-$VERSION
  53. chown -R root:root .
  54. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  55. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  56. # meson takes an option to say where to install the config file, but
  57. # it doesn't actually change where the binary looks for it.
  58. sed -i -e 's,/etc/imv_config,/etc/imv/imv_config,' \
  59. -e '/\/usr\/local\/etc/d' \
  60. src/imv.c doc/imv.1.txt
  61. mkdir build
  62. cd build
  63. CFLAGS="$SLKCFLAGS" \
  64. CXXFLAGS="$SLKCFLAGS" \
  65. meson .. \
  66. --buildtype=release \
  67. --infodir=/usr/info \
  68. --libdir=/usr/lib${LIBDIRSUFFIX} \
  69. --localstatedir=/var \
  70. --mandir=/usr/man \
  71. --prefix=/usr \
  72. --sysconfdir=/etc/$PRGNAM \
  73. -Dstrip=true
  74. "${NINJA:=ninja}"
  75. DESTDIR=$PKG $NINJA install
  76. cd ..
  77. gzip -9 $PKG/usr/man/man?/*.?
  78. mv $PKG/etc/$PRGNAM/${PRGNAM}_config $PKG/etc/$PRGNAM/${PRGNAM}_config.new
  79. # Slackware doesn't have an icon called multimedia-photo-viewer...
  80. mkdir -p $PKG/usr/share/applications
  81. sed -i "s,multimedia-photo-viewer,$PRGNAM," \
  82. $PKG/usr/share/applications/*.desktop
  83. # Icon came from Debian moka-icon-theme package. I have no idea
  84. # what the default icon theme is in Debian (equivalent of hicolor in
  85. # Slackware). Don't care, either. So I picked one at random.
  86. for i in 16 22 24 48 64 96; do
  87. mkdir -p $PKG/usr/share/icons/hicolor/${i}x${i}/apps
  88. cat $CWD/icons/$i.png > $PKG/usr/share/icons/hicolor/${i}x${i}/apps/$PRGNAM.png
  89. done
  90. mkdir -p $PKG/usr/share/pixmaps
  91. ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
  92. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  93. cp -a AUTHORS* CHANGE* CONTRIB* LICENSE* README* $PKG/usr/doc/$PRGNAM-$VERSION
  94. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  95. mkdir -p $PKG/install
  96. # update slack-desc to say which optional deps are included
  97. F=no; G=no; H=no
  98. ldd $PKG/usr/bin/$PRGNAM-x11 > lddtmp
  99. grep -q 'libfreeimage' lddtmp && F=yes
  100. grep -q 'libnsgif' lddtmp && G=yes
  101. grep -q 'libheif' lddtmp && H=yes
  102. sed -e "s,@F@,$F," \
  103. -e "s,@G@,$G," \
  104. -e "s,@H@,$H," \
  105. $CWD/slack-desc > $PKG/install/slack-desc
  106. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  107. cd $PKG
  108. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE