blob: f26ff9cb453342201fcc556e4775965edbc2c3a6 (
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
97
98
99
100
101
102
|
# Maintainer: George Rawlinson <grawlinson@archlinux.org>
pkgname=mergestat
pkgver=0.5.10
pkgrel=1
pkgdesc='Query git repositories with SQL'
arch=('x86_64')
url='https://app.mergestat.com/w/public'
license=('MIT')
depends=('glibc')
makedepends=('git' 'go' 'cmake' 'help2man')
options=('!lto')
_commit='09d4409ecd90fb7f21c692f82d912a8825bdd0c3'
source=(
"$pkgname::git+https://github.com/mergestat/mergestat.git#commit=$_commit"
'git2go::git+https://github.com/libgit2/git2go.git'
'libgit2::git+https://github.com/libgit2/libgit2'
)
b2sums=('SKIP'
'SKIP'
'SKIP')
pkgver() {
cd "$pkgname"
git describe --tags | sed 's/^v//'
}
prepare() {
cd "$pkgname"
# initialise submodules
git submodule init
git config submodule.git2go.url "$srcdir/git2go"
git submodule update
pushd git2go
git submodule init
git config submodule.vendor/libgit2.url "$srcdir/libgit2"
git submodule update
popd
# append to various flags instead of overriding them
sed -i Makefile -e 's/FLAGS =/FLAGS +=/g'
# download dependencies
go mod download
}
build() {
cd "$pkgname"
# set Go flags
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
# compile static libgit2 via git2go
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(pwd)/git2go/static-build/install/lib/pkgconfig"
make libgit2
make
# generate shell completions
for shell in bash fish zsh; do
./.build/mergestat completion "$shell" > ".build/$shell.completion"
done
# generate man page
help2man --version-string="$pkgver" ./.build/mergestat > .build/mergestat.1
}
check() {
cd "$pkgname"
make test
}
package() {
cd "$pkgname"
# binary
install -vDm755 -t "$pkgdir/usr/bin" .build/mergestat
# shared library
install -vDm644 -t "$pkgdir/usr/lib" .build/libmergestat.so
# shell completions
install -vDm644 .build/bash.completion "$pkgdir/usr/share/bash-completion/completions/$pkgname"
install -vDm644 .build/fish.completion "$pkgdir/usr/share/fish/vendor_completions.d/$pkgname.fish"
install -vDm644 .build/zsh.completion "$pkgdir/usr/share/zsh/site-functions/_$pkgname"
# documentation
install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
# man page
install -vDm644 -t "$pkgdir/usr/share/man/man1" .build/mergestat.1
# license
install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}
|