summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 575efaa7b5f67fa76f0b073b31de587224dbe9a0 (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
# Maintainer: Lobo Torres <lobo@quiltro.org>
# -*- mode: sh -*-

pkgname='betula'
pkgver=1.3.1
pkgrel=1
pkgdesc='Self-hosted personal link collection manager'
arch=('aarch64' 'armv7h' 'x86_64')
url="https://git.sr.ht/~bouncepaw/$pkgname"
license=('AGPL3')
depends=('sqlite' 'glibc')
makedepends=('go')
source=("v$pkgver.tar.gz::$url/archive/v${pkgver}.tar.gz")
options=('lto')

prepare() {
  cd "$pkgname-v$pkgver"

  export CGO_ENABLED=1
  export CGO_CPPFLAGS="$CPPFLAGS"
  export CGO_CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
  export CGO_CXXFLAGS="$CXXFLAGS"
  export CGO_LDFLAGS="$LDFLAGS"

  mkdir -p build
  go mod tidy
}

build() {
  cd "$pkgname-v$pkgver"

  export CGO_ENABLED=1
  export CGO_CPPFLAGS="$CPPFLAGS"
  export CGO_CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
  export CGO_CXXFLAGS="$CXXFLAGS"
  export CGO_LDFLAGS="$LDFLAGS"

  go build \
    -tags "libsqlite3 linux" \
    -buildmode=pie \
    -trimpath \
    -ldflags="-linkmode=external -X main.version=$pkgver" \
    -mod=readonly \
    -modcacherw \
    -o build \
     ./cmd/betula
}

package() {
  cd "$pkgname-v$pkgver"

  install -Dm0755 "build/betula" "$pkgdir/usr/bin/betula"
  install -Dm0644 "README.md"    "$pkgdir/usr/share/doc/$pkgname/README.md"
}

sha256sums=('0f7ea4a632dca7791a3f59578b923b352185074b5025d3df2a8ddc2d789408ef')