void-packages/srcpkgs/mongo-tools/template

39 lines
1.1 KiB
Bash

# Template file for 'mongo-tools'
pkgname=mongo-tools
version=3.4.4
revision=3
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=d14f4ce153aec373459c802e5a159661ccfde4e5df39d8d750586bae54896cdd
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
}