Skip to content

Commit

Permalink
feat: ruby and native gems always install nokogiri header files
Browse files Browse the repository at this point in the history
This addresses part of #1788
  • Loading branch information
flavorjones committed Dec 22, 2020
1 parent d9bfee8 commit 0304e2c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ext/nokogiri/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,9 @@ def configure

have_func('vasprintf')

# When compiling during installation, install nokogiri's header files into lib/nokogiri/include
$INSTALLFILES << ["*.h", "$(rubylibdir)/include"]

create_makefile('nokogiri/nokogiri')

if enable_config('clean', true)
Expand Down
15 changes: 15 additions & 0 deletions rakelib/cross-ruby.rake
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,21 @@ else

spec.files.reject! { |path| File.fnmatch?('ports/*', path) }
spec.dependencies.reject! { |dep| dep.name=='mini_portile2' }

# when pre-compiling a native gem, package all the C headers in lib/nokogiri/include:
# - nokogiri's headers
#
# (see the $INSTALLFILES section of extconf.rb for complementary behavior)
# (see scripts/test-gem-file-contents and scripts/test-gem-installation for tests)
headers_dir = "lib/nokogiri/include"

Dir.glob("ext/nokogiri/*.h").each do |header|
FileUtils.cp(header, headers_dir)
end

Dir.glob(File.join(headers_dir, "**", "*.h")).each do |header|
spec.files << header
end
end
end
end
3 changes: 1 addition & 2 deletions scripts/test-gem-file-contents
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ describe File.basename(gemfile) do
end

it "contains nokogiri header files in lib/nokogiri/include" do
skip "until we fix https://github.com/sparklemotion/nokogiri/pull/1788"
# https://github.com/sparklemotion/nokogiri/pull/1788
assert_includes(gemfile_contents, "lib/nokogiri/include/nokogiri.h")
end

Expand Down Expand Up @@ -186,7 +186,6 @@ describe File.basename(gemfile) do
end

it "does not contain header files in lib/nokogiri/include" do
skip "until we fix https://github.com/sparklemotion/nokogiri/pull/1788"
assert_empty(gemfile_contents.grep(%r{^lib/.*\.h$}))
end

Expand Down

0 comments on commit 0304e2c

Please sign in to comment.