tool/depot/publish: support multiple threads in xz

Introduce 'XZ_THREADS' to override the default number of threads used
for compression, which is still set to '1'. As using multiple threads
will increase the amount of memory needed during the compression and
potentially influences the size of the created archive, setting the
variable limits the impact.

Fixes #3431.
This commit is contained in:
Josef Söntgen 2019-06-27 12:00:46 +02:00 committed by Christian Helmuth
parent fcdad00044
commit 4c8369ab1b
1 changed files with 5 additions and 2 deletions

View File

@ -30,6 +30,8 @@ export GENODE_DIR := $(realpath $(dir $(MAKEFILE_LIST))/../..)
PUBLIC_DIR ?= $(GENODE_DIR)/public
XZ_THREADS ?= 1
include $(GENODE_DIR)/tool/depot/mk/front_end.inc
@ -101,13 +103,14 @@ $(PUBLIC_DIR)/%.xz.sig : $(PUBLIC_DIR)/%.xz
$(PUBLIC_DIR)/%.tar.xz: $(DEPOT_DIR)/%
@$(ECHO) "$(DARK_COL)publish$(DEFAULT_COL) $@"
$(VERBOSE)test -e $(dir $@) || mkdir -p $(dir $@)
$(VERBOSE)tar cJf $@ -C $(dir $<) $(notdir $<)
$(VERBOSE)tar cf - -C $(dir $<) $(notdir $<) | \
xz --threads=$(XZ_THREADS) > $@
# index file
$(PUBLIC_DIR)/%.xz: $(DEPOT_DIR)/%
@$(ECHO) "$(DARK_COL)publish$(DEFAULT_COL) $@"
$(VERBOSE)test -e $(dir $@) || mkdir -p $(dir $@)
$(VERBOSE)xz <$< >$@
$(VERBOSE)xz --threads=$(XZ_THREADS) <$< >$@
ifneq ($(MISSING_PUBKEY_FILES),)
$(MAKECMDGOALS) $(TARGETS): missing_pubkey_files