summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4467fa924ac6bfe710ad742bf5ac9ba45acde4a9 (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
# Maintainer: Emre Cetin <aur@ecetin.dev>

_pkgname="galaxybudsclient"
pkgname="${_pkgname}-git"
pkgver=r1276.03742b2
pkgrel=1
pkgdesc="Unofficial manager for the Samsung Galaxy Buds, Buds+, Buds Live and Buds Pro. Master branch."
arch=('x86_64' 'armv7h' 'aarch64')
url="https://github.com/ThePBone/GalaxyBudsClient"
license=('GPL-3.0-only')
depends=('gcc-libs' 'zlib' 'bluez')
makedepends=('git' 'dotnet-sdk>=8.0')
provides=("${pkgname}")
conflicts=("${_pkgname}-bin")
options=('!strip')
source=(
  "${pkgname}::git+https://github.com/ThePBone/GalaxyBudsClient.git"
  "galaxybudsclient.desktop"
)
noextract=()
sha256sums=(
  'SKIP'
  '88677692ff1d7202b9f7aedbb5ec6cc01684041b94220a8da8feb69d9a028f70'
)

pkgver() {
	cd "$srcdir/${pkgname}"

  # Git, no tags available
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
	cd "$srcdir/${pkgname}"
  
  # Detect architecture
  if [ $CARCH == "x86_64" ]; then
    DOTNETARCH="linux-x64"
  elif [ $CARCH == "armv7h" ]; then
    DOTNETARCH="linux-arm"
  elif [ $CARCH == "aarch64" ]; then
    DOTNETARCH="linux-arm64"
  fi

  # Restore dependencies
  dotnet restore -r $DOTNETARCH --configfile "$srcdir/${pkgname}/GalaxyBudsClient/nuget.config" "$srcdir/${pkgname}/GalaxyBudsClient/GalaxyBudsClient.csproj"
}

build() {
	cd "$srcdir/${pkgname}"
  
  # Build
  dotnet publish -r $DOTNETARCH -o "$srcdir/${pkgname}/bin" -c Release -p:PublishTrimmed=true -p:PublishSingleFile=true --self-contained true --no-restore "$srcdir/${pkgname}/GalaxyBudsClient/GalaxyBudsClient.csproj"

  # Set exectuable bit
  cd bin
  chmod +x GalaxyBudsClient
}

package() {
  install -Dm644 "${srcdir}/${_pkgname}.desktop" "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
  install -Dm644 "${srcdir}/${pkgname}/GalaxyBudsClient/Resources/icon_white.png" "${pkgdir}/usr/share/pixmaps/${_pkgname}.png"
  install -Dm755 "$srcdir/${pkgname}/bin/GalaxyBudsClient" "${pkgdir}/usr/bin/${_pkgname}"
}