aboutsummarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d543a3d7d4453b474b390262a53138cc124ec1d6 (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
# Maintainer: Daurnimator <daurnimator@archlinux.org>
# Maintainer: Vincent BESANCON (bigbrozer) <besancon.vincent@gmail.com>
# Blobfuse2 version is rewritten in Go, inspiration from https://aur.archlinux.org/packages/pluto.
_pkgname=blobfuse2
pkgname=azure-storage-fuse
pkgver=2.3.0
pkgrel=1
pkgdesc="A virtual file system adapter for Azure Blob storage (blobfuse2)"
arch=('x86_64')
url="https://github.com/Azure/azure-storage-fuse"
license=('MIT')
provides=('blobfuse2')
depends=('fuse2' 'fuse3' 'glibc')
makedepends=('go')
source=("$pkgname-$pkgver.tar.gz::https://github.com/Azure/azure-storage-fuse/archive/refs/tags/blobfuse2-$pkgver.tar.gz")
sha256sums=('9e7c3b98c4967d45405a4b9450fb3e90e329ffefaef1ffa0e6cedfd66991881b')

build() {
  cd "${srcdir}/$pkgname-$_pkgname-$pkgver"

  export GOPATH="${srcdir}/gopath"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"

  go build -o $_pkgname \
    -tags=fuse3 \
    -buildmode=pie \
    -trimpath \
    -mod=readonly \
    -modcacherw \
    -ldflags "-s -w -linkmode=external -extldflags \"${LDFLAGS}\" -X main.version=${pkgver}"
}

package() {
  cd "${srcdir}/$pkgname-$_pkgname-$pkgver"

  install -d "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm0755 "${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"
  install -m0644 README.md doc/*.md "${pkgdir}/usr/share/doc/${pkgname}/"
  install -Dm0644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

  # Install shell completion scripts
  install -d "${srcdir}/completions"
  "${pkgdir}/usr/bin/blobfuse2" completion bash > "${srcdir}/completions/${_pkgname}"
  "${pkgdir}/usr/bin/blobfuse2" completion fish > "${srcdir}/completions/${_pkgname}.fish"
  "${pkgdir}/usr/bin/blobfuse2" completion zsh > "${srcdir}/completions/_${_pkgname}"
  install -Dm 644 "${srcdir}/completions/${_pkgname}" -t "${pkgdir}/usr/share/bash-completion/completions/"
  install -Dm 644 "${srcdir}/completions/${_pkgname}.fish" -t "${pkgdir}/usr/share/fish/vendor_completions.d/"
  install -Dm 644 "${srcdir}/completions/_${_pkgname}" -t "${pkgdir}/usr/share/zsh/site-functions/"
}