summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/libyajl2/extconf.rb38
-rw-r--r--ffi-yajl.gemspec.shared2
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