upgpkg: wordpress 6.2.1-1
[ArchLinux/community.git] / vhs / trunk / PKGBUILD
blobb90078f9a638ecd7d8317f4e42ceb46b828ea1c4
1 # Maintainer: George Rawlinson <grawlinson@archlinux.org>
3 pkgname=vhs
4 pkgver=0.4.0
5 pkgrel=1
6 pkgdesc='A tool for recording terminal GIFs'
7 arch=('x86_64')
8 url='https://github.com/charmbracelet/vhs'
9 license=('MIT')
10 depends=('glibc' 'ffmpeg' 'ttyd')
11 makedepends=('git' 'go')
12 options=('!lto')
13 _commit='5409c97e7ad707b5038b42b5f9d4a1d0acb2418f'
14 source=("$pkgname::git+$url#commit=$_commit")
15 b2sums=('SKIP')
17 pkgver() {
18   cd "$pkgname"
20   git describe --tags | sed 's/^v//'
23 prepare() {
24   cd "$pkgname"
26   # create directory for build output
27   mkdir build
29   # download dependencies
30   export GOPATH="${srcdir}"
31   go mod download
34 build() {
35   cd "$pkgname"
37   # set Go flags
38   export CGO_CPPFLAGS="${CPPFLAGS}"
39   export CGO_CFLAGS="${CFLAGS}"
40   export CGO_CXXFLAGS="${CXXFLAGS}"
41   export GOPATH="${srcdir}"
43   go build -v \
44     -buildmode=pie \
45     -mod=readonly \
46     -modcacherw \
47     -ldflags "-compressdwarf=false \
48     -linkmode external \
49     -extldflags ${LDFLAGS} \
50     -X main.Version=v$pkgver \
51     -X main.CommitSHA=$_commit \
52     -X main.CommitDate=$(git show --no-patch --format=%cd --date=format:%Y-%m-%d)" \
53     -o build \
54     .
56   # man page
57   ./build/vhs man > build/vhs.1
59   # completions
60   for shell in bash fish zsh; do
61     ./build/vhs completion "$shell" > "build/$shell-completion"
62   done
65 check() {
66   cd "$pkgname"
68   go test -v ./...
71 package() {
72   cd "$pkgname"
74   # binary
75   install -vDm755 -t "$pkgdir/usr/bin" build/vhs
77   # documentation
78   install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
80   # man pages
81   install -vDm644 -t "$pkgdir/usr/share/man/man1" build/vhs.1
83   # completions
84   install -vDm644 build/bash-completion "$pkgdir/usr/share/bash-completion/completions/vhs"
85   install -vDm644 build/fish-completion "$pkgdir/usr/share/fish/vendor_completions.d/vhs.fish"
86   install -vDm644 build/zsh-completion "$pkgdir/usr/share/zsh/site-functions/_vhs"
88   # license
89   install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE