slackbuilds/system/rtcqs/rtcqs.SlackBuild

94 lines
2.8 KiB
Bash

#!/bin/bash
# Slackware build script for rtcqs
# Written by B. Watson (urchlay@slackware.uk)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# Note: The GUI for this is actually horrible. You're better
# off running the textmode rtcqs command. There's a fork called
# Millisecond that has a nicer GUI, but it requires a libadwaita newer
# than we can possibly package for Slackware 15.0.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=rtcqs
VERSION=${VERSION:-0.6.6}
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}
set -e
# We have 2 possibilities for the filename, depending on whether
# or not it was downloaded with content-disposition enabled. Unlike
# github, codeberg has no "magic" URL.
TARBALL="$CWD/$PRGNAM-v$VERSION.tar.gz"
[ -e "$TARBALL" ] || TARBALL="$CWD/v$VERSION.tar.gz"
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM
tar xvf $TARBALL
cd $PRGNAM
chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod -h 755 {} + -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod -h 644 {} +
# Fix typo. Might as well give the full path to the filename, too.
sed -i 's,\<\(imits.conf\),/etc/security/l\1,' src/rtcqs/rtcqs.py
# Prevent scary-looking (but harmless) errors in the log, when
# python3-setuptools-scm is installed. Thanks to fourtysixandtwo
# for this snippet.
echo '[tool.setuptools_scm]' >> pyproject.toml
export SETUPTOOLS_SCM_PRETEND_VERSION=$VERSION
# Python is way too fast moving of a target. This avoids a deprecation
# warning that claims it will cause breakage in Feb 2016. See:
# https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
sed -i \
-e 's,^license.*,license-files = ["LICENSE"]\nlicense = "MIT",' \
-e '/License ::/d' \
pyproject.toml
PYVER=$(python3 -c 'import sys; print("%d.%d" % sys.version_info[:2])')
export PYTHONPATH=/opt/python$PYVER/site-packages/
python3 -m build --wheel --no-isolation
python3 -m installer --destdir "$PKG" dist/*.whl
mkdir -p $PKG/usr/share/{icons/hicolor/scalable/apps,applications}
install -m0644 $PRGNAM.desktop $PKG/usr/share/applications/
install -m0644 rtcqs_logo.svg $PKG/usr/share/icons/hicolor/scalable/apps/$PRGNAM.svg
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a LICENSE* README* $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$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