summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7c476d0fba7afe16f76e2a0df961919233d308d6 (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
# Maintainer: Jamison Lahman <jamison+aur@lahman.dev>

pkgname=buildifier
pkgver=7.3.1
pkgrel=6
pkgdesc='A command line tool to format Bazel BUILD files'
arch=('x86_64' 'aarch64')
license=('Apache')
url='https://github.com/bazelbuild/buildtools'
makedepends=('git' 'python')
conflicts=('buildifier-bin')
_commit='45b7ddb516e521e68794bf409d73ff8a32641de3'
source=("${pkgname}::git+$url.git#commit=$_commit")
_bazelisk_pkgver="1.25.0"
source_x86_64=(
  "bazelisk-bin-x86_64-${_bazelisk_pkgver}::https://github.com/bazelbuild/bazelisk/releases/download/v${_bazelisk_pkgver}/bazelisk-linux-amd64"
)
source_aarch64=(
  "bazelisk-bin-aarch64-${_bazelisk_pkgver}::https://github.com/bazelbuild/bazelisk/releases/download/v${_bazelisk_pkgver}/bazelisk-linux-arm64"
)
md5sums=('SKIP')
sha256sums_x86_64=('fd8fdff418a1758887520fa42da7e6ae39aefc788cf5e7f7bb8db6934d279fc4')
sha256sums_aarch64=('4c8d966e40ac2c4efcc7f1a5a5cceef2c0a2f16b957e791fa7a867cce31e8fcb')

prepare() {
  chmod +x "${srcdir}/bazelisk-bin-${CARCH}-${_bazelisk_pkgver}"
}

build() {
  cd "${pkgname}" || exit

  "${srcdir}/bazelisk-bin-${CARCH}-${_bazelisk_pkgver}" build --config=release "//${pkgname}"
  "${srcdir}/bazelisk-bin-${CARCH}-${_bazelisk_pkgver}" shutdown
}

package() {
  cd "${pkgname}" || exit

  # Install the license file
  install -D -m 0644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

  # Install the binary
  install -D -m 0755 \
    "./bazel-bin/${pkgname}/${pkgname}_/${pkgname}" \
    "${pkgdir}/usr/bin/${pkgname}"
}