diff logstash.Makefile @ 14:0e45fe64b10d

work on building from source
author Carl Byington <carl@five-ten-sg.com>
date Wed, 10 Apr 2013 21:24:14 -0700
parents c0150404962d
children c158cae7cd26
line wrap: on
line diff
--- a/logstash.Makefile	Sat Apr 06 08:48:09 2013 -0700
+++ b/logstash.Makefile	Wed Apr 10 21:24:14 2013 -0700
@@ -1,19 +1,70 @@
+#
+# 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/local/bin/jruby.jar
+else
+JRUBY_CMD=jruby
+endif
+WITH_JRUBY=$(JRUBY_CMD) -S
+JRUBYC=$(WITH_JRUBY) jrubyc
+GEOIP=GeoLiteCity.dat
+
 all:
 	echo '********** in my local makefile'
 
-	# make the graphtastic client interface class
-	echo '********** build with raw javac, rather than maven'
-	cd GT/GraphTastic;                                                              \
-	javac src/main/java/com/monstersoftwarellc/graphtastic/rmi/IRmiService.java;    \
-	find . -name '*.class'
-	echo '********* done with graphtastic build'
-
-	# make the elastic search jar
-	cd ES/elasticsearch-0.20.6;							   \
-	export PATH=/usr/local/apache-maven-3.0.5/bin:$(PATH); \
-	mvn -Dmaven.test.skip=true package;                    \
-	find . -name '*.jar';                                  \
-	find . -name '*.class'
-	echo '********* done with elastic search build'
+	# make the target directory to collect all the class files that will be in the final jar
+	mkdir target
 
 	# make the logstash jar
+	# compile-grammer
+	touch lib/logstash/config/grammar.rl	# force rebuild
+	make -C lib/logstash/config grammar.rb
+	# compile-runner
+	mkdir -p build/ruby
+	(cd lib; $(JRUBYC) -5 -t ../build/ruby logstash/runner.rb)
+	# copy-ruby-files
+	find ./lib	-name '*.rb' | sed -e 's,^\./lib/,,'  | (cd lib;  cpio -p --make-directories ../build/ruby)
+	find ./test -name '*.rb' | sed -e 's,^\./test/,,' | (cd test; cpio -p --make-directories ../build/ruby)
+	rsync -av ./spec build/ruby
+	# install-gems
+	mkdir -p vendor/bundle
+	GEM_HOME=./vendor/bundle/jruby/1.9/ GEM_PATH= $(JRUBY_CMD) --1.9 ./gembag.rb logstash.gemspec
+	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 build/monolith/jopenssl
+	# unpack all jars
+	find $$PWD/vendor/bundle -name '*.jar' | (cd build/monolith; xargs -n1 jar xf)
+	# 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
+	cp $(GEOIP) build/monolith/
+	# build-monolith-jar
+	jar cfe build/logstash-$(VERSION)-monolithic.jar 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/web/public					 \
+		-C lib logstash/certs						 \
+		-C lib logstash/web/views					 \
+		patterns
+	# see what we have
+	unzip -t build/logstash-$(VERSION)-monolithic.jar >/tmp/log.mono.jar.txt
+	sort /tmp/log.mono.jar.txt >/tmp/log.mono.jar.sort.txt