# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer:
pkgname=micro
pkgver=1.1.3
pkgrel=0
pkgdesc="A modern and intuitive terminal-based text editor"
url="https://micro-editor.github.io/"
arch="all"
license="MIT"
depends=""
makedepends="go-bindata go glide"
install=""
subpackages=""
source="micro-$pkgver.tar.gz::https://github.com/zyedidia/micro/archive/v$pkgver.tar.gz
	glide.lock
	glide.yaml
	"
builddir="$srcdir/src/github.com/zyedidia/$pkgname"

prepare() {
        mkdir -p ${builddir%/*}
        mv "$srcdir"/$pkgname-$pkgver "$builddir"/ || return 1
        default_prepare
}


build() {
	cd "$builddir"
        export GOPATH="$srcdir"
        cp "$srcdir"/glide.yaml "$srcdir"/glide.lock .
	glide install --skip-test || return 1
	go-bindata -nometadata -o cmd/micro/runtime.go runtime/... || return 1
	go build -v -ldflags \
		"-s -w -X main.Version=$pkgver" ./cmd/micro || return 1
}

package() {
	cd "$builddir"
	install -Dm 755 $pkgname \
		"$pkgdir"/usr/bin/$pkgname || return 1
}

glide_init() {
        abuild clean deps unpack prepare
        export GOPATH="$srcdir"
        cd "$builddir"
        rm -f glide.yaml glide.lock
	glide init --non-interactive || return 1
        glide up --skip-test || return 1
        cp glide.yaml glide.lock "$startdir"
        cd $startdir && abuild checksum undeps clean
}

md5sums="aec9e1858edf7bc6dbb809c2e4dacde1  micro-1.1.3.tar.gz
7873dd5feecf2dc0830bb7d08b458377  glide.lock
652a09903bc431ac4631d805e45154da  glide.yaml"
sha256sums="d5f3cba6d5b1bfd09c41af161360c8aa11e644306d23d9d9b3245cbed1d47f9a  micro-1.1.3.tar.gz
3eab4fc1380acfc700c1af08c38ed1efc6aa7f728b5f5a885ad317b25b7d483e  glide.lock
3e97833e334a5147dc993aaa2279cbf91364ba456577b8185e4211c51d3ffc4b  glide.yaml"
sha512sums="a73ce3867d4479f6321516b447f167e7117bca1383ee6d52afbd726024b8a8995f3db59bc6365a3b6ff39a16d2a2dc8ec0032ac1f2b2f320ac88e07e3ef091b5  micro-1.1.3.tar.gz
91dd8f5d2d7a30678ec17ae49c22cf3cfe9f16fddf852bd890f31e3c772163f4410d595448abc850cd4f65966dc66586580b29765c47d67f41bc8737d5a551a9  glide.lock
f45a434dc7d5ba41bcd54bb12f4f192920b95bb156f7ce5e092f2214965d5bf841ab24a9b613181260d260c5ac1abb36bd585f52b5bc4606102922b3f07ad836  glide.yaml"
