Blame SOURCES/Makefile

b968e9
VERSION := $(shell rpm --specfile *.spec --qf '%{VERSION}\n' | head -1)
b968e9
RELEASE := $(shell rpm --specfile *.spec --qf '%{RELEASE}\n' | head -1 | cut -d. -f1)
b968e9
b968e9
NAME       := d3-flame-graph
b968e9
RPM_NAME   := js-$(NAME)
b968e9
SOURCE_DIR := $(NAME)-$(VERSION)
b968e9
SOURCE_TAR := $(NAME)-$(VERSION).tar.gz
b968e9
VENDOR_TAR := $(RPM_NAME)-vendor-$(VERSION)-$(RELEASE).tar.xz
b968e9
b968e9
ALL_PATCHES     := $(sort $(wildcard *.patch))
b968e9
VENDOR_PATCHES  := $(sort $(wildcard *.vendor.patch))
b968e9
COND_PATCHES    := $(sort $(wildcard *.cond.patch))
b968e9
REGULAR_PATCHES := $(filter-out $(VENDOR_PATCHES) $(COND_PATCHES),$(ALL_PATCHES))
b968e9
b968e9
all: $(SOURCE_TAR) $(VENDOR_TAR)
b968e9
b968e9
$(SOURCE_TAR):
b968e9
	spectool -g $(RPM_NAME).spec
b968e9
b968e9
$(VENDOR_TAR): $(SOURCE_TAR)
b968e9
	rm -rf $(SOURCE_DIR)
b968e9
	tar xf $(SOURCE_TAR)
b968e9
b968e9
	# Patches to apply before vendoring
b968e9
	for patch in $(REGULAR_PATCHES); do echo applying $$patch ...; patch -d $(SOURCE_DIR) -p1 --fuzz=0 < $$patch; done
b968e9
b968e9
	# Node.js
b968e9
	cd $(SOURCE_DIR) && yarn import && yarn install --pure-lockfile
b968e9
	./list_bundled_nodejs_packages.py $(SOURCE_DIR) >> $@.manifest
b968e9
b968e9
	# Patches to apply after vendoring
b968e9
	for patch in $(VENDOR_PATCHES); do echo applying $$patch ...; patch -d $(SOURCE_DIR) -p1 --fuzz=0 < $$patch; done
b968e9
b968e9
	# Create tarball
b968e9
	XZ_OPT=-9 time -p tar cJf $@ \
b968e9
		$(SOURCE_DIR)/node_modules
b968e9
b968e9
clean:
b968e9
	rm -rf *.tar.gz *.tar.xz *.manifest *.rpm $(NAME)-*/