diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-01-09 15:53:19 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-01-09 15:53:19 -0800 |
commit | 48f7560b6d0efdeb0555d8af3d622d2ca07a9127 (patch) | |
tree | 0d2983ce2dd37571c6acdb78db4316a3361494f3 | |
parent | 5b1dc17246c9fd1cb8df6a9665e245f5e8deb750 (diff) | |
download | ffi-yajl-48f7560b6d0efdeb0555d8af3d622d2ca07a9127.tar.gz |
rake compile fixes for submodule
also moving compilation to proper make phase
-rw-r--r-- | ext/libyajl2/extconf.rb | 38 | ||||
-rw-r--r-- | ffi-yajl.gemspec.shared | 2 |
2 files changed, 21 insertions, 19 deletions
diff --git a/ext/libyajl2/extconf.rb b/ext/libyajl2/extconf.rb index 1698000..ee8e30a 100644 --- a/ext/libyajl2/extconf.rb +++ b/ext/libyajl2/extconf.rb @@ -33,26 +33,28 @@ end prefix=File.expand_path(File.join(File.dirname(__FILE__), "..", "..")) -unless libyajl2_ok +#dir_config 'libyajl2' + +if libyajl2_ok + File.open("Makefile", "w") do |mf| + mf.puts "# Dummy makefile when we don't build the library" + mf.puts "all install::\n" + end +else ENV['CFLAGS'] = cflags ENV['LDFLAGS'] = ldflags ENV['CC'] = cc - puts "CFLAGS = #{ENV['CFLAGS']}" - puts "LDFLAGS = #{ENV['LDFLAGS']}" - puts "CC = #{ENV['CC']}" - system "wget -O yajl-2.0.1.tar.gz http://github.com/lloyd/yajl/tarball/2.0.1" or raise "wget failed" - system "tar xvf yajl-2.0.1.tar.gz" or raise "tar xvf failed" - Dir.chdir "lloyd-yajl-f4b2b1a" or raise "chdir failed" - system "./configure --prefix=#{prefix} > /tmp/libyajl.out" or raise "configure failed" - system "make install >> /tmp/libyajl.out" or raise "make install failed" - Dir.chdir ".." -end - -#dir_config 'libyajl2' - -File.open("Makefile", "w") do |mf| - mf.puts "# Dummy makefile for non-mri rubies" - mf.puts "all install::\n" - mf.puts "\tcp -f lloyd-yajl-f4b2b1a/build/yajl-2.0.1/lib/libyajl.so ." + system("cp -rf #{File.expand_path(File.join(File.dirname(__FILE__), "vendored"))} .") unless File.exists?("vendored") + + File.open("Makefile", "w") do |mf| + mf.puts "# Makefile for building vendored libyajl2" + mf.puts "CFLAGS = #{ENV['CFLAGS']}" + mf.puts "LDFLAGS = #{ENV['LDFLAGS']}" + mf.puts "CC = #{ENV['CC']}\n" + mf.puts "all install::" + mf.puts "\tcd vendored && ./configure --prefix=#{prefix}" + mf.puts "\tcd vendored && make install" + mf.puts "\tcp -f vendored/build/yajl-2.0.5/lib/libyajl.so .\n" + end end diff --git a/ffi-yajl.gemspec.shared b/ffi-yajl.gemspec.shared index 2352808..93f5ccc 100644 --- a/ffi-yajl.gemspec.shared +++ b/ffi-yajl.gemspec.shared @@ -22,5 +22,5 @@ Gem::Specification.new do |s| s.executables = %w{ ffi-yajl-bench } s.require_path = 'lib' s.files = %w{ Rakefile LICENSE README.md } + - Dir.glob( "{lib,spec}/**/*", File::FNM_DOTMATCH ).reject { |f| File.directory?(f) } + Dir.glob( "{lib,spec,ext}/**/*", File::FNM_DOTMATCH ).reject { |f| File.directory?(f) } end |