void-packages/srcpkgs/mongo-tools/template

39 lines
1.1 KiB
Bash

# Template file for 'mongo-tools'
pkgname=mongo-tools
version=3.4.1
revision=5
wrksrc="${pkgname}-r${version}"
build_style=go
go_import_path="github.com/mongodb/mongo-tools"
go_build_tags="ssl sasl"
hostmakedepends="pkg-config"
makedepends="libpcap-devel libressl-devel libsasl-devel"
short_desc="mongodb tools for import, export and diagnostic"
maintainer="Duncaen <duncaen@voidlinux.eu>"
license="Apache-2.0"
homepage="https://github.com/mongodb/mongo-tools"
distfiles="https://github.com/mongodb/${pkgname}/archive/r${version}.tar.gz"
checksum=283d729442fca7a331ca475e234b0880ec7c4339597e0a8e271ca7e153b45439
do_build() {
local bins="bsondump mongodump mongoexport mongofiles mongoimport mongooplog
mongoreplay mongorestore mongostat mongotop"
local path="${GOPATH}/src/${go_import_path}"
mkdir -p "$(dirname ${path})"
ln -fs "$wrksrc" "${path}"
for d in vendor/src/{github.com,golang.org,gopkg.in}/*; do
mkdir -p $(dirname "${GOPATH}/${d#*/}")
ln -sf "$wrksrc/$d" "${GOPATH}/${d#*/}"
done
for bin in ${bins}; do
go build -x \
-o "${GOPATH}/bin/$bin" \
-tags "${go_build_tags}" \
-ldflags "${go_ldflags}" \
"${path}/$bin/main/$bin.go"
done
}