Skip to content

Commit

Permalink
Merge pull request elastic#165 from mhuffnagle/master
Browse files Browse the repository at this point in the history
LOGSTASH-505: Updated the Makefile to use wget, curl, or display an error.
  • Loading branch information
jordansissel committed Jun 25, 2012
2 parents 33efbe1 + f7090d1 commit 8926176
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Requirements to build:
# ant
# cpio
# wget
# wget or curl
#
JRUBY_VERSION=1.6.7.2
ELASTICSEARCH_VERSION=0.19.4
Expand All @@ -20,6 +20,9 @@ PLUGIN_FILES=$(shell git ls-files | egrep '^lib/logstash/(inputs|outputs|filters
GEM_HOME=build/gems
QUIET=@

WGET=$(shell command -v wget)
CURL=$(shell command -v curl)

# OS-specific options
TARCHECK=$(shell tar --help|grep wildcard|wc -l|tr -d ' ')
ifeq (0, $(TARCHECK))
Expand All @@ -30,6 +33,20 @@ endif

default: jar

# Figure out if we're using wget or curl
.PHONY: wget-or-curl
wget-or-curl:
ifeq ($(WGET),)
ifeq ($(CURL),)
@echo "wget or curl are required."
exit 1
else
DOWNLOAD_COMMAND=curl -L -k -o
endif
else
DOWNLOAD_COMMAND=wget --no-check-certificate -O
endif

# Compile config grammar (ragel -> ruby)
.PHONY: compile-grammar
compile-grammar: lib/logstash/config/grammar.rb
Expand Down Expand Up @@ -83,21 +100,17 @@ build/jruby/jruby-$(JRUBY_VERSION)/lib/jruby-complete.jar: build/jruby/jruby-$(J
build/jruby/jruby-$(JRUBY_VERSION): build/jruby/jruby-src-$(JRUBY_VERSION).tar.gz
$(QUIET)tar -C build/jruby/ $(TAR_OPTS) -zxf $<

build/jruby/jruby-src-$(JRUBY_VERSION).tar.gz: | build/jruby
build/jruby/jruby-src-$(JRUBY_VERSION).tar.gz: wget-or-curl | build/jruby
@echo "=> Fetching jruby source"
$(QUIET)wget -O $@ http://jruby.org.s3.amazonaws.com/downloads/$(JRUBY_VERSION)/jruby-src-$(JRUBY_VERSION).tar.gz
$(QUIET)$(DOWNLOAD_COMMAND) $@ http://jruby.org.s3.amazonaws.com/downloads/$(JRUBY_VERSION)/jruby-src-$(JRUBY_VERSION).tar.gz

vendor/jar/elasticsearch-$(ELASTICSEARCH_VERSION).tar.gz: | vendor/jar
@# --no-check-certificate is for github and wget not supporting wildcard
@# certs sanely.
vendor/jar/elasticsearch-$(ELASTICSEARCH_VERSION).tar.gz: wget-or-curl | vendor/jar
@echo "=> Fetching elasticsearch"
$(QUIET)wget --no-check-certificate \
-O $@ $(ELASTICSEARCH_URL)/elasticsearch-$(ELASTICSEARCH_VERSION).tar.gz
$(QUIET)$(DOWNLOAD_COMMAND) $@ $(ELASTICSEARCH_URL)/elasticsearch-$(ELASTICSEARCH_VERSION).tar.gz

vendor/jar/graphtastic-rmiclient.jar: | vendor/jar
vendor/jar/graphtastic-rmiclient.jar: wget-or-curl | vendor/jar
@echo "=> Fetching graphtastic rmi client jar"
$(QUIET)wget --no-check-certificate \
-O $@ http://cloud.github.com/downloads/NickPadilla/GraphTastic/graphtastic-rmiclient.jar
$(QUIET)$(DOWNLOAD_COMMAND) $@ http://cloud.github.com/downloads/NickPadilla/GraphTastic/graphtastic-rmiclient.jar

.PHONY: vendor-elasticsearch
vendor-elasticsearch: $(ELASTICSEARCH)
Expand All @@ -106,8 +119,8 @@ $(ELASTICSEARCH): $(ELASTICSEARCH).tar.gz | vendor/jar
$(QUIET)tar -C $(shell dirname $@) -xf $< $(TAR_OPTS) --exclude '*sigar*' \
'elasticsearch-$(ELASTICSEARCH_VERSION)/lib/*.jar'

vendor/jar/joda-time-$(JODA_VERSION)-dist.tar.gz: | vendor/jar
wget -O $@ "http://downloads.sourceforge.net/project/joda-time/joda-time/$(JODA_VERSION)/joda-time-$(JODA_VERSION)-dist.tar.gz"
vendor/jar/joda-time-$(JODA_VERSION)-dist.tar.gz: wget-or-curl | vendor/jar
$(DOWNLOAD_COMMAND) $@ "http://downloads.sourceforge.net/project/joda-time/joda-time/$(JODA_VERSION)/joda-time-$(JODA_VERSION)-dist.tar.gz"

vendor/jar/joda-time-$(JODA_VERSION)/joda-time-$(JODA_VERSION).jar: vendor/jar/joda-time-$(JODA_VERSION)-dist.tar.gz | vendor/jar
tar -C vendor/jar -zxf $< joda-time-$(JODA_VERSION)/joda-time-$(JODA_VERSION).jar
Expand Down

0 comments on commit 8926176

Please sign in to comment.