summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 455da3b6272524aaa23f6ef601fe299d0eddc149 (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
# Maintainer: Jah Way <jahway603 at protonmail dot com>

pkgname=mastotool-git
_pkgname=mastotool
pkgver=v0.2.4.r15.g43a1766
pkgrel=1
pkgdesc="A collection of tools to work with your Mastodon account"
arch=('x86_64' 'i686' 'armv7h' 'aarch64')
url="https://github.com/muesli/${_pkgname}"
license=('MIT')
provides=($_pkgname)
conflicts=($_pkgname)
makedepends=('git' 'go')
source=("git+$url.git")
sha256sums=('SKIP')

# https://wiki.archlinux.org/title/VCS_package_guidelines
pkgver() {
  cd "$srcdir/${pkgname%-git}"
  git describe --long --tags --abbrev=7 | sed 's/-/.r/;s/-/./'
}

prepare() {
    export GOPATH="$srcdir/gopath"
    go clean -modcache
}

build() {
    cd "$_pkgname"

    export CGO_CPPFLAGS="${CPPFLAGS}"
    export CGO_CFLAGS="${CFLAGS}"
    export CGO_CXXFLAGS="${CXXFLAGS}"
    export CGO_LDFLAGS="${LDFLAGS}"

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

    go clean -modcache
}

package() {
  install -Dm644 "${srcdir}/${_pkgname}/LICENSE" "$pkgdir/usr/share/licenses/${_pkgname}/LICENSE"
  install -Dm755 "${srcdir}/${_pkgname}/$_pkgname" "${pkgdir}/usr/bin/$_pkgname"
}