From 5c18311f91530378626d63e0e4cb9e65c1d7f44b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sat, 29 Oct 2016 01:34:19 +0300 Subject: Make the sfx plugin use the tarball from Relx Plus small tweaks. --- plugins/relx.mk | 10 ++++++---- plugins/sfx.mk | 13 +++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'plugins') diff --git a/plugins/relx.mk b/plugins/relx.mk index 9a15f4a..6c7641c 100644 --- a/plugins/relx.mk +++ b/plugins/relx.mk @@ -53,15 +53,17 @@ else define get_relx_release.erl {ok, Config} = file:consult("$(RELX_CONFIG)"), - {release, {Name, _}, _} = lists:keyfind(release, 1, Config), - io:format("~s", [Name]), + {release, {Name, Vsn}, _} = lists:keyfind(release, 1, Config), + io:format("~s ~s", [Name, Vsn]), halt(0). endef -RELX_RELEASE = `$(call erlang,$(get_relx_release.erl))` +RELX_REL := $(shell $(call erlang,$(get_relx_release.erl))) +RELX_REL_NAME := $(word 1,$(RELX_REL)) +RELX_REL_VSN := $(word 2,$(RELX_REL)) run: all - $(verbose) $(RELX_OUTPUT_DIR)/$(RELX_RELEASE)/bin/$(RELX_RELEASE) console + $(verbose) $(RELX_OUTPUT_DIR)/$(RELX_REL_NAME)/bin/$(RELX_REL_NAME) console help:: $(verbose) printf "%s\n" "" \ diff --git a/plugins/sfx.mk b/plugins/sfx.mk index 75d34da..e2aecad 100644 --- a/plugins/sfx.mk +++ b/plugins/sfx.mk @@ -3,12 +3,13 @@ .PHONY: sfx -ifdef RELX_RELEASE +ifdef RELX_REL ifdef SFX # Configuration. -SFX_OUTPUT = $(RELX_OUTPUT_DIR)/$(RELX_RELEASE).run +SFX_ARCHIVE ?= $(RELX_OUTPUT_DIR)/$(RELX_REL_NAME)/$(RELX_REL_NAME)-$(RELX_REL_VSN).tar.gz +SFX_OUTPUT_FILE ?= $(RELX_OUTPUT_DIR)/$(RELX_REL_NAME).run # Core targets. @@ -26,7 +27,7 @@ REL=$${FILENAME%.*} tail -n+$$ARCHIVE $$0 | tar -xzf - -C $$TMPDIR -$$TMPDIR/$$REL/bin/$$REL console +$$TMPDIR/bin/$$REL console RET=$$? rm -rf $$TMPDIR @@ -37,9 +38,9 @@ __ARCHIVE_BELOW__ endef sfx: - $(call render_template,sfx_stub,$(SFX_OUTPUT)) - $(gen_verbose) tar -C $(RELX_OUTPUT_DIR) -czf - $(RELX_RELEASE) >> $(SFX_OUTPUT) - $(verbose) chmod +x $(SFX_OUTPUT) + $(call render_template,sfx_stub,$(SFX_OUTPUT_FILE)) + $(gen_verbose) cat $(SFX_ARCHIVE) >> $(SFX_OUTPUT_FILE) + $(verbose) chmod +x $(SFX_OUTPUT_FILE) endif endif -- cgit v1.2.3