aboutsummaryrefslogtreecommitdiff
path: root/system/rtcqs/rtcqs.SlackBuild
blob: 9556e67f39a2e23d75ab949a055f2b9b130ec004 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/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.

# 20251216 bkw:
# - update for v0.6.7.
# - PySimpleGui is gone, new dep freesimplegui.
# - have to use python3-setuptools-opt now.
# - add 48x48 bitmap icon.

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

PRGNAM=rtcqs
VERSION=${VERSION:-0.6.7}
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 . ! -type l    -a \
  \(     -perm /111 -a ! -perm 755 -a -exec chmod -f 755 {} + \) -o \
  \(   ! -perm /111 -a ! -perm 644 -a -exec chmod -f 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

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/{48x48,scalable}/apps,applications,pixmaps}
install -m0644 $PRGNAM.desktop $PKG/usr/share/applications/
install -m0644 rtcqs_logo.svg $PKG/usr/share/icons/hicolor/scalable/apps/$PRGNAM.svg

# 20251216 bkw: should have at least one bitmap icon, in case something doesn't
# support SVGs.
rsvg-convert \
  -o $PKG/usr/share/icons/hicolor/48x48/apps/$PRGNAM.png \
  -w 48 \
  -h 48 \
  rtcqs_logo.svg

ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png

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