ext/extconf.rb in ruby-gumbo-1.0.2 vs ext/extconf.rb in ruby-gumbo-1.1.0
- old
+ new
@@ -1,15 +1,23 @@
+require 'mkmf'
-require "mkmf"
+$CFLAGS << ' -std=c99'
-RbConfig::MAKEFILE_CONFIG["CC"] = ENV["CC"] if ENV["CC"]
+unless enable_config('packaged-library')
+ pkg_config('libgumbo')
+end
-extension_name = "gumbo"
+if enable_config('packaged-library') || !have_library('gumbo', 'gumbo_parse')
+ gumbo_lib_src = File.expand_path('../../vendor/gumbo-parser/src', __FILE__)
+ unless File.directory? gumbo_lib_src
+ abort "Couldn't find the packaged gumbo-parser library. " +
+ "Did you forget to git clone --recursive?"
+ end
+ require 'fileutils'
-unless pkg_config("libgumbo")
- $libs << " -lgumbo"
+ # mkmf doesn't appear to deal well with sources/objects in multiple
+ # directories, so we bring the gumbo source to it.
+ gumbo_sources = Dir[File.join(gumbo_lib_src, '*')]
+ FileUtils.cp(gumbo_sources, File.dirname(__FILE__))
end
-$CFLAGS << " -std=c99"
-
-create_header
-create_makefile(extension_name)
+create_makefile('gumbo_ext')