summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 15d3dd1e85cd7f5cd6a6496e74a9e4e60b77307d (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: Nikos Toutountzoglou <nikos dot toutou at protonmail dot com>

pkgname=thor-flash-utility
pkgver=1.0.4
pkgrel=4
_pkgname="Thor-${pkgver}"
_exe="TheAirBlow.Thor.Shell"
pkgdesc="Thor Flash Utility (Developed with C#, based on dotnet 7.0)"
arch=('any')
url="https://github.com/Samsung-Loki/Thor"
license=('MPL-2.0')
depends=('dotnet-runtime-7.0' 'gcc-libs' 'glibc')
makedepends=('dotnet-sdk-7.0')
optdepends=('android-udev: Adds udev rules for non-root users (Group adbusers)')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/Samsung-Loki/Thor/archive/refs/tags/${pkgver}.tar.gz")
sha256sums=('7c6a5482a2a6a0af2711849441f8a8227bca240e38ab56ba9a50ed6eb13ed78e')

build() {
  # https://learn.microsoft.com/en-us/dotnet/core/tools/#cli-commands
  # Add needed Nuget packages for building
  _NuPkgs=(
    "K4os.Compression.LZ4.Streams"
    "Serilog"
    "Serilog.Exceptions"
    "Serilog.Sinks.Console"
    "SharpCompress"
    "Spectre.Console"
  )
  _NuVers=(
    "1.3.5"
    "3.0.0-dev-02022"
    "8.4.0"
    "4.1.1-dev-00910"
    "0.33.0"
    "0.47.1-preview.0.8"
  )

  for i in "${!_NuPkgs[@]}"; do
    dotnet add "${_pkgname}/TheAirBlow.Thor.Library/TheAirBlow.Thor.Library.csproj" \
      package "${_NuPkgs[$i]}" -v "${_NuVers[$i]}" \
      --package-directory NuGet
  done

  # Build Visual Studio solution
  dotnet build "${_pkgname}/Thor.sln" \
    --source NuGet \
    --configuration Release \
    --output build

  # https://learn.microsoft.com/en-us/nuget/consume-packages/managing-the-global-packages-and-cache-folders
  # Cleanup NuGet global-packages (optional)
  #dotnet nuget locals all --clear
}

package() {
  # Install package
  install -d "${pkgdir}/usr/bin"
  install -Dm644 ${srcdir}/build/*{.dll,.json} -t "${pkgdir}/opt/${pkgname}"
  install -Dm755 ${srcdir}/build/*.Shell -t "${pkgdir}/opt/${pkgname}"
  # Install executable shell file
  ln -s "/opt/${pkgname}/${_exe}" "${pkgdir}/usr/bin/${pkgname}"
}

# vim:set ts=2 sw=2 et: