summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f07e4f9125aa75a2e8ad605b4f7517b7a9ef4333 (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
# Maintainer: Chocobo1 <chocobo1 AT archlinux DOT net>
# Contributor: Sam Whited <sam@samwhited.com>
# Contributor: Brian Clemens <brian@tiuxo.com>
# Contributor: Přemysl Janouch <p.janouch@gmail.com>

pkgname=hugo-git
pkgver=0.145.0.r29.gc15ebce2f
pkgrel=1
pkgdesc="A fast and flexible static site generator"
arch=('i686' 'x86_64')
url="https://gohugo.io/"
license=('Apache-2.0')
depends=('gcc-libs')
makedepends=('git' 'go')
optdepends=('dart-sass: required to transpile Sass to CSS'
            'python-docutils: required for reStructuredText support')
provides=("hugo=$pkgver")
conflicts=('hugo')
source=("git+https://github.com/gohugoio/hugo.git")
sha256sums=('SKIP')


export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
export GOFLAGS="-buildmode=pie -ldflags=-linkmode=external -trimpath -mod=readonly -modcacherw"

pkgver() {
  cd "hugo"

  _tag=$(git tag -l --sort -v:refname | grep -E '^v?[0-9\.]+$' | head -n1)
  _rev=$(git rev-list --count $_tag..HEAD)
  _hash=$(git rev-parse --short HEAD)
  printf "%s.r%s.g%s" "$_tag" "$_rev" "$_hash" | sed 's/^v//'
}

build() {
  cd "hugo"

  go build \
    -tags extended,withdeploy
  ./hugo gen man
}

check() {
  cd "hugo"

  #go test \
  #  ./...
}

package() {
  cd "hugo"

  GOBIN="$pkgdir/usr/bin" \
    go install \
      -tags extended,withdeploy

  install -Dm644 man/*.1 -t "$pkgdir/usr/share/man/man1"

  install -d \
    "$pkgdir/usr/share/bash-completion/completions" \
    "$pkgdir/usr/share/fish/vendor_completions.d" \
    "$pkgdir/usr/share/zsh/site-functions"

  "$pkgdir/usr/bin/hugo" completion bash > "$pkgdir/usr/share/bash-completion/completions/hugo"
  "$pkgdir/usr/bin/hugo" completion fish > "$pkgdir/usr/share/fish/vendor_completions.d/hugo.fish"
  "$pkgdir/usr/bin/hugo" completion zsh > "$pkgdir/usr/share/zsh/site-functions/_hugo"
}