summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3054ac8e0deca21929e00401449cc2e6cbf009e4 (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:  Chris Severance aur.severach aATt spamgourmet dott com
# Contributor: Emanuele 'Lele aka eldios' Calo' <xeldiosx@gmail.com>
# Contributor: mrxx <mrxx at cyberhome dot at>

set -u
pkgname="teleconsole"
pkgver='0.4.0'
pkgrel='1'
pkgdesc='Command line tool to share your UNIX terminal and forward local TCP ports to people you trust.'
arch=('i686' 'x86_64')
url='https://github.com/gravitational/teleconsole/'
license=('Apache')
makedepends=('go' 'git')
# The published .tar.gz sources do not build. The build system only works with git downloads
_srcs=('teleconsole' 'teleport')
source=(
  "git+https://github.com/gravitational/teleconsole.git"
  "git+https://github.com/gravitational/teleport.git"
)
sha256sums=('SKIP'
            'SKIP')

if [ "${pkgname%-git}" != "${pkgname}" ]; then
  provides=("${pkgname%-git}=${pkgver%%.r*}")
  conflicts=("${pkgname%-git}")
pkgver() {
  cd "${pkgname%-git}"
  git describe --long --tags | sed -e 's/\([^-]*-g\)/r\1/' -e 's/-/./g'
}
else
  source[0]+="#tag=${pkgver}"
fi

_GOLOCAL='local _GOPATH _GOSRC _GOMAIN'
_set_gopath() {
  _GOPATH="${srcdir}/go"
  _GOSRC="${_GOPATH}/src/github.com/gravitational"
  _GOMAIN="${_GOSRC}/teleconsole"
}

prepare() {
  set -u
  eval "${_GOLOCAL}"; _set_gopath
  mkdir -p "${_GOSRC}"
  local _f
  for _f in "${_srcs[@]}"; do
    ln -rTs "${_f}" "${_GOSRC}/${_f}"
  done
  set +u
}

build() {
  set -u
  eval "${_GOLOCAL}"; _set_gopath
  cd "${_GOMAIN}"
  GOPATH="${_GOPATH}" \
  make
  set +u
}

package() {
  set -u
  eval "${_GOLOCAL}"; _set_gopath
  cd "${_GOMAIN}"
  install -Dpm755 "out/${pkgname%-git}" -t "${pkgdir}/usr/bin/"
  install -Dpm644 'README.md' "${pkgdir}/usr/share/doc/${pkgname}/README"
  install -Dpm644 'LICENSE' -t "${pkgdir}/usr/share/licenses/${pkgname}/"
  set +u
}
set +u