view logstash.Makefile @ 35:d5349a22907e default tip

fix license tags in spec files to be fedora compatible
author Carl Byington <carl@five-ten-sg.com>
date Wed, 25 Sep 2013 21:00:11 -0700
parents 0faebb0b0fa4
children
line wrap: on
line source

#
# fedora uses system jruby
# el6	 uses minimal jruby.jar
#
VERSION=$(shell awk -F\" '/LOGSTASH_VERSION/ {print $$2}' lib/logstash/version.rb)

SYSJRUBY=$(shell which jruby 2>/dev/null)
ifeq ($(SYSJRUBY),)
JRUBY_CMD=java -jar /usr/share/jruby.jar
else
JRUBY_CMD=jruby
endif
WITH_JRUBY=$(JRUBY_CMD) -S
JRUBYC=$(WITH_JRUBY) jrubyc
GEOIP=GeoLiteCity.dat

all:
	# compile-grammer
	# use the prebuild one, since we don't have tt command from treetop (yet?)
	#touch lib/logstash/config/grammar.treetop	# force rebuild
	#make -C lib/logstash/config grammar.rb
	# compile-runner
	mkdir -p build/ruby
	cd lib; $(JRUBYC) -t ../build/ruby logstash/runner.rb
	# copy-ruby-files
	rsync -a --include "*/" --include "*.rb" --exclude "*" ./lib/ ./test/ ./build/ruby
	rsync -a ./spec ./build/ruby
	rsync -a ./locales ./build/ruby
	# Delete any empty directories copied by rsync.
	find ./build/ruby -type d -empty -delete
	# install-gems
	mkdir -p vendor/bundle
	GEM_HOME=./vendor/bundle/jruby/1.9/ GEM_PATH= $(JRUBY_CMD) --1.9 ./gembag.rb logstash.gemspec
	# Purge old versions of gems installed because gembag doesn't do dependency resolution correctly
	GEM_HOME=./vendor/bundle/jruby/1.9/ GEM_PATH= $(JRUBY_CMD) --1.9 -S gem uninstall addressable -v 2.2.8
	# Purge any junk that fattens our jar without need!
	rm -rf ./vendor/bundle/jruby/1.9/gems/riak-client-1.0.3/pkg
	rm -rf ./vendor/bundle/jruby/1.9/gems/*/spec
	rm -rf ./vendor/bundle/jruby/1.9/gems/*/test
	# build-monolith
	mkdir -p build/monolith/openssl
	mkdir -p build/monolith/jopenssl
	mkdir -p build/monolith/META-INF/services
	# unpack all jars
	find $$PWD/vendor/bundle -name '*.jar' | (cd build/monolith; xargs -n1 jar xf)
	# Merge all service file in all 3rdparty jars
	find $$PWD/vendor/bundle $$PWD/vendor/jar -name '*.jar' | xargs $(JRUBY_CMD) extract_services.rb -o build/monolith/META-INF/services
	# copy openssl/lib/shared folders/files to root of jar - need this for openssl to work with JRuby
	cp -r vendor/bundle/jruby/1.9/gems/jruby-openss*/lib/shared/openssl/*	build/monolith/openssl
	cp -r vendor/bundle/jruby/1.9/gems/jruby-openss*/lib/shared/jopenssl/*	build/monolith/jopenssl
	cp -r vendor/bundle/jruby/1.9/gems/jruby-openss*/lib/shared/openssl.rb	build/monolith/openssl.rb
	# purge any extra files we don't need in META-INF (like manifests and signature files)
	rm -f build/monolith/META-INF/*.LIST
	rm -f build/monolith/META-INF/*.MF
	rm -f build/monolith/META-INF/*.RSA
	rm -f build/monolith/META-INF/*.SF
	rm -f build/monolith/META-INF/NOTICE
	rm -f build/monolith/META-INF/NOTICE.txt
	rm -f build/monolith/META-INF/LICENSE
	rm -f build/monolith/META-INF/LICENSE.txt
	mkdir -p build/monolith/vendor/ua-parser
	cp regexes.yaml build/monolith/vendor/ua-parser
	cp $(GEOIP) build/monolith/
	# build-logstash-jar
	jar cfme build/logstash.jar logstash.manifest logstash.runner		\
		-C build/ruby .								 \
		-C build/monolith .							 \
		-C vendor/bundle/jruby/1.9 gems				 \
		-C vendor/bundle/jruby/1.9 specifications	 \
		-C lib logstash/certs						 \
		patterns