|
|
75474d |
ifndef VER
|
|
|
75474d |
$(error VER is undefined)
|
|
|
75474d |
endif
|
|
|
75474d |
ifndef REL
|
|
|
75474d |
$(error REL is undefined)
|
|
|
75474d |
endif
|
|
|
75474d |
|
|
|
75474d |
NAME := grafana
|
|
|
75474d |
RPM_NAME := $(NAME)
|
|
|
75474d |
SOURCE_DIR := $(NAME)-$(VER)
|
|
|
75474d |
SOURCE_TAR := $(NAME)-$(VER).tar.gz
|
|
|
75474d |
VENDOR_TAR := $(RPM_NAME)-vendor-$(VER)-$(REL).tar.xz
|
|
|
75474d |
WEBPACK_TAR := $(RPM_NAME)-webpack-$(VER)-$(REL).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 |
|
|
|
75474d |
all: $(SOURCE_TAR) $(VENDOR_TAR) $(WEBPACK_TAR)
|
|
|
75474d |
|
|
|
75474d |
$(SOURCE_TAR):
|
|
|
75474d |
spectool -g $(RPM_NAME).spec
|
|
|
75474d |
|
|
|
75474d |
$(VENDOR_TAR): $(SOURCE_TAR)
|
|
|
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 {} \;
|
|
|
75474d |
find grafana-$(VER) -type d -name 'property-information' -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 |
|
|
|
75474d |
$(WEBPACK_TAR): $(VENDOR_TAR)
|
|
|
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:
|
|
|
75474d |
rm -rf *.tar.gz *.tar.xz *.manifest *.rpm $(NAME)-*/
|