101 lines
2.9 KiB
Bash
101 lines
2.9 KiB
Bash
#!/bin/bash
|
|
|
|
# Slackware build script for aaphoto
|
|
|
|
# Original author: Alexander Verbovetsky, Moscow, Russia
|
|
# Now maintained by B. Watson <urchlay@slackware.uk>.
|
|
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
|
|
|
|
# 20241007 bkw: BUILD=2
|
|
# - take over maintenance.
|
|
# - make COMMIT overrideable in env (probably not worth doing).
|
|
# - add man page.
|
|
# - patch the code so it prints error messages for unsupported files.
|
|
# - grammar fixes for README and slack-desc.
|
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
PRGNAM=aaphoto
|
|
VERSION=${VERSION:-0.45}
|
|
COMMIT="${COMMIT:-ad4fc3c04b9e25212d78c231e1507458dfea8909}" # this is ver. 0.45
|
|
BUILD=${BUILD:-2}
|
|
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-$COMMIT
|
|
tar xvf $CWD/${PRGNAM}-${COMMIT}.tar.gz
|
|
cd $PRGNAM-$COMMIT
|
|
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 {} +
|
|
|
|
# 20241007 bkw: patch makes it print an "image can't be loaded"
|
|
# message for unsupported files (instead of just "done"). Avoids
|
|
# confusing the user. It also makes aaphoto exit with error status if
|
|
# all of the input files were unsupported (success = at least one file
|
|
# was processed).
|
|
patch -p1 < $CWD/err_unsupport_format.diff
|
|
|
|
CFLAGS="$SLKCFLAGS" \
|
|
CXXFLAGS="$SLKCFLAGS" \
|
|
./configure \
|
|
--prefix=/usr \
|
|
--build=$ARCH-slackware-linux
|
|
|
|
make
|
|
make install-strip DESTDIR=$PKG
|
|
|
|
# 20241007 bkw: man page came from Debian, but has been modified to
|
|
# remove all references to .jp2 and jasper. This is because upstream
|
|
# dropped jp2/jasper support, but forgot to update the man page. I
|
|
# thought about re-adding jp2/jasper support, but it's a good bit of
|
|
# work... and as upstream points out, nobody uses it anyway. I also
|
|
# added some remarks about filename extensions, since aaphoto relies
|
|
# entirely on the extension to determine file type; also documented
|
|
# the exit status (due to the patch, above).
|
|
mkdir -p $PKG/usr/man/man1
|
|
gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
|
|
|
|
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
|
|
mkdir -p $PKGDOC
|
|
cp -a AUTHORS COPYRIGHT ChangeLog NEWS README REMARKS TODO $PKGDOC
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$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
|