Sha256: c46e77db97b14ace51810bba4f838d45b6cbc4a2521f9fb8b6e8accf4eab7bb0
Contents?: true
Size: 1.59 KB
Versions: 10
Compression:
Stored size: 1.59 KB
Contents
require 'mkmf' $CFLAGS += " -std=c99" if have_library('xml2', 'xmlNewDoc') # libxml2 libraries from http://www.xmlsoft.org/ pkg_config('libxml-2.0') # nokogiri configuration from gem install nokogiri_lib = Gem.find_files('nokogiri'). select { |name| name.match(%r{gems/nokogiri-([\d.]+)/lib/nokogiri}) }. sort_by {|name| name[/nokogiri-([\d.]+)/,1].split('.').map(&:to_i)}.last if nokogiri_lib nokogiri_ext = nokogiri_lib.sub(%r(lib/nokogiri(.rb)?$), 'ext/nokogiri') # if that doesn't work, try workarounds found in Nokogiri's extconf unless find_header('nokogiri.h', nokogiri_ext) require "#{nokogiri_ext}/extconf.rb" end # if found, enable direct calls to Nokogiri (and libxml2) $CFLAGS += ' -DNGLIB' if find_header('nokogiri.h', nokogiri_ext) if File.exists?("/etc/gentoo-release") # link to the library to prevent: nokogumbo.c:(.text+0x26a): undefined reference to `Nokogiri_wrap_xml_document' $LDFLAGS += " -L#{nokogiri_ext} -l:nokogiri.so" end end end # add in gumbo-parser source from github if not already installed unless have_library('gumbo', 'gumbo_parse') rakehome = ENV['RAKEHOME'] || File.expand_path('../..') unless File.exist? "#{rakehome}/ext/nokogumboc/gumbo.h" require 'fileutils' FileUtils.cp Dir["#{rakehome}/gumbo-parser/src/*"], "#{rakehome}/ext/nokogumboc" case RbConfig::CONFIG['target_os'] when 'mingw32', /mswin/ FileUtils.cp Dir["#{rakehome}/gumbo-parser/visualc/include/*"], "#{rakehome}/ext/nokogumboc" end $srcs = $objs = nil end end create_makefile('nokogumboc')
Version data entries
10 entries across 10 versions & 1 rubygems