|
|
68ed87 |
all: grafana-$(VER).tar.gz \
|
|
|
68ed87 |
grafana-vendor-$(VER).tar.xz \
|
|
|
68ed87 |
grafana-webpack-$(VER).tar.gz
|
|
|
68ed87 |
|
|
|
77b9e5 |
grafana-$(VER).tar.gz:
|
|
|
68ed87 |
wget https://github.com/grafana/grafana/archive/v$(VER)/grafana-$(VER).tar.gz
|
|
|
77b9e5 |
|
|
|
dfc470 |
ALL_PATCHES := $(wildcard *.patch)
|
|
|
dfc470 |
PATCHES_TO_APPLY := $(filter-out 009-patch-unused-backend-crypto.patch 010-fips.patch,$(ALL_PATCHES))
|
|
|
dfc470 |
|
|
|
77b9e5 |
grafana-vendor-$(VER).tar.xz: grafana-$(VER).tar.gz
|
|
|
68ed87 |
rm -rf grafana-$(VER)
|
|
|
68ed87 |
tar xfz grafana-$(VER).tar.gz
|
|
|
77b9e5 |
|
|
|
dfc470 |
# patches can affect Go or Node.js dependencies, or the webpack
|
|
|
dfc470 |
for patch in $(PATCHES_TO_APPLY); do patch -d grafana-$(VER) -p1 --fuzz=0 < $$patch; done
|
|
|
68ed87 |
|
|
|
68ed87 |
# Go
|
|
|
68ed87 |
cd grafana-$(VER) && go mod vendor -v
|
|
|
dfc470 |
# Remove unused crypto
|
|
|
dfc470 |
rm grafana-$(VER)/vendor/golang.org/x/crypto/cast5/cast5.go
|
|
|
dfc470 |
rm grafana-$(VER)/vendor/golang.org/x/crypto/ed25519/ed25519.go
|
|
|
dfc470 |
rm grafana-$(VER)/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/const.go
|
|
|
dfc470 |
rm grafana-$(VER)/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go
|
|
|
dfc470 |
rm grafana-$(VER)/vendor/golang.org/x/crypto/openpgp/elgamal/elgamal.go
|
|
|
dfc470 |
rm grafana-$(VER)/vendor/golang.org/x/crypto/openpgp/packet/ocfb.go
|
|
|
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 {} \;
|
|
|
dfc470 |
find grafana-$(VER) -type f -name '*.exe' -delete
|
|
|
c75a6d |
rm -r grafana-$(VER)/node_modules/visjs-network/examples
|
|
|
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 |
|
|
|
77b9e5 |
grafana-webpack-$(VER).tar.gz: grafana-vendor-$(VER).tar.xz
|
|
|
68ed87 |
cd grafana-$(VER) && \
|
|
|
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-*/
|