summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7014ea2eaaf9815e9a3e048dc9bae78554d40147 (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
# Maintainer: Julia Abdel-Monem <juliaviolet.dev>
# Maintainer: Parmjot Singh <parmjotsinghrobot at gmail dot com>
# Maintainer: Zhanibek Adilbekov <zhanibek.adilbekov@pm.me>
# shellcheck disable=SC2034,2164,2154
pkgname=auto-cpufreq
pkgver=2.4.0
pkgrel=1
pkgdesc="Automatic CPU speed & power optimizer"
arch=('any')
url="https://github.com/AdnanHodzic/auto-cpufreq"
license=('LGPL-3.0-or-later')
depends=('python' 'python-setuptools' 'python-psutil' 'python-click' 'python-distro' 'python-requests' 'python-gobject' 'python-pyinotify' 'dmidecode' 'gobject-introspection' 'gtk3')
makedepends=('python-build' 'python-installer' 'python-wheel' 'python-poetry-core' 'python-poetry-dynamic-versioning' )

install="$pkgname.install"

source=(
	"$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz"
	"$pkgname.service"
	"001-fix-icon-n-style-locations.patch"
	"002-fix-other-icon-path.patch"
)

prepare() {
	cd "$srcdir/$pkgname-$pkgver"
	sed -i 's|usr/local|usr|g' "scripts/${pkgname}.service" auto_cpufreq/core.py
	patch --strip=2 --input=../001-fix-icon-n-style-locations.patch
	patch --strip=2 --input=../002-fix-other-icon-path.patch

}

sha256sums=('cbaad1562c4fce3e0d9ae5b2749027bfd52190c55a19a3e2ceb2bc41371b9ee9'
            '8ff1c82788f7cb6bf06151e6632aa4006eb09337daf03faa4866d23075b39e1b'
            '227d85df7f71187c87e24388104f0127b13a680c1e859a90a14864a0d29e1fdf'
            '0db58e3a6185418677a5c4f2ea15d7a1becf08bc2d955b8ffb9783190dd4666c')

build() {
	cd "$srcdir/$pkgname-$pkgver"

	POETRY_DYNAMIC_VERSIONING_BYPASS=1 python -m build --wheel --no-isolation
}

package() {
	cd "$srcdir"
	cd $pkgname-$pkgver

	python -m installer --destdir="$pkgdir" dist/*.whl

	# install -Dm755 scripts/auto-cpufreq-venv-wrapper "$pkgdir/usr/bin/auto-cpufreq"
	# install -Dm755 scripts/start_app "$pkgdir/usr/bin/auto-cpufreq-gtk"
	install -Dm644 scripts/org.auto-cpufreq.pkexec.policy -t "$pkgdir/usr/share/polkit-1/actions/"
	install -Dm644 images/icon.png "$pkgdir/usr/share/pixmaps/auto-cpufreq.png"
	install -Dm644 images/icon.png -t "$pkgdir/usr/share/$pkgname/"
	
	mkdir -p $pkgdir/usr/share/$pkgname/scripts/
	mkdir -p $pkgdir/opt/auto-cpufreq/
	
	install -Dm755 scripts/auto-cpufreq-install.sh "$pkgdir/usr/share/$pkgname/scripts/"
	install -Dm755 scripts/auto-cpufreq-remove.sh "$pkgdir/usr/share/$pkgname/scripts/"
	install -Dm644 $srcdir/auto-cpufreq.service "$pkgdir/usr/lib/systemd/system/$pkgname.service"
	install -Dm755 scripts/cpufreqctl.sh "$pkgdir/usr/share/$pkgname/scripts/"
	install -Dm644 scripts/style.css "$pkgdir/usr/share/$pkgname/scripts/"
	install -Dm644 scripts/auto-cpufreq-gtk.desktop -t "$pkgdir/usr/share/applications/"

}