# Template file for 'grafana' pkgname=grafana version=7.1.5 revision=2 build_style=go go_import_path=github.com/grafana/grafana go_package="${go_import_path}/pkg/cmd/grafana-cli ${go_import_path}/pkg/cmd/grafana-server" hostmakedepends="nodejs-lts tar yarn" short_desc="Open platform for beautiful analytics and monitoring" maintainer="Michael Aldridge " license="Apache-2.0" homepage="https://grafana.com" distfiles="https://github.com/grafana/grafana/archive/v${version}.tar.gz" checksum=7ae69011674a5b6a792e8ec84c93e8be9d50ad2e995cc63f3508d0b2e7acb754 system_accounts="_grafana" _grafana_homedir="/var/lib/grafana" make_dirs="/var/log/grafana 0755 _grafana _grafana" conf_files="/etc/grafana/grafana.ini" case "$XBPS_TARGET_MACHINE" in i686*) broken="yarn can't be built for i686" ;; ppc*) broken="fails to build v8 in a dependency" ;; esac pre_build() { yarn install --pure-lockfile } post_build() { yarn run build } post_install() { vmkdir var/lib/grafana touch ${DESTDIR}/var/lib/grafana/.empty vmkdir usr/share/grafana vcopy public usr/share/grafana/ vcopy conf usr/share/grafana/ # This next step is an aweful hack, we need to create the base # config file to allow this to startup out of the box, but we # don't want to version the config file. vmkdir etc/grafana vinstall conf/defaults.ini 0644 etc/grafana grafana.ini vsed -i "s:data = data:data = /var/lib/grafana/data:" ${DESTDIR}/etc/grafana/grafana.ini vsed -i "s:data/log:/var/log/grafana:" ${DESTDIR}/etc/grafana/grafana.ini vsed -i "s:data/plugins:/var/lib/grafana/plugins:" ${DESTDIR}/etc/grafana/grafana.ini vsed -i "s:grafana.db:/var/lib/grafana/grafana.db:" ${DESTDIR}/etc/grafana/grafana.ini # And finally, the service directory vsv grafana }