summaryrefslogtreecommitdiff
path: root/ext/ffi_yajl/ext/encoder
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2013-11-23 00:17:01 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2013-11-23 00:17:01 -0800
commit245072bee2409bb1bdad14938c1bb0f64d900ed7 (patch)
tree2e57c905e3c0e9510ee0f18ac3ca61096abbdeb5 /ext/ffi_yajl/ext/encoder
parent5b4d4c427284d144d134009647d92d3976433a05 (diff)
downloadffi-yajl-245072bee2409bb1bdad14938c1bb0f64d900ed7.tar.gz
rake compile almost working with vendored libyajl
Diffstat (limited to 'ext/ffi_yajl/ext/encoder')
-rw-r--r--ext/ffi_yajl/ext/encoder/extconf.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/ffi_yajl/ext/encoder/extconf.rb b/ext/ffi_yajl/ext/encoder/extconf.rb
index 563ef5c..40f16ad 100644
--- a/ext/ffi_yajl/ext/encoder/extconf.rb
+++ b/ext/ffi_yajl/ext/encoder/extconf.rb
@@ -5,6 +5,15 @@ $CFLAGS = ENV['CFLAGS'] if ENV['CFLAGS']
$LDFLAGS = ENV['LDFLAGS'] if ENV['LDFLAGS']
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
+# search our gem root first to pick up libyajl2 that we vendored
+gem_root = File.expand_path(File.join(File.dirname(__FILE__), "../../../.."))
+$CFLAGS = "-I#{gem_root}/include -L#{gem_root}/lib #{$CFLAGS}"
+$LDFLAGS = "-L#{gem_root}/lib #{$CFLAGS}"
+
+puts gem_root
+puts $CFLAGS
+puts $LDFLAGS
+
# except if you're doing an unoptimized gcc install we're going to help you out a bit
if RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc|clang/
$CFLAGS << " -O3" unless $CFLAGS[/-O\d/]