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

pkgname=syndical
pkgver=1.1.0
pkgrel=3
_pkgname="Syndical-${pkgver}"
_exe="TheAirBlow.Syndical.Application"
pkgdesc="An alternative to SamLoader - cleaner code, easier to understand and tamper with."
arch=('any')
url="https://github.com/Samsung-Loki/Syndical"
license=('MPL-2.0')
depends=('dotnet-runtime-7.0' 'gcc-libs' 'glibc' 'openssl-1.1')
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/Syndical/archive/refs/tags/v${pkgver}.tar.gz"
        'imei-fix.patch')
sha256sums=('7d8b4156a3fe9b0bb28b358d2fdc61912ab04daae20177fac7aa8430bcd845a0'
            '5434c1d2f8f055fa1c438af8e0ad226f17a572b3fa123a148aafddf36f99bfb8')

prepare() {
  cd "${_pkgname}"
  # IMEI fix 
  patch -Np1 -i "${srcdir}/imei-fix.patch"
}

build() {
  # https://learn.microsoft.com/en-us/dotnet/core/tools/#cli-commands
  # Add needed Nuget packages for building
  _NuPkgs=(
    "BouncyCastle.NetCore"
    "CommandLineParser"
    "Serilog"
    "Serilog.Exceptions"
    "Serilog.Sinks.Console"
    "Spectre.Console"
  )
  _NuVers=(
    "1.8.10"
    "2.8.0"
    "2.10.0"
    "8.0.0"
    "4.0.1"
    "0.42.0"
  )

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

  # Build Visual Studio solution
  dotnet build "${_pkgname}/Syndical.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/*.Application -t "${pkgdir}/opt/${pkgname}"
  # Install executable /usr/bin file
  ln -s "/opt/${pkgname}/${_exe}" "${pkgdir}/usr/bin/${pkgname}"
}

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