summaryrefslogtreecommitdiffstats
path: root/system/openstego/openstego.SlackBuild
blob: f3438c197a2773f940b94b61e47e10174fb649fe (plain)
#!/bin/bash

# Slackware build script for openstego

# Copyright 2012-2014  Fridrich von Stauffenberg <email removed>
# Copyright 2018-2023 B. Watson <urchlay@slackware.uk>
# 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.

# 20230713 bkw:
# - update for v0.8.6.
# - new-style icons.
# - enable antialiased fonts in wrapper script.
# - update doinst.sh.

# 20221228 bkw: update for v0.8.5.

# 20220610 bkw:
# - update for v0.8.4.
# - requires v11 JDK now, update README note.

# 20210221 bkw: update for v0.8.0.

# 20200708 bkw:
# - Update for v0.7.4.
# - Add README note about openjdk8.

# 20180802 bkw:
# - Take over maintenance.
# - Update for v0.7.3.
# - Increase java's allowed memory usage from 512M to 1024M in
#   openstego.sh. This matches upstream's recommendation.

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

PRGNAM=openstego
VERSION=${VERSION:-0.8.6}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

ARCH=noarch

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}

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
unzip $CWD/$PRGNAM-$VERSION.zip
cd $PRGNAM-$VERSION
chown -R root:root .

mkdir -p $PKG/usr/share/$PRGNAM
mv lib/$PRGNAM.jar $PKG/usr/share/$PRGNAM

mkdir -p $PKG/usr/bin
cat $CWD/$PRGNAM.sh > $PKG/usr/bin/$PRGNAM
chmod 755 $PKG/usr/bin/$PRGNAM

# 20230713 bkw: new-style prescaled and scalable icons. openstego.svg
# comes from upstream's official .deb package, on the github releases page,
# and the rest of the icons were made by rendering it with rsvg-convert.
hicolor=$PKG/usr/share/icons/hicolor
for i in $CWD/icons/*.png; do
  px="$( basename $i | cut -d. -f1 )"
  sz=${px}x${px}
  mkdir -p $hicolor/$sz/apps
  cat $i > $hicolor/$sz/apps/$PRGNAM.png
done

mkdir -p $hicolor/scalable/apps
cat $CWD/icons/$PRGNAM.svg > $hicolor/scalable/apps/$PRGNAM.svg

mkdir -p $PKG/usr/share/applications $PKG/usr/share/pixmaps
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
mv LICENSE README $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
cat $CWD/doinst.sh > $PKG/install/doinst.sh

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