summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9e6b9683e01b7db3ee37fd7ff7c5871c5f41a4e4 (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
# Maintainer: Overl1te Overl1teGithub@yandex.ru

pkgname=chronodash
pkgver=2.2.7_beta
pkgrel=1
pkgdesc="Transparent always-on-top desktop widgets (clocks, weather etc)"
arch=('x86_64')
url="https://github.com/Overl1te/ChronoDash"
license=('GPL3')
depends=('python' 'qt6-base' 'qt6-svg' 'libx11' 'tk' 'glibc')
makedepends=('git' 'python-pip' 'python-wheel' 'python-setuptools')
provides=('chronodash')
conflicts=('chronodash-bin' 'chronodash-git')
source=("git+https://github.com/Overl1te/ChronoDash.git")
sha256sums=('SKIP')

pkgver() {
  cd "${srcdir}/ChronoDash"
  local count=$(git rev-list --count HEAD 2>/dev/null || echo 0)
  local hash=$(git rev-parse --short HEAD 2>/dev/null || echo unknown)
  printf "2.2.5.7_beta.r%s.%s" "$count" "$hash"
}

prepare() {
  cd "${srcdir}/ChronoDash"
  python -m venv venv
  source venv/bin/activate
  pip install --no-cache-dir --upgrade pip
  pip install --no-cache-dir -r requirements.txt || { echo "Pip install failed!"; exit 1; }
  deactivate
}

build() {
  cd "${srcdir}/ChronoDash"
  source venv/bin/activate
  bash build_arch.sh || { echo "build_arch.sh failed! Check logs."; exit 1; }
  deactivate
}

package() {
  cd "${srcdir}/ChronoDash"

  install -dm755 "$pkgdir/opt/chronodash"
  if [[ -d "dist/ChronoDash" ]]; then
    cp -r dist/ChronoDash/* "$pkgdir/opt/chronodash/"
  elif [[ -d "dist" && -n "$(ls dist/ 2>/dev/null)" ]]; then
    cp -r dist/* "$pkgdir/opt/chronodash/"
  else
    echo "Error: dist/ not found after build!"
    exit 1
  fi

  install -dm755 "$pkgdir/usr/bin"
  cat > "$pkgdir/usr/bin/chronodash" << 'EOF'
#!/bin/bash
export LD_LIBRARY_PATH=/opt/chronodash/lib:$LD_LIBRARY_PATH
exec /opt/chronodash/ChronoDash "$@"
EOF
  chmod +x "$pkgdir/usr/bin/chronodash"

  # Иконка
  install -dm755 "$pkgdir/usr/share/icons/hicolor/64x64/apps"
  for icon in assets/icons/{chronodash,logo,app,icon}.png; do
    if [[ -f "$icon" ]]; then
      install -Dm644 "$icon" "$pkgdir/usr/share/icons/hicolor/64x64/apps/chronodash.png"
      break
    fi
  done

  install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/chronodash.desktop" << EOF
[Desktop Entry]
Type=Application
Version=1.5
Name=ChronoDash
GenericName=Desktop Widgets
Comment=Modern, customizable desktop widgets
Exec=chronodash
TryExec=chronodash
Icon=chronodash
Terminal=false
StartupNotify=true
Categories=Utility;System;
EOF

  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}