summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f8e6e71ce954d51e29cb663e3a6a3b8b67988e0b (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
# Maintainer: Dimitris Kiziridis <ragouel at outlook dot com>

pkgname=simplehttp-git
pkgver=r11.ca3634f
pkgrel=1
pkgdesc="Pretty simple and lightweight http server for serving local files"
arch=('x86_64')
url='https://github.com/snwfdhmp/simplehttp'
license=('Apache-2.0')
provides=('simplehttp')
makedepends=('go' 'git')
source=("git+${url}")
md5sums=('SKIP')

pkgver() {
  cd "${srcdir}/simplehttp"
  echo "r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
}

prepare() {
  cd "${srcdir}/simplehttp"
  mkdir -p $srcdir/go
  export GOPATH="${srcdir}"/go
  export PATH=$PATH:$GOPATH/bin
  go get -d -v ./...
}

build() {
  export GOPATH="${srcdir}"/go
  export PATH=$PATH:$GOPATH/bin
  cd "${srcdir}/simplehttp"
  go build -v -o "${srcdir}/simplehttp-bin"
}

package() {
  cd "${srcdir}/simplehttp"
  install -Dm755 "${srcdir}"/simplehttp-bin "${pkgdir}/usr/bin/simplehttp"
  go clean -modcache #Remove go libraries
}