summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e0f9382786db7f3a9faa8f5ad5a17b2b0ae3433e (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
87
88
89
90
91
92
93
94
95
96
# Maintainer: Carl Smedstad <carl.smedstad at protonmail dot com>

pkgname=bicep
pkgver=0.25.53
_commit=c0ad57dff6c96bd5e9ef013b4d7c2caa3ef7a0c3
pkgrel=1
pkgdesc="A declarative language for describing and deploying Azure resources"
arch=(x86_64)
url="https://github.com/Azure/bicep"
license=(MIT)
_dotnet_version=8.0
depends=(
  "dotnet-runtime-$_dotnet_version"
  gcc-libs
  glibc
)
makedepends=(
  "dotnet-sdk-$_dotnet_version"
  git
)
options=(!strip)
source=("git+$url.git?signed#commit=$_commit")
sha256sums=('SKIP')
validpgpkeys=('968479A1AFF927E37D1A566BB5690EEEBB952194') # GitHub <noreply@github.com>

_archive="$pkgname"

pkgver() {
  cd "$_archive"

  git describe --tags | sed 's/^v//'
}

prepare() {
  cd "$_archive"

  export NUGET_PACKAGES="$PWD/nuget"
  export DOTNET_NOLOGO=true
  export DOTNET_CLI_TELEMETRY_OPTOUT=true
  dotnet restore --locked-mode src/Bicep.Cli
  dotnet restore --locked-mode src/Bicep.Cli.IntegrationTests
  dotnet restore --locked-mode src/Bicep.Cli.UnitTests

  # I couldn't find any way of silencing the very verbose warnings from
  # Microsoft.SourceLink other than to set the remote to a proper URL..
  git remote set-url origin "$url"

  sed -i 's|<PublishTrimmed>true</PublishTrimmed>|<PublishTrimmed>false</PublishTrimmed>|' \
    src/Bicep.Cli/Bicep.Cli.csproj
}

build() {
  cd "$_archive"

  export NUGET_PACKAGES="$PWD/nuget"
  export DOTNET_NOLOGO=true
  export DOTNET_CLI_TELEMETRY_OPTOUT=true
  dotnet publish \
    --no-restore \
    --framework "net$_dotnet_version" \
    --runtime linux-x64 \
    --no-self-contained \
    --configuration Release \
    --output lib \
    src/Bicep.Cli
}

check() {
  cd "$_archive"

  export NUGET_PACKAGES="$PWD/nuget"
  export DOTNET_NOLOGO=true
  export DOTNET_CLI_TELEMETRY_OPTOUT=true
  dotnet test \
    --no-restore \
    --framework "net$_dotnet_version" \
    ./src/Bicep.Cli.IntegrationTests
  dotnet test \
    --no-restore \
    --framework "net$_dotnet_version" \
    ./src/Bicep.Cli.UnitTests
}

package() {
  cd "$_archive"

  local pkgnum=${pkgver:0:1}

  install -dm755 "$pkgdir/usr/lib/$pkgname-$pkgnum"
  cp -a -t "$pkgdir/usr/lib/$pkgname-$pkgnum" lib/*

  install -dm755 "$pkgdir/usr/bin"
  ln -s "/usr/lib/$pkgname-$pkgnum/bicep" "$pkgdir/usr/bin/bicep"

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