diff --git a/Makefile b/Makefile index 61a9d5413d..b26fc4205e 100644 --- a/Makefile +++ b/Makefile @@ -101,16 +101,23 @@ ifneq ($(detected_OS),Windows) endif ifeq ($(detected_OS),Darwin) -bottles/openssl: - ./scripts/fetch-brew-bottle.sh openssl +BOTTLES_DIR := $(shell pwd)/bottles +BOTTLES := $(addprefix $(BOTTLES_DIR)/,hunspell openssl pcre) -bottles/pcre: bottles/openssl - ./scripts/fetch-brew-bottle.sh pcre +$(BOTTLES): | $(BOTTLES_DIR) + echo -e "\e[92mFetching:\e[39m $(notdir $@) bottle" + ./scripts/fetch-brew-bottle.sh $(notdir $@) -bottles/hunspell: bottles/pcre - ./scripts/fetch-brew-bottle.sh hunspell +$(BOTTLES_DIR): + echo -e "\e[92mUpdating:\e[39m macOS Homebrew" + if [[ $$(stat -f %u /usr/local/var/homebrew) -ne "$${UID}" ]]; then \ + echo "Missing permissions to update Homebrew formulae!" >&2; \ + else \ + brew update >/dev/null; \ + mkdir -p $(BOTTLES_DIR); \ + fi -bottles: bottles/hunspell +bottles: $(BOTTLES) endif deps: | deps-common bottles diff --git a/scripts/fetch-brew-bottle.sh b/scripts/fetch-brew-bottle.sh index bab59e6870..1e95b94660 100755 --- a/scripts/fetch-brew-bottle.sh +++ b/scripts/fetch-brew-bottle.sh @@ -43,14 +43,6 @@ else BEARER_TOKEN=$(get_gh_pkgs_token) fi -# We want the most recent available version of the package. -if [[ $(stat -f %u /usr/local/var/homebrew) -ne "${UID}" ]]; then - echo "Missing permissions to update Homebrew formulae!" >&2 -else - echo "${BOTTLE_NAME} - Updating HomeBrew repository" - brew update >/dev/null -fi - echo "${BOTTLE_NAME} - Finding bottle URL" BOTTLE_JSON=$(get_bottle_json "${BOTTLE_NAME}") BOTTLE_URL=$(echo "${BOTTLE_JSON}" | jq -r .url)