summaryrefslogtreecommitdiffstats
path: root/network/transmission-remote-gtk/transmission-remote-gtk.SlackBuild
blob: 738a1af006ee33494a69dd8aa4ef25b7820a2076 (plain)
#!/bin/bash

# Slackware build script for transmission-remote-gtk

# Copyright 2012-2016  Chris Walker Copperas Cove, TX
# Copyright 2020-2023 B. Watson <urchlay@slackware.uk>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
#   notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
#   copyright notice, this list of conditions and the following disclaimer
#   in the documentation and/or other materials provided with the
#   distribution.
# * Neither the name of the {company} nor the names of its
#   contributors may be used to endorse or promote products derived from
#   this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "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 COPYRIGHT
# OWNER OR 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.

# 20230713 bkw: update for v1.6.0.
# - new hard dep libsoup3.
# - no more optional mrss dep (upstream dropped the RSS reader).

# 20220623 bkw: update for v1.5.1.
# 20210926 bkw: BUILD=2, make NOTIFY=no also disable libappindicator.
# 20200526 bkw:
# - take over maintenance
# - update for v1.4.1
# - add NOTIFY=no to build --without-libnotify
# - add README note and slack-desc support for optional deps
# - fix homepage and typo in slack-desc
# - build tweaks
# - get rid of the list of translation languages in README, it's
#   no longer accurate (several more added) and I can't be bothered
#   to keep it up-to-date.

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=transmission-remote-gtk
VERSION=${VERSION:-1.6.0}
BUILD=${BUILD:-1}
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"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.?z
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 {} \+

# 20230713 bkw: mangle the meson.build so it works with Slackware
# 15.0's meson-0.59.x. Eventually this will become difficult or
# impossible, hopefully by then we have a new Slackware release with a
# new enough meson.
sed -i -e '/meson_version:/s,0.60.0,0.59.0,' \
       -e "s/'ayatana-appindicator3-0.1', //" \
       meson.build

[ "${NOTIFY:-yes}" = "no" ] && NOTIFYOPT="-Dlibappindicator=disabled"

mkdir build
cd build
  CFLAGS="$SLKCFLAGS" \
  CXXFLAGS="$SLKCFLAGS" \
  meson .. \
    $NOTIFYOPT \
    --buildtype=release \
    --infodir=/usr/info \
    --libdir=/usr/lib${LIBDIRSUFFIX} \
    --localstatedir=/var \
    --mandir=/usr/man \
    --prefix=/usr \
    --sysconfdir=/etc \
    -Dstrip=true
  "${NINJA:=ninja}"
  DESTDIR=$PKG $NINJA install
cd ..

gzip -9 $PKG/usr/man/man1/$PRGNAM.1

# 20200526 bkw: lots of optional deps, let the slack-desc keep track of them
objdump -p $PKG/usr/bin/$PRGNAM | grep NEEDED > ldd.tmp
for i in libappindicator GeoIP; do
  opts+="$i:"
  grep -q $i ldd.tmp && opts+="yes " || opts+="no "
done

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS COPYING ChangeLog README.md $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
sed "s,@opts@,$opts," $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE