[Subtitles] Partial fix for text/border color gap
[xbmc.git] / tools / depends / download-files.include
blob3f41dfa1e95ddec1aa903d46e196a32e81b20416
2 HASH_FOUND = yes
3 ifneq ($(SHA512),)
4   HASH_TYPE = sha512
5   HASH_TOOL ?= $(SHA512SUM)
6 else ifneq ($(SHA256),)
7   HASH_TYPE = sha256
8   HASH_TOOL ?= $(SHA256SUM)
9 else
10   HASH_FOUND = no
11   HASH_TYPE = sha512
12   HASH_TOOL = sha512sum
13 endif
15 SED_FLAG = -i
16 ifeq ($(NATIVE_OS), osx)
17   HASH_TOOL = $(SHASUM) -a $(shell echo $(HASH_TYPE) | sed 's/^sha//')
18   SED_FLAG = -i ''
19 endif
21 # non-depends builds might not set this, use defaults
22 ifeq ($(HASH_TOOL),)
23   HASH_TOOL = sha512sum
24   HASH_TOOL_FLAGS = -c --status
25 endif
27 HASH_SUM = $($(shell echo $(HASH_TYPE) | tr  '[:lower:]' '[:upper:]'))
29 .PHONY: $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE)
30 all: $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE)
32 $(TARBALLS_LOCATION)/$(ARCHIVE):
33         cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
35 $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE): $(TARBALLS_LOCATION)/$(ARCHIVE)
36 ifeq ($(HASH_FOUND),no)
37         cd $(TARBALLS_LOCATION); $(HASH_TOOL) $(ARCHIVE) > $(ARCHIVE).$(HASH_TYPE)
38         $(HASH_TYPE)=$$(cat $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE) | cut -d ' ' -f 1) && \
39           sed $(SED_FLAG) -e "s/#SHA512#/SHA512=$${sha512}/" -e "s/#SHA256#/SHA256=$${sha256}/" Makefile
40 endif
41 ifeq ($(HASH_FOUND),yes)
42 #       we really need 2 spaces between sha hash and file name!
43 #       if the hash sum doesn't match we retry up to 3 times, add verbose curl output for diagnostics on retries
44 # if we fail 3 times, cleanup anything downloaded (eg bad tar)
45         @cd $(TARBALLS_LOCATION); echo "$(HASH_SUM)  $(ARCHIVE)" > $(ARCHIVE).$(HASH_TYPE) && $(HASH_TOOL) $(HASH_TOOL_FLAGS) $(ARCHIVE).$(HASH_TYPE) \
46           || {\
47             echo "Error: failed to verify hash sum of $(ARCHIVE), expected type: $(HASH_TYPE) value $(HASH_SUM), retrying.." ;\
48             tries=1 ;\
49             while [ $$tries -le 3 ]; do \
50               echo "download $(ARCHIVE) retry $$tries" ;\
51               rm $(TARBALLS_LOCATION)/$(ARCHIVE) ;\
52               sleep 3 ;\
53               $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) -v $(BASE_URL)/$(ARCHIVE) ;\
54               $(HASH_TOOL) $(HASH_TOOL_FLAGS) $(ARCHIVE).$(HASH_TYPE) && exit 0 || tries=$$((tries + 1)) ;\
55             done ;\
56             rm $(TARBALLS_LOCATION)/$(ARCHIVE) ;\
57             exit 1 ;\
58           }
59 endif