#!/bin/bash # Slackware build script for meh # Copyright 2014 Leonard Schmidt # All rights reserved. # # Permission to use, copy, modify, and distribute this software for any purpose # with or without fee is hereby granted, provided that the above copyright # notice and this permission notice appear in all copies. # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # AUTHORS AND COPYRIGHT HOLDERS AND THEIR CONTRIBUTORS BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Now maintained by B. Watson . # 20250117 bkw: BUILD=2 # - stop spewing spurious 'GIFLIB: (null)' to stderr when viewing gifs. # - fix imagemagick support so it actually *works*. # - add GIF to the list of built-in formats in README, man page. # - mention that animations aren't supported in README, man. # 20180628 bkw: # - Take over maintenance. # - Add man page, BUILD=2 # - Script simplifications. cd $(dirname $0) ; CWD=$(pwd) PRGNAM=meh VERSION=${VERSION:-0.3} BUILD=${BUILD:-3} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac fi if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 fi TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} if [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i586 -mtune=i686" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" else SLKCFLAGS="-O2" fi set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION tar xvf $CWD/$PRGNAM-$VERSION.tar.gz cd $PRGNAM-$VERSION chown -R root:root . find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ # 20250117 bkw: Fixes for giflib-5.1, originally from # https://github.com/jhawthorn/meh but modified slightly: # DGifCloseFile(g->gif,&ret) sets ret to D_GIF_SUCCEEDED (aka 0) on # success, *NOT* GIF_OK (aka 1). patch -p1 < $CWD/meh-giflib.patch # 20250117 bkw: this fixes imagemagick support, so we can view e.g. # webp, jpeg2000, etc. sed -i '/argv/s,"255","16",' src/imagemagick.c CFLAGS="$SLKCFLAGS" make install -D -s -o root -g root -m 755 $PRGNAM $PKG/usr/bin/$PRGNAM # 20180628 bkw: Man page originally came from upstream's git, and I # added the key bindings section (and sent a patch upstream, hopefully # he likes it). # 20250119 bkw: add GIF to the list of builtin types, mention that # animation's not supported. mkdir -p $PKG/usr/man/man1 gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a AUTHORS BUGS COPYING NEWS README THANKS $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE