summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f59781b86c6dc9d110b1302876a5872b011e6b44 (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
# Maintainer: Dennis Herbrich (Gyroplast) <dennis.herbrich@veloxis.de>

pkgname=clockify-cli
pkgver=0.54.0
pkgrel=1
pkgdesc='A simple cli to manage your time entries on Clockify from terminal'
arch=('x86_64')
url='https://clockify-cli.netlify.app'
license=('Apache-2.0')
makedepends=('git' 'go')
source=("${pkgname}-${pkgver}::git+https://github.com/lucassabreu/clockify-cli#tag=v${pkgver}")
sha256sums=('9a871203509b7f8bdfd3b7d4d7b5f889a4ac6a6208735dc4b36c1eb06e891084')

prepare() {
  cd "${pkgname}-${pkgver}"
  mkdir -p build

  commit="$(git rev-parse "v${pkgver}")"
  build_date="$(date -u "+%Y-%m-%dT%H:%M:%SZ")"

  sed -i \
    -e "s/^\(\s*version\s*=\s*\"\)dev\(\".*$\)/\1${pkgver}\2/" \
    -e "s/^\(\s*commit\s*=\s*\"\)none\(\".*$\)/\1${commit}\2/" \
    -e "s/^\(\s*date\s*=\s*\"\)unknown\(\".*$\)/\1${build_date}\2/" \
    cmd/clockify-cli/main.go
}

build() {
  cd "${pkgname}-${pkgver}"
  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"
  export GOPATH="${srcdir}"
  go build -o build ./cmd/clockify-cli
}

package() {
  cd "${pkgname}-${pkgver}"
  install -Dm755 build/clockify-cli "${pkgdir}/usr/bin/clockify-cli"
}