summaryrefslogtreecommitdiff
path: root/ext/ffi_yajl/ext/parser/extconf.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2013-12-20 14:38:57 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2013-12-20 14:38:57 -0800
commit11911fc8d992260297e706a0168e4089e7d65eb8 (patch)
tree84eb7446375877311015c1a5027ae89e22367ea2 /ext/ffi_yajl/ext/parser/extconf.rb
parentf5a670d49b26764dbe805f1a8ad03c9d106eafea (diff)
downloadffi-yajl-11911fc8d992260297e706a0168e4089e7d65eb8.tar.gz
almost working parser (unicode broken)
Diffstat (limited to 'ext/ffi_yajl/ext/parser/extconf.rb')
-rw-r--r--ext/ffi_yajl/ext/parser/extconf.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/ext/ffi_yajl/ext/parser/extconf.rb b/ext/ffi_yajl/ext/parser/extconf.rb
new file mode 100644
index 0000000..e78e7a2
--- /dev/null
+++ b/ext/ffi_yajl/ext/parser/extconf.rb
@@ -0,0 +1,29 @@
+require 'mkmf'
+
+# the customer is always right, ruby is always compiled to be stupid
+$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/]
+ # how many people realize that -Wall is a compiler-specific flag???
+ # apparently not many based on reading lots of shitty extconf.rb's out there
+ $CFLAGS << " -Wall"
+end
+
+$LDFLAGS << " -lyajl"
+
+dir_config 'parser'
+
+create_makefile 'ffi_yajl/ext/parser'