blob: 1b308d13b03ed1e4734bf8dc243484c2eba9444a (
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
|
# Maintainer: gilbus <aur (AT) tinkershell.eu>
pkgname=workout-tracker
pkgver=2.6.0
pkgrel=2
pkgdesc='A workout tracking web application for personal use (or family, friends), geared towards running and other GPX-based activities'
url="https://github.com/jovandeginste/workout-tracker"
license=("MIT")
arch=('x86_64')
makedepends=('go' 'make' 'npm')
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz"
"${pkgname}.service"
"${pkgname}.env.dist")
sha256sums=('819cc7c987ad8d65c842f95c541da9e1e3932da0fa5b55f0f37bc5553e6231fd'
'341941ad9a8ef27d09b3527058597709c9624d80d1319f36252aaa4e60073014'
'b06f581b4d7ec4991b89ddad9547da284de49f3ad349186e4a2787e9daeb7930')
backup=("etc/$pkgname/env")
prepare() {
cd "$pkgname-$pkgver"
mkdir build
}
build() {
cd "$pkgname-$pkgver"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
# Remaining Go flags without -ldflags (set directly below)
export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
# Build frontend separately (Makefile only used for npm part)
make build-frontend
local _buildtime
_buildtime=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
go build \
-ldflags "-linkmode=external -extldflags \"${LDFLAGS}\" \
-X 'main.gitRef=refs/tags/v${pkgver}' \
-X 'main.gitRefName=v${pkgver}' \
-X 'main.gitRefType=tag' \
-X 'main.gitCommit=v${pkgver}' \
-X 'main.buildTime=${_buildtime}'" \
-o build ./cmd/...
}
package() {
cd "$pkgname-$pkgver"
install -Dm755 build/$pkgname "$pkgdir"/usr/bin/$pkgname
# Install systemd service file
install -Dm644 "${srcdir}/${pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
# Install sample config
install -Dm644 "${srcdir}/${pkgname}.env.dist" "${pkgdir}/etc/${pkgname}/env.dist"
}
|