nokogumbo 1.4.12 → 1.4.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/ext/nokogumboc/extconf.rb +25 -32
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2531d6d888b145aff08945f6cd01e269ab97b977
4
- data.tar.gz: 1d876cca8aeb18e54c7074aa9be64db88b275819
3
+ metadata.gz: 4a025ea0b590f29baaaba62289f947c6e97807c7
4
+ data.tar.gz: e2b4b270b28c5fc6de4b24be437faf548cbf8b4e
5
5
  SHA512:
6
- metadata.gz: cb9902894b518641b85926745be174c6b38cfe9b31706f141f50f24fa2f1268f5486ec8fd7af763c0b90cf72d5c778002237b08efd06f1da15c988eb7d2fac4b
7
- data.tar.gz: 88813c0e2c4e0a7ba933686302daeb522493448aea4e1086faf9ca58e1d201d6466c869e140d2e5fdcea53b9f799e473e52fd20d41dae3a24429763e8a63ef0e
6
+ metadata.gz: 21c251c64b6d821a9c8ec1c06f3d00930d29390e52a9b5c8587e67bf71d3cd5e5663e77690019d68121d0072fe766819fa817049deb0d8eac93cd98d15fb2791
7
+ data.tar.gz: b9ef569e5974fb6ef6246434295e61f87fc462b997ea79fd9d9645f76360f0056052ab5f3fc3d4c53e8c3fc989c4185a65f333e453b56eb3bfdbb5e7edfc341b
@@ -1,18 +1,16 @@
1
1
  require 'mkmf'
2
- $CFLAGS += ' -std=c99'
2
+ $CFLAGS += " -std=c99"
3
3
 
4
- if have_library('xml2', 'xmlNewDoc')
4
+ if have_library('xml2', 'xmlNewDoc')
5
5
  # libxml2 libraries from http://www.xmlsoft.org/
6
6
  pkg_config('libxml-2.0')
7
7
 
8
8
  # nokogiri configuration from gem install
9
- nokogiri_lib = Gem
10
- .find_files('nokogiri')
11
- .select { |name| name.match(%r{gems/nokogiri-([\d.]+)/lib/nokogiri}) }
12
- .sort_by { |name| name[/nokogiri-([\d.]+)/, 1].split('.').map(&:to_i) }
13
- .last
9
+ nokogiri_lib = Gem.find_files('nokogiri').
10
+ select { |name| name.match(%r{gems/nokogiri-([\d.]+)/lib/nokogiri}) }.
11
+ sort_by {|name| name[/nokogiri-([\d.]+)/,1].split('.').map(&:to_i)}.last
14
12
  if nokogiri_lib
15
- nokogiri_ext = nokogiri_lib.sub(%r{lib/nokogiri(.rb)?$}, 'ext/nokogiri')
13
+ nokogiri_ext = nokogiri_lib.sub(%r(lib/nokogiri(.rb)?$), 'ext/nokogiri')
16
14
 
17
15
  # if that doesn't work, try workarounds found in Nokogiri's extconf
18
16
  unless find_header('nokogiri.h', nokogiri_ext)
@@ -21,28 +19,6 @@ if have_library('xml2', 'xmlNewDoc')
21
19
 
22
20
  # if found, enable direct calls to Nokogiri (and libxml2)
23
21
  $CFLAGS += ' -DNGLIB' if find_header('nokogiri.h', nokogiri_ext)
24
-
25
- # If libnokogiri is not on the build path, we need to add it.
26
- unless have_library('nokogiri', 'Nokogiri_wrap_xml_document')
27
- nokogiri_libfile = 'nokogiri.' + RbConfig::CONFIG['DLEXT']
28
- nokogiri_libpath = File.join(nokogiri_ext, nokogiri_libfile)
29
- if File.exist? nokogiri_libpath
30
- $LDFLAGS += " -Wl,-rpath #{nokogiri_ext} -L#{nokogiri_ext} "
31
- # GNU ld:
32
- # '-lFOO' => looks for a file named 'libFOO.a' or 'libFOO.so*'
33
- # '-l:FOO' => looks for a file named exactly 'FOO'
34
- # OSX/Mach ld:
35
- # - '-l:' is not supported.
36
- # - Only links '.dylib', not '.bundle'
37
- #
38
- # Nokogiri does NOT have a lib prefix, so we need to be creative in
39
- # testing; and might have either .dylib or .bundle suffixes.
40
- $LIBS += ' ' + nokogiri_libpath + ' ' \
41
- if %w(so dylib).include? RbConfig::CONFIG['DLEXT']
42
- else
43
- puts 'WARNING! Could not find Nokogiri_wrap_xml_document symbol; build might fail.'
44
- end
45
- end
46
22
  end
47
23
  end
48
24
 
@@ -52,16 +28,33 @@ unless have_library('gumbo', 'gumbo_parse')
52
28
  unless File.exist? "#{rakehome}/ext/nokogumboc/gumbo.h"
53
29
  require 'fileutils'
54
30
  FileUtils.cp Dir["#{rakehome}/gumbo-parser/src/*"],
55
- "#{rakehome}/ext/nokogumboc"
31
+ "#{rakehome}/ext/nokogumboc"
56
32
 
57
33
  case RbConfig::CONFIG['target_os']
58
34
  when 'mingw32', /mswin/
59
35
  FileUtils.cp Dir["#{rakehome}/gumbo-parser/visualc/include/*"],
60
- "#{rakehome}/ext/nokogumboc"
36
+ "#{rakehome}/ext/nokogumboc"
61
37
  end
62
38
 
63
39
  $srcs = $objs = nil
64
40
  end
65
41
  end
66
42
 
43
+ # We use some Gumbo Internals, and not all distros ship the internal headers.
44
+ header_typedefs = {
45
+ 'error.h' => 'GumboErrorType',
46
+ 'insertion_mode.h' => 'GumboInsertionMode',
47
+ 'parser.h' => 'GumboParser',
48
+ 'string_buffer.h' => 'GumboStringBuffer',
49
+ 'token_type.h' => 'GumboTokenType',
50
+ }
51
+
52
+ header_typedefs.each_pair do |header, type|
53
+ unless find_type(type, header)
54
+ require 'fileutils'
55
+ FileUtils.cp Dir["#{rakehome}/gumbo-parser/src/#{header}"],
56
+ "#{rakehome}/ext/nokogumboc"
57
+ end
58
+ end
59
+
67
60
  create_makefile('nokogumboc')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogumbo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.12
4
+ version: 1.4.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-01 00:00:00.000000000 Z
11
+ date: 2017-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri