feh.SlackBuild 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/bin/sh
  2. # Slackware build script for feh
  3. # Copyright 2006-2009 Chess Griffin <chess@chessgriffin.com>
  4. # Copyright 2011-2012 Grigorios Bouzakis <grbzks@imap.cc>
  5. # Copyright 2014-2015 Luka Novsak <lnovsak@gmail.com>
  6. # Copyright 2017-2021 Hunter Sezen <orbea@riseup.net>
  7. # All rights reserved.
  8. #
  9. # Permission to use, copy, modify, and distribute this software for any purpose
  10. # with or without fee is hereby granted, provided that the above copyright
  11. # notice and this permission notice appear in all copies.
  12. #
  13. # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  14. # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  15. # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  16. # AUTHORS AND COPYRIGHT HOLDERS AND THEIR CONTRIBUTORS BE LIABLE FOR ANY
  17. # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  18. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  19. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  21. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  22. # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. PRGNAM=feh
  24. VERSION=${VERSION:-3.6.1}
  25. BUILD=${BUILD:-1}
  26. TAG=${TAG:-_SBo}
  27. if [ -z "$ARCH" ]; then
  28. case "$( uname -m )" in
  29. i?86) ARCH=i586 ;;
  30. arm*) ARCH=arm ;;
  31. *) ARCH=$( uname -m ) ;;
  32. esac
  33. fi
  34. CWD=$(pwd)
  35. TMP=${TMP:-/tmp/SBo}
  36. PKG=$TMP/package-$PRGNAM
  37. OUTPUT=${OUTPUT:-/tmp}
  38. if [ "$ARCH" = "i586" ]; then
  39. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  40. LIBDIRSUFFIX=""
  41. elif [ "$ARCH" = "i686" ]; then
  42. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  43. LIBDIRSUFFIX=""
  44. elif [ "$ARCH" = "x86_64" ]; then
  45. SLKCFLAGS="-O2 -fPIC"
  46. LIBDIRSUFFIX="64"
  47. else
  48. SLKCFLAGS="-O2"
  49. LIBDIRSUFFIX=""
  50. fi
  51. set -eu
  52. rm -rf $PKG
  53. mkdir -p $TMP $PKG $OUTPUT
  54. cd $TMP
  55. rm -rf $PRGNAM-$VERSION
  56. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  57. chmod 0755 $PRGNAM-$VERSION
  58. cd $PRGNAM-$VERSION
  59. chown -R root:root .
  60. find -L . \
  61. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  62. -o -perm 511 \) -exec chmod 755 {} \; -o \
  63. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  64. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  65. [ "${EXIF:=0}" = 0 ] || EXIF=1
  66. [ "${HELP:=0}" = 0 ] || HELP=1
  67. [ "${INOTIFY:=0}" = 0 ] || INOTIFY=1
  68. [ "${STAT64:=0}" = 0 ] || STAT64=1
  69. CFLAGS="$SLKCFLAGS" \
  70. make \
  71. PREFIX=/usr \
  72. exif=$EXIF \
  73. help=$HELP \
  74. inotify=$INOTIFY \
  75. stat64=$STAT64
  76. make install \
  77. DESTDIR=$PKG \
  78. PREFIX=/usr \
  79. man_dir=$PKG/usr/man \
  80. doc_dir=$PKG/usr/doc/$PRGNAM-$VERSION \
  81. example_dir=$PKG/usr/doc/$PRGNAM-$VERSION/examples
  82. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" |
  83. grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  84. find $PKG/usr/man -type f -exec gzip -9 {} \;
  85. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  86. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  87. cp -a COPYING $PKG/usr/doc/$PRGNAM-$VERSION
  88. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  89. mkdir -p $PKG/install
  90. cat $CWD/slack-desc > $PKG/install/slack-desc
  91. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  92. cd $PKG
  93. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}