From 5c89ea7f6b13bdf1124b4d95909e1932356595ae Mon Sep 17 00:00:00 2001 From: crownedgrouse Date: Tue, 5 Aug 2014 23:38:17 +0200 Subject: Add wget fallback --- core/core.mk | 6 ++++++ erlang.mk | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/core/core.mk b/core/core.mk index d25897b..f73ef7f 100644 --- a/core/core.mk +++ b/core/core.mk @@ -62,6 +62,12 @@ help:: # Core functions. +ifeq ($(shell which wget 2>/dev/null | wc -l), 1) define core_http_get wget --no-check-certificate -O $(1) $(2)|| rm $(1) endef +else +define core_http_get + erl -noshell -eval ' ssl:start(), inets:start(), case httpc:request(get, {"$(2)", []}, [{autoredirect, true}], []) of {ok, {{_V, 200, _R}, _H, Body}} -> case file:write_file("$(1)", Body) of ok -> ok ; {error, R1} -> halt(R1) end ; {error, R2} -> halt(R2) end, halt(0). ' +endef +endif diff --git a/erlang.mk b/erlang.mk index f37307d..acdcb70 100644 --- a/erlang.mk +++ b/erlang.mk @@ -62,9 +62,15 @@ help:: # Core functions. +ifeq ($(shell which wget 2>/dev/null | wc -l), 1) define core_http_get wget --no-check-certificate -O $(1) $(2)|| rm $(1) endef +else +define core_http_get + erl -noshell -eval ' ssl:start(), inets:start(), case httpc:request(get, {"$(2)", []}, [{autoredirect, true}], []) of {ok, {{_V, 200, _R}, _H, Body}} -> case file:write_file("$(1)", Body) of ok -> ok ; {error, R1} -> halt(R1) end ; {error, R2} -> halt(R2) end, halt(0). ' +endef +endif # Copyright (c) 2013-2014, Loïc Hoguin # This file is part of erlang.mk and subject to the terms of the ISC License. -- cgit v1.2.3 From 5b30525df75e317db08620f3eccae685fae52b81 Mon Sep 17 00:00:00 2001 From: crownedgrouse Date: Thu, 11 Sep 2014 22:09:07 +0200 Subject: Silent the download command echo --- core/deps.mk | 2 +- erlang.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/deps.mk b/core/deps.mk index f15ae74..6929f5f 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -77,7 +77,7 @@ distclean-deps: # Packages related targets. $(PKG_FILE2): - $(call core_http_get,$(PKG_FILE2),$(PKG_FILE_URL)) + @$(call core_http_get,$(PKG_FILE2),$(PKG_FILE_URL)) pkg-list: $(PKG_FILE2) @cat $(PKG_FILE2) | awk 'BEGIN { FS = "\t" }; { print \ diff --git a/erlang.mk b/erlang.mk index acdcb70..8600721 100644 --- a/erlang.mk +++ b/erlang.mk @@ -151,7 +151,7 @@ distclean-deps: # Packages related targets. $(PKG_FILE2): - $(call core_http_get,$(PKG_FILE2),$(PKG_FILE_URL)) + @$(call core_http_get,$(PKG_FILE2),$(PKG_FILE_URL)) pkg-list: $(PKG_FILE2) @cat $(PKG_FILE2) | awk 'BEGIN { FS = "\t" }; { print \ -- cgit v1.2.3