1
0
Fork 0
changer-arch-pkg/PKGBUILD

83 lines
2.3 KiB
Bash

# Maintainer: surefire@cryptomile.net
pkgname=changer
pkgver=0+c19cc68+
pkgrel=1
pkgdesc="Inhouse internal user mgnt server"
arch=('i686' 'x86_64')
url="https://amuz.es/gogs/infra/changer"
license=('GPL')
conflicts=('changer')
provides=('changer')
replaces=('changer')
options=('!buildflags')
makedepends=('go' 'git')
source=('git+https://amuz.es/gogs/infra/changer.git'
'changer.service'
'changer.sysusers'
'changer.tmpfiles'
)
backup=('etc/changer/settings.yml')
md5sums=('SKIP'
'8727c6834036210128154d999f5858d1'
'6d2e5b6829b056581771fc05506e8600'
'cea427e3f6dc36d8ffd6cab873ea990b')
install=changer.install
prepare() {
export GOPATH="${srcdir}/gopath"
export GOBIN="$GOPATH/bin"
export PATH=$GOBIN:$PATH
mkdir -p "$GOPATH/src/amuz.es/gogs/infra"
ln -sfT "$srcdir/$pkgname" "$GOPATH/src/amuz.es/gogs/infra/$pkgname"
go get -u github.com/jteeuwen/go-bindata/...
go get -u github.com/kardianos/govendor
go get -u github.com/mailru/easyjson/...
}
pkgver() {
cd "${srcdir}/${pkgname}"
printf '%s+%s+%s' \
$(sed -e 's,/,+,g; s, ,,g' templates/.VERSION) \
$(git rev-list --count HEAD...$(git log --pretty=format:%H -n 1 -- templates/.VERSION)) \
$(git rev-parse --short HEAD) \
;
}
build() {
cd "${GOPATH}/src/amuz.es/gogs/infra/$pkgname"
rm -rf vendor
mkdir vendor
govendor init
govendor fetch -v +missing
easyjson http/iface/rest.go
go-bindata -nomemcopy -ignore .DS_Store -prefix asset/static -o bind/static/data.go -pkg static asset/static/...
go-bindata -nomemcopy -ignore .DS_Store -prefix asset/template -o bind/template/data.go -pkg template asset/template/...
BINARY=changer
VERSION=`git describe --always`
BUILD=`date +%FT%T%z`
export LDFLAGS=
export CGO_ENABLED=0
go build -ldflags "-w -s -X amuz.es/gogs/infra/changer/util.version=${VERSION} -X amuz.es/gogs/infra/changer/util.buildDate=${BUILD}" -o ${BINARY}
strip -x ${BINARY}
}
package() {
cd "${GOPATH}/src/amuz.es/gogs/infra/$pkgname"
install -Dm0755 -t "$pkgdir/usr/bin" ./changer
install -Dm0644 -t "$pkgdir/etc/changer" ./settings.yml
install -Dm0644 -t "$pkgdir/usr/lib/systemd/system" "$srcdir/changer.service"
install -Dm0644 "$srcdir/changer.sysusers" "$pkgdir/usr/lib/sysusers.d/changer.conf"
install -Dm0644 "$srcdir/changer.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/changer.conf"
}