2021-07-04 01:48:15 +08:00
|
|
|
#!/bin/bash
|
2010-05-12 04:54:15 +08:00
|
|
|
|
|
|
|
# Slackware build script for libtorrent (rasterbar)
|
2010-05-13 06:32:01 +08:00
|
|
|
|
2020-06-03 17:02:28 +08:00
|
|
|
# Copyright 2019-2020 Donald Cooley, South Haven, Indiana, USA
|
2015-03-04 02:26:20 +08:00
|
|
|
# Copyright 2009-2015 Erik W. Hanson, Minneapolis, MN, USA
|
2010-05-13 06:32:01 +08:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS 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 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.
|
2010-05-12 04:54:15 +08:00
|
|
|
|
2021-07-04 17:41:06 +08:00
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
|
2010-05-12 04:54:15 +08:00
|
|
|
PRGNAM=libtorrent-rasterbar
|
2020-11-21 12:37:41 +08:00
|
|
|
VERSION=${VERSION:-1.2.11}
|
2019-12-19 22:52:14 +08:00
|
|
|
BUILD=${BUILD:-1}
|
2010-05-12 04:54:15 +08:00
|
|
|
TAG=${TAG:-_SBo}
|
2021-07-04 18:23:38 +08:00
|
|
|
PKGTYPE=${PKGTYPE:-tgz}
|
|
|
|
|
|
|
|
# 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 "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
|
|
|
exit 0
|
|
|
|
fi
|
2010-05-12 04:54:15 +08:00
|
|
|
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
2010-06-12 17:11:27 +08:00
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
2016-11-24 17:01:55 +08:00
|
|
|
i?86) export ARCH=i586 ;;
|
2010-06-12 17:11:27 +08:00
|
|
|
arm*) export ARCH=arm ;;
|
|
|
|
*) export ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2016-11-24 17:01:55 +08:00
|
|
|
if [ "$ARCH" = "i586" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
2010-05-13 06:32:01 +08:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-12 04:54:15 +08:00
|
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
2010-05-13 06:32:01 +08:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-12 23:41:49 +08:00
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
2010-05-13 06:32:01 +08:00
|
|
|
LIBDIRSUFFIX="64"
|
2010-06-12 17:11:27 +08:00
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
2010-05-12 04:54:15 +08:00
|
|
|
fi
|
|
|
|
|
2018-03-05 08:09:56 +08:00
|
|
|
set -e
|
2010-05-13 06:32:01 +08:00
|
|
|
|
2010-05-12 04:54:15 +08:00
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
|
|
|
rm -rf $PRGNAM-$VERSION
|
2012-04-03 03:10:08 +08:00
|
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.?z*
|
2010-05-12 04:54:15 +08:00
|
|
|
cd $PRGNAM-$VERSION
|
|
|
|
chown -R root:root .
|
2013-11-25 19:23:31 +08:00
|
|
|
find -L . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
|
|
|
|
-o -perm 511 \) -exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
2016-11-24 17:01:55 +08:00
|
|
|
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
2010-05-12 04:54:15 +08:00
|
|
|
|
2018-03-05 08:09:56 +08:00
|
|
|
# https://github.com/qbittorrent/qBittorrent/issues/6383#issuecomment-281535787
|
2019-12-19 22:52:14 +08:00
|
|
|
sed -i -e "s/+ target_specific(),/+ target_specific() + ['-std=c++14'],/" \
|
2018-03-05 08:09:56 +08:00
|
|
|
bindings/python/setup.py
|
|
|
|
|
2019-03-05 02:24:04 +08:00
|
|
|
EXAMPLES=${EXAMPLES:-no}
|
|
|
|
[ "$EXAMPLES" = "yes" ] && examples="--enable-examples"
|
|
|
|
|
2010-05-12 04:54:15 +08:00
|
|
|
CFLAGS="$SLKCFLAGS" \
|
2019-12-19 22:52:14 +08:00
|
|
|
CXXFLAGS="$SLKCFLAGS -std=c++14" \
|
2010-05-13 06:32:01 +08:00
|
|
|
LDFLAGS="-L/usr/lib${LIBDIRSUFFIX}" \
|
2010-05-12 04:54:15 +08:00
|
|
|
./configure \
|
|
|
|
--prefix=/usr \
|
2010-05-13 06:32:01 +08:00
|
|
|
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
2010-05-12 04:54:15 +08:00
|
|
|
--sysconfdir=/etc \
|
|
|
|
--localstatedir=/var/lib \
|
|
|
|
--disable-static \
|
2010-05-12 23:41:49 +08:00
|
|
|
--enable-python-binding \
|
2018-02-19 08:48:50 +08:00
|
|
|
--enable-encryption \
|
2019-03-05 02:24:04 +08:00
|
|
|
$examples \
|
2010-05-22 22:04:37 +08:00
|
|
|
--with-boost-libdir=/usr/lib${LIBDIRSUFFIX} \
|
2018-02-19 08:48:50 +08:00
|
|
|
--disable-debug \
|
2010-05-12 04:54:15 +08:00
|
|
|
--build=$ARCH-slackware-linux
|
|
|
|
|
|
|
|
make
|
|
|
|
make install-strip DESTDIR=$PKG
|
|
|
|
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
2019-09-26 17:39:34 +08:00
|
|
|
cp -a AUTHORS COPYING ChangeLog NEWS docs/ tools/ \
|
2010-05-12 04:54:15 +08:00
|
|
|
$PKG/usr/doc/$PRGNAM-$VERSION
|
2019-03-05 02:24:04 +08:00
|
|
|
|
|
|
|
if [ "$EXAMPLES" = "yes" ]; then
|
|
|
|
cp -a examples/ $PKG/usr/doc/$PRGNAM-$VERSION
|
2019-09-26 17:39:34 +08:00
|
|
|
cp -a ed25519/ $PKG/usr/doc/$PRGNAM-$VERSION
|
2019-03-05 02:24:04 +08:00
|
|
|
fi
|
|
|
|
|
2019-09-26 17:39:34 +08:00
|
|
|
find $PKG \
|
|
|
|
\( -name .deps -o -name .libs -o -name .dirstamp \
|
|
|
|
\) -exec rm -rf {} \; || true
|
|
|
|
|
2010-05-12 04:54:15 +08:00
|
|
|
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
|
2021-07-04 18:23:38 +08:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|