summarylogtreecommitdiffstats
path: root/update.sh
blob: ac41f53ff47cd1a8fffcb037cb2b3e8fede6ad7b (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#! /bin/sh

AUR_NAME=sublime-music
PROJ_NAME=sublime-music
PKG_NAME=sublime_music
DESCRIPTION="A native Subsonic/Airsonic/*sonic client for Linux. Built using Python and GTK+."
URL=https://sublimemusic.app
DEPENDS=(
    python-bleach
    python-bottle
    python-dataclasses-json
    python-dateutil
    python-deepdiff
    python-gobject
    python-levenshtein
    python-mpv
    python-peewee
    python-pychromecast
    python-requests
    python-semver
    python-thefuzz
)
LICENSE='GPL3'
ADDITIONAL=

if [[ $# == 0 ]]; then
    echo 'Usage: ./update.sh VERSION_NUMBER'
    exit 1
fi
pkgrel=1
if [[ $# == 2 ]]; then
    pkgrel=$2
fi

SRCS=(
    https://files.pythonhosted.org/packages/source/${PROJ_NAME:0:1}/${PROJ_NAME}/${PKG_NAME}-$1.tar.gz
    https://github.com/sublime-music/sublime-music/archive/refs/tags/v$1.tar.gz
)

printf '' > PKGBUILD
echo "# Maintainer: Sumner Evans <sumner.evans98 at gmail dot com>

pkgbase='${AUR_NAME}'
pkgname=('${AUR_NAME}')
_module='${PKG_NAME}'
pkgver='$1'
pkgrel=$pkgrel
pkgdesc='${DESCRIPTION}'
url='${URL}'
depends=(
    'python'" >> PKGBUILD

# Include the dependencies.
for d in ${DEPENDS[*]}; do
    echo "    '$d'" >> PKGBUILD
done

echo ")
optdepends=(
    'libnm-glib: for changing the Subsonic server address depending on what SSID you are connected to'
    'libnotify: for system song notification support'
    'python-keyring: support for storing passwords in the system keyring'
    'python-pychromecast: support for casting to Chromecast devices'
    'python-bottle: support for casting downloaded files to Chromecasts on the same LAN'
)
makedepends=(
    'python-build'
    'python-flit-core'
    'python-installer'
    'python-sphinx'
)
license=('${LICENSE}')
arch=('any')
source=(" >> PKGBUILD

# Include the dependencies.
for s in ${SRCS[*]}; do
    echo "    '$s'" >> PKGBUILD
done

echo ")
md5sums=()
${ADDITIONAL}

build() {
    cd \"\${srcdir}/\${_module}-\${pkgver}\"
    python -m build --wheel --no-isolation
}

package() {
    pushd \"\${_module}-\${pkgver}\"
    python -m installer --destdir=\"\${pkgdir}\" dist/*.whl

    # Move all of the package data resources to \${pkgdir}/usr/share/sublime-music
    data_dir=\${pkgdir}/usr/share/sublime-music
    mkdir -p \${data_dir}/adapters/subsonic \${data_dir}/dbus \${data_dir}/ui
    pushd \${pkgdir}/usr/lib/python3.11/site-packages/sublime_music
    mv adapters/icons \${data_dir}/adapters
    mv adapters/images \${data_dir}/adapters
    mv adapters/subsonic/icons \${data_dir}/adapters/subsonic
    mv dbus/mpris_specs \${data_dir}/dbus
    mv ui/icons \${data_dir}/ui
    mv ui/images \${data_dir}/ui
    popd

    popd

    pushd \"${AUR_NAME}-\${pkgver}\"

    desktop-file-install --dir=\${pkgdir}/usr/share/applications sublime-music.desktop
    install -Dm644 sublime-music.metainfo.xml \"\${pkgdir}/usr/share/metainfo/sublime-music.metainfo.xml\"

    pushd docs
    make man
    install -Dm644 ./_build/man/sublime-music.1 \"\${pkgdir}/usr/share/man/man1/sublime-music.1\"
    popd

    pushd logo/rendered
    for size in 16 22 32 48 64 72 96 128 192 512 1024; do
        install -Dm644 \${size}.png \${pkgdir}/usr/share/icons/hicolor/\${size}x\${size}/apps/sublime-music.png
    done
    popd

    popd  # pkg
}" >> PKGBUILD

updpkgsums
makepkg --printsrcinfo > .SRCINFO

# Test
makepkg -f