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