# Description: Scalable datastore for metrics, events, and real-time analytics
# URL: https://github.com/InfluxData/influxdb
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: clang go git protobuf rust yarn

name=influxdb
version=2.7.1
release=1
source=(https://github.com/influxdata/influxdb/archive/v$version/$name-$version.tar.gz
  influxdb.service)

build() {
  cd $name-$version
  mkdir -p build

  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-trimpath -mod=readonly -modcacherw -buildmode=pie"
  export LDFLAGS="-linkmode external"

  PATH="$(go env GOPATH)/bin:$PATH" make -j1 VERSION=$version

  install -Dm755 bin/linux/influxd -t $PKG/usr/bin
  install -Dm 755 $SRC/influxdb.service $PKG/etc/rc.d/influxdb
}
