summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3722f47c6fe79c54b963f4b00dcedf5fc2ed9a4f (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
# Maintainer: Sefa Eyeoglu <contact@scrumplex.net>
# Contributor: Caleb Fontenot <foley2431 at gmail dot com>
# Contributor: Lgmrszd <lgmrszd at gmail dot com>

pkgname=packwiz-git
_pkgname="${pkgname%-git}"
pkgver=r369.0626c00
pkgrel=2
pkgdesc="A command line tool for creating minecraft modpacks."
arch=(x86_64)
url='https://packwiz.infra.link'
license=('MIT')
depends=('glibc')
makedepends=('git' 'go')
provides=("${_pkgname}")
conflicts=("${_pkgname}")
source=('git+https://github.com/packwiz/packwiz.git')
sha256sums=('SKIP')

pkgver() {
  cd "${_pkgname}"

  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd "${_pkgname}"

  mkdir -p "completions"

  export GOPATH="${srcdir}"
  export GOFLAGS="-modcacherw"
  go mod download
}

build() {
  cd "${_pkgname}"

  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOPATH="${srcdir}"
  export GOFLAGS="\
    -buildmode=pie \
    -mod=readonly \
    -modcacherw \
    -trimpath \
  "
  local _ld_flags=" \
    -compressdwarf=false \
    -linkmode=external \
  "
  go build \
    -ldflags "${_ldflags}" \
    -o "${_pkgname}"

  ./packwiz completion bash > completions/packwiz.bash
  ./packwiz completion zsh > completions/packwiz.zsh
  ./packwiz completion fish > completions/packwiz.fish
}

package() {
  cd "${_pkgname}"

  install -Dm755 packwiz "${pkgdir}/usr/bin/packwiz"
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

  install -Dm644 completions/packwiz.bash "${pkgdir}/usr/share/bash-completion/completions/packwiz"
  install -Dm644 completions/packwiz.zsh "${pkgdir}/usr/share/zsh/site-functions/_packwiz"
  install -Dm644 completions/packwiz.fish "${pkgdir}/usr/share/fish/vendor_completions.d/packwiz.fish"
}