void-packages/srcpkgs/mirrorbits/template

44 lines
1.5 KiB
Bash

# Template file for 'mirrorbits'
pkgname=mirrorbits
version=0.5.1
revision=1
build_style=go
go_import_path="github.com/etix/mirrorbits"
go_ldflags="-X ${go_import_path}/core.VERSION=${VERSION}"
_go_protobuf_version=52132540909e117f2b98b0694383dc0ab1e1deca
hostmakedepends="govendor git pkg-config protobuf-devel"
makedepends="geoip-devel"
depends="geoip-data redis"
short_desc="Geographical download redirector"
maintainer="lemmi <lemmi@nerd2nerd.org>"
license="MIT"
homepage="https://github.com/etix/mirrorbits"
distfiles="
https://github.com/etix/mirrorbits/archive/v${version}.tar.gz
https://github.com/golang/protobuf/archive/${_go_protobuf_version}.tar.gz"
checksum="
c713c312877aa039415b1f336bf8ca456aa3089a5759c9e6aa9aac8853e165fb
5ef8723453af0aeea20f7b6f322345c009560ec23b85d430838bfb5d2f1cde4a"
patch_args="-Np1"
pre_build() {
# Build the protoc-gen-go Protobuf plugin.
mkdir -p "${GOPATH}/src/github.com/golang"
ln -s "${XBPS_BUILDDIR}/protobuf-${_go_protobuf_version}" "${GOPATH}/src/github.com/golang/protobuf"
GOOS= GOARCH= go install github.com/golang/protobuf/protoc-gen-go
# Generate mirrorbits RPC code.
PATH="${GOPATH}/bin:${PATH}" protoc -I rpc rpc/rpc.proto --go_out=plugins=grpc:rpc
# Clean up protoc-gen-go so do_install doesn't package it.
rm "${GOPATH}/bin/protoc-gen-go"
cd "${GOPATH}/src/${go_import_path}"
govendor sync
}
post_install() {
vlicense LICENSE.txt
vmkdir usr/share/mirrorbits/templates
vcopy templates usr/share/mirrorbits/
vsconf mirrorbits.conf
}