2018-05-28 21:12:29 +02:00
|
|
|
#!/bin/bash
|
2010-05-19 10:58:23 +02:00
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
# Copyright 2013, 2015, 2016, 2018 Patrick J. Volkerding, Sebeka, MN, USA
|
2016-06-30 22:26:57 +02:00
|
|
|
# Copyright 2013 Eric Hameleers, Eindhoven, NL
|
2010-05-19 10:58:23 +02:00
|
|
|
# All rights reserved.
|
2016-06-30 22:26:57 +02:00
|
|
|
|
2010-05-19 10:58:23 +02:00
|
|
|
# Redistribution and use of this script, with or without modification, is
|
|
|
|
# permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of this script must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
#
|
2016-06-30 22:26:57 +02:00
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
2010-05-19 10:58:23 +02:00
|
|
|
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
|
|
# EVENT SHALL THE AUTHOR 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.
|
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
|
2016-06-30 22:26:57 +02:00
|
|
|
PKGNAM=LibRaw
|
2018-06-12 07:02:45 +02:00
|
|
|
VERSION=${VERSION:-0.18.12}
|
2018-05-28 21:12:29 +02:00
|
|
|
DEMOSAIC=${DEMOSAIC:-0.18.8}
|
2010-05-19 10:58:23 +02:00
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
|
2018-09-21 20:51:07 +02:00
|
|
|
NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
|
2016-06-30 22:26:57 +02:00
|
|
|
|
|
|
|
# Automatically determine the architecture we're building on:
|
|
|
|
MARCH=$( uname -m )
|
2010-05-19 10:58:23 +02:00
|
|
|
if [ -z "$ARCH" ]; then
|
2016-06-30 22:26:57 +02:00
|
|
|
case "$MARCH" in
|
|
|
|
i?86) export ARCH=i586 ;;
|
|
|
|
armv7hl) export ARCH=$MARCH ;;
|
|
|
|
arm*) export ARCH=arm ;;
|
2010-05-19 10:58:23 +02:00
|
|
|
# Unless $ARCH is already set, use uname -m for all other archs:
|
2016-06-30 22:26:57 +02:00
|
|
|
*) export ARCH=$MARCH ;;
|
2010-05-19 10:58:23 +02:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
|
|
|
|
# the name of the created package would be, and then exit. This information
|
|
|
|
# could be useful to other scripts.
|
|
|
|
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
|
|
|
echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2016-06-30 22:26:57 +02:00
|
|
|
if [ "$ARCH" = "i586" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
2010-05-19 10:58:23 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2016-06-30 22:26:57 +02:00
|
|
|
elif [ "$ARCH" = "s390" ]; then
|
|
|
|
SLKCFLAGS="-O2"
|
2010-05-19 10:58:23 +02:00
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
|
|
|
LIBDIRSUFFIX="64"
|
2016-06-30 22:26:57 +02:00
|
|
|
elif [ "$ARCH" = "armv7hl" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16"
|
|
|
|
LIBDIRSUFFIX=""
|
2010-05-19 10:58:23 +02:00
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
fi
|
|
|
|
|
2016-06-30 22:26:57 +02:00
|
|
|
case "$ARCH" in
|
|
|
|
arm*) TARGET=$ARCH-slackware-linux-gnueabi ;;
|
|
|
|
*) TARGET=$ARCH-slackware-linux ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
TMP=${TMP:-/tmp}
|
|
|
|
PKG=$TMP/package-$PKGNAM
|
|
|
|
|
2010-05-19 10:58:23 +02:00
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG
|
|
|
|
cd $TMP
|
2016-06-30 22:26:57 +02:00
|
|
|
rm -rf $PKGNAM-$VERSION-build
|
|
|
|
mkdir $PKGNAM-$VERSION-build
|
|
|
|
cd $PKGNAM-$VERSION-build
|
2018-05-28 21:12:29 +02:00
|
|
|
tar xvf $CWD/$PKGNAM-$VERSION.tar.?z || exit 1
|
|
|
|
tar xvf $CWD/$PKGNAM-demosaic-pack-GPL2-$DEMOSAIC.tar.?z || exit 1
|
|
|
|
tar xvf $CWD/$PKGNAM-demosaic-pack-GPL3-$DEMOSAIC.tar.?z || exit 1
|
2010-05-19 10:58:23 +02:00
|
|
|
cd $PKGNAM-$VERSION || exit 1
|
2016-06-30 22:26:57 +02:00
|
|
|
|
2010-05-19 10:58:23 +02:00
|
|
|
chown -R root:root .
|
|
|
|
find . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
|
|
|
-exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
|
|
-exec chmod 644 {} \;
|
|
|
|
|
|
|
|
CFLAGS="$SLKCFLAGS" \
|
2016-06-30 22:26:57 +02:00
|
|
|
CXXFLAGS="$SLKCFLAGS" \
|
2010-05-19 10:58:23 +02:00
|
|
|
./configure \
|
|
|
|
--prefix=/usr \
|
|
|
|
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
2012-09-26 03:10:42 +02:00
|
|
|
--sysconfdir=/etc \
|
2016-06-30 22:26:57 +02:00
|
|
|
--localstatedir=/var \
|
2012-09-26 03:10:42 +02:00
|
|
|
--mandir=/usr/man \
|
|
|
|
--docdir=/usr/doc/$PKGNAM-$VERSION \
|
2016-06-30 22:26:57 +02:00
|
|
|
--disable-static \
|
2018-05-28 21:12:29 +02:00
|
|
|
--enable-demosaic-pack-gpl2=../LibRaw-demosaic-pack-GPL2-$DEMOSAIC \
|
|
|
|
--enable-demosaic-pack-gpl3=../LibRaw-demosaic-pack-GPL3-$DEMOSAIC \
|
2016-06-30 22:26:57 +02:00
|
|
|
--enable-jasper \
|
|
|
|
--enable-lcms \
|
|
|
|
--disable-examples \
|
2018-05-28 21:12:29 +02:00
|
|
|
--build=$TARGET || exit 1
|
2012-09-26 03:10:42 +02:00
|
|
|
|
|
|
|
make $NUMJOBS || make || exit 1
|
|
|
|
make install DESTDIR=$PKG || exit 1
|
2010-05-19 10:58:23 +02:00
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
# Don't ship .la files:
|
|
|
|
rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
|
|
|
|
|
2012-09-26 03:10:42 +02:00
|
|
|
find $PKG | xargs file | grep -e "executable" -e "shared object" \
|
2016-06-30 22:26:57 +02:00
|
|
|
| grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
|
2010-05-19 10:58:23 +02:00
|
|
|
|
|
|
|
mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
|
|
|
|
cp -a \
|
2018-05-28 21:12:29 +02:00
|
|
|
COPYRIGHT Changelog.txt LICENSE* README* doc \
|
2016-06-30 22:26:57 +02:00
|
|
|
$PKG/usr/doc/$PKGNAM-$VERSION
|
|
|
|
mv $PKG/usr/doc/$PKGNAM-$VERSION/doc $PKG/usr/doc/$PKGNAM-$VERSION/html
|
|
|
|
find $PKG/usr/doc/$PKGNAM-$VERSION -type f -exec chmod 0644 {} \;
|
2010-05-19 10:58:23 +02:00
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
|
|
|
|
cd $PKG
|
|
|
|
/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
|
2016-06-30 22:26:57 +02:00
|
|
|
|