[vlc-devel] [PATCH] contrib/tools: use BSD fetch if curl/wget are absent

Rafaël Carré funman at videolan.org
Fri Jan 27 12:28:30 CET 2012


fetch(1) will always exit with status > 0 if not downloading a file
However we can rely on it to be present in /usr/bin since it's part of the base system

Else we could trick it into downloading a local file
---
 contrib/src/main.mak   |    5 +++++
 extras/tools/tools.mak |    5 +++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/contrib/src/main.mak b/contrib/src/main.mak
index b810887..0ea7547 100644
--- a/contrib/src/main.mak
+++ b/contrib/src/main.mak
@@ -184,6 +184,11 @@ download = rm -f $@.tmp && \
 	wget --passive -c -p -O $@.tmp "$(1)" && \
 	touch $@.tmp && \
 	mv $@.tmp $@
+else ifeq ($(ls /usr/bin/fetch >/dev/null 2>&1 || echo FAIL),)
+download = rm -f $@.tmp && \
+	fetch -p -o $@.tmp "$(1)" && \
+	touch $@.tmp && \
+	mv $@.tmp $@
 else
 download = $(error Neither curl nor wget found!)
 endif
diff --git a/extras/tools/tools.mak b/extras/tools/tools.mak
index 95ca38d..1f28f1e 100644
--- a/extras/tools/tools.mak
+++ b/extras/tools/tools.mak
@@ -18,6 +18,11 @@ download = rm -f $@.tmp && \
 	wget --passive -c -p -O $@.tmp "$(1)" && \
 	touch $@.tmp && \
 	mv $@.tmp $@
+else ifeq ($(ls /usr/bin/fetch >/dev/null 2>&1 || echo FAIL),)
+download = rm -f $@.tmp && \
+	fetch -p -o $@.tmp "$(1)" && \
+	touch $@.tmp && \
+	mv $@.tmp $@
 else
 download = $(error Neither curl nor wget found!)
 endif
-- 
1.7.8.3



More information about the vlc-devel mailing list