Skip to content
Snippets Groups Projects
Commit f76aba52 authored by Olivier Dion's avatar Olivier Dion Committed by Sébastien Blin
Browse files

contrib: Add caching of build

This is a primitive way of caching builds of contrib.  Basically, a hash entry
is created from all the *.mak files in contrib.  This include all rules.mak of
individual packages and config.mak generated by the bootstrap script.

When caching is enabled, the installation is done in the cache and a symbolic
link is created to it.

Caching can be enabled with `--cache-dir=/tmp/jami-contrib-cache --cache-builds'
or any other path for cache-dir.  Not providing the `cache-builds` option will
bypass the cache.

Change-Id: I58aa0295664113792518851ede1c568495a33e59
parent f896e000
Branches
No related tags found
No related merge requests found
...@@ -37,6 +37,7 @@ HOST= ...@@ -37,6 +37,7 @@ HOST=
PREFIX= PREFIX=
PKGS_ENABLE= PKGS_ENABLE=
PKGS_DISABLE= PKGS_DISABLE=
CACHE_BUILD=
CONF_TARBALLS= CONF_TARBALLS=
if test ! -f "../src/main.mak" if test ! -f "../src/main.mak"
...@@ -62,7 +63,11 @@ do ...@@ -62,7 +63,11 @@ do
DISABLE_CONTRIB_DOWNLOADS="TRUE" DISABLE_CONTRIB_DOWNLOADS="TRUE"
;; ;;
--cache-dir=*) --cache-dir=*)
CONF_TARBALLS="${1#--cache-dir=}" CACHE_DIR="${1#--cache-dir=}"
CONF_TARBALLS="${CACHE}"
;;
--cache-builds)
CACHE_BUILD=1
;; ;;
--enable-debug) --enable-debug)
ENABLE_DEBUG=1 ENABLE_DEBUG=1
...@@ -128,6 +133,8 @@ PKGS_ENABLE := $PKGS_ENABLE ...@@ -128,6 +133,8 @@ PKGS_ENABLE := $PKGS_ENABLE
DISABLE_CONTRIB_DOWNLOADS := $DISABLE_CONTRIB_DOWNLOADS DISABLE_CONTRIB_DOWNLOADS := $DISABLE_CONTRIB_DOWNLOADS
DISABLE_CONTRIB_CHECKSUMS := $DISABLE_CONTRIB_CHECKSUMS DISABLE_CONTRIB_CHECKSUMS := $DISABLE_CONTRIB_CHECKSUMS
CONF_TARBALLS := $CONF_TARBALLS CONF_TARBALLS := $CONF_TARBALLS
CACHE_DIR := $CACHE_DIR
CACHE_BUILD := $CACHE_BUILD
ENABLE_DEBUG := $ENABLE_DEBUG ENABLE_DEBUG := $ENABLE_DEBUG
EOF EOF
......
...@@ -435,7 +435,37 @@ convert-static: ...@@ -435,7 +435,37 @@ convert-static:
for p in $(PREFIX)/lib/pkgconfig/*.pc; do $(SRC)/pkg-static.sh $$p; done for p in $(PREFIX)/lib/pkgconfig/*.pc; do $(SRC)/pkg-static.sh $$p; done
fetch: $(PKGS:%=.sum-%) fetch: $(PKGS:%=.sum-%)
fetch-all: $(PKGS_ALL:%=.sum-%) fetch-all: $(PKGS_ALL:%=.sum-%)
ifdef CACHE_BUILD
ENTRY=$(CACHE_DIR)/contrib/$(shell cat $(MAKEFILE_LIST) | sha256sum | cut -d ' ' -f 1)
CACHE_PREFIX=$(ENTRY)/$(shell basename $(PREFIX))
install: $(PREFIX)
ifneq ($(PREFIX),$(CACHE_PREFIX))
$(PREFIX): $(CACHE_PREFIX)
ln --symbolic $^ $@
endif
$(CACHE_PREFIX): $(ENTRY)/.build
ifeq ($(MAKELEVEL), 0)
$(ENTRY)/.build:
unlink $(PREFIX) || true
mkdir --parents $(CACHE_PREFIX)
$(FLOCK) $(ENTRY) $(MAKE) PREFIX=$(CACHE_PREFIX)
touch $@
else
$(ENTRY)/.build: $(PKGS:%=.%) convert-static
$(PKGS:%=.%): FORCE
FORCE:
endif
else
install: $(PKGS:%=.%) convert-static install: $(PKGS:%=.%) convert-static
endif
mostlyclean: mostlyclean:
-$(RM) $(foreach p,$(PKGS_ALL),.$(p) .sum-$(p) .dep-$(p)) -$(RM) $(foreach p,$(PKGS_ALL),.$(p) .sum-$(p) .dep-$(p))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment