Blame SOURCES/Makefile

68ed87
all: grafana-$(VER).tar.gz \
68ed87
	 grafana-vendor-$(VER).tar.xz \
68ed87
	 grafana-webpack-$(VER).tar.gz
68ed87
68ed87
grafana-$(VER).tar.gz grafana-$(VER)/:
68ed87
	wget https://github.com/grafana/grafana/archive/v$(VER)/grafana-$(VER).tar.gz
68ed87
	rm -rf grafana-$(VER)
68ed87
	tar xfz grafana-$(VER).tar.gz
68ed87
	cd grafana-$(VER) && shopt -s nullglob && \
68ed87
		for patch in ../*.patch; do patch -p1 < $$patch; done
68ed87
68ed87
grafana-vendor-$(VER).tar.xz: grafana-$(VER)/
68ed87
	# Go
68ed87
	cd grafana-$(VER) && go mod vendor -v
68ed87
	awk '$$2~/^v/ && $$4 != "indirect" {print "Provides: bundled(golang(" $$1 ")) = " substr($$2, 2)}' grafana-$(VER)/go.mod | \
68ed87
		sed -E 's/=(.*)-(.*)-(.*)/=\1-\2.\3/g' > $@.manifest
68ed87
68ed87
	# Node.js
68ed87
	cd grafana-$(VER) && yarn install --pure-lockfile
68ed87
	# Remove files with licensing issues
68ed87
	find grafana-$(VER) -type d -name 'node-notifier' -prune -exec rm -r {} \;
68ed87
	find grafana-$(VER) -name '*.exe' -delete
68ed87
	./list_bundled_nodejs_packages.py grafana-$(VER)/ >> $@.manifest
68ed87
68ed87
	# Create tarball
68ed87
	XZ_OPT=-9 tar cfJ $@ \
68ed87
		grafana-$(VER)/vendor \
68ed87
		$$(find grafana-$(VER) -type d -name "node_modules" -prune)
68ed87
68ed87
grafana-webpack-$(VER).tar.gz: grafana-$(VER)/
68ed87
	cd grafana-$(VER) && \
68ed87
		yarn install --pure-lockfile && \
68ed87
		../build_frontend.sh
68ed87
68ed87
	tar cfz $@ grafana-$(VER)/public/build grafana-$(VER)/public/views grafana-$(VER)/plugins-bundled
68ed87
68ed87
clean:
68ed87
	rm -rf *.tar.gz *.tar.xz *.manifest *.rpm grafana-*/