Skip to content

Commit 81c8a76

Browse files
committed
Small changes to the libgumbo build branch
- remove the `rebuild-libgumbo` target which is probably not needed once #3220 is merged - avoid downloading googletest when just running `rake compile` - update the Manifest check to ignore new gumbo-parser/ files - simplify the 'host' variable in gumbo.rake, since we're only using it in development (and not cross-compiling)
1 parent 3c85081 commit 81c8a76

File tree

3 files changed

+19
-27
lines changed

3 files changed

+19
-27
lines changed

ext/nokogiri/extconf.rb

+1-12
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ def configure
10551055
$VPATH << "$(srcdir)/../../gumbo-parser/src"
10561056
find_header("nokogiri_gumbo.h") || abort("nokogiri_gumbo.h not found")
10571057
else
1058-
libgumbo_recipe = process_recipe("libgumbo", "1.0.0-nokogiri", static_p, cross_build_p, false) do |recipe|
1058+
process_recipe("libgumbo", "1.0.0-nokogiri", static_p, cross_build_p, false) do |recipe|
10591059
recipe.source_directory = File.join(PACKAGE_ROOT_DIR, "gumbo-parser")
10601060
end
10611061
end
@@ -1102,17 +1102,6 @@ def configure
11021102
\t-$(Q)$(RUBY) $(srcdir)/extconf.rb --clean --#{static_p ? "enable" : "disable"}-static
11031103
EOF
11041104
end
1105-
File.open("Makefile", "at") do |mk|
1106-
mk.print(<<~EOF)
1107-
1108-
.PHONY: rebuild-libgumbo
1109-
1110-
$(TARGET_SO): rebuild-libgumbo
1111-
rebuild-libgumbo:
1112-
\t-$(Q)$(MAKE) -C tmp/#{libgumbo_recipe.host}/ports/libgumbo/1.0.0-nokogiri/libgumbo-1.0.0-nokogiri install
1113-
EOF
1114-
end
1115-
11161105
end
11171106

11181107
# rubocop:enable Style/GlobalVars

rakelib/check-manifest.rake

+5
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ task :check_manifest, [:verbose] do |_, args|
5656
[0-9]*
5757
appveyor.yml
5858
**/compile_commands.json
59+
gumbo-parser/Makefile.old
60+
gumbo-parser/aclocal.m4
61+
gumbo-parser/autom4te.cache/*
62+
gumbo-parser/build-aux/*
5963
gumbo-parser/fuzzer/*
64+
gumbo-parser/googletest/*
6065
gumbo-parser/test/*
6166
gumbo-parser/gperf-filter.sed
6267
lib/nokogiri/**/nokogiri.{jar,so}

rakelib/gumbo.rake

+13-15
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11
# frozen_string_literal: true
22

3+
# We want to run the gumbo test suite using exactly the same compiled gumbo-parser
4+
# that Nokogiri uses.
5+
#
6+
# To that end, we first need to get the Rake ExtensionTask to run extconf.rb which will
7+
# run the gumbo-parser's configure script. We don't want to compile the extension
8+
# at this point, so we make `gumbo:test` depend on the Nokogiri Makefile.
39
namespace "gumbo" do
4-
# We want to run the gumbo test suite using exactly the same compiled gumbo-parser
5-
# that Nokogiri uses.
6-
#
7-
# To that end, we first need to get the Rake ExtensionTask to run extconf.rb which will
8-
# run the gumbo-parser's configure script. We don't want to compile the extension
9-
# at this point, so we make `gumbo:test` depend on the Nokogiri Makefile.
10-
11-
gtest_pkg = "gumbo-parser/googletest"
12-
host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"]
13-
host = host.gsub("i386", "i686")
10+
host = RbConfig::CONFIG["host"]
1411
nokogiri_makefile = File.join("tmp/#{RUBY_PLATFORM}/nokogiri/#{RUBY_VERSION}/Makefile")
1512
gumbotest_builddir = "tmp/#{RUBY_PLATFORM}/nokogiri/#{RUBY_VERSION}/tmp/#{host}/ports/libgumbo/1.0.0-nokogiri/libgumbo-1.0.0-nokogiri"
1613
gumbotest_configure = File.absolute_path("gumbo-parser/configure")
1714

15+
gtest_pkg = "gumbo-parser/googletest"
1816
file gtest_pkg do
1917
sh(<<~EOF)
2018
curl -L https://github.com/google/googletest/archive/release-1.8.0.tar.gz | \
2119
tar zxf - --strip-components 1 -C gumbo-parser googletest-release-1.8.0/googletest
2220
EOF
2321
end
2422

25-
file gumbotest_configure => gtest_pkg do
26-
sh("autoreconf", "-fiv", chdir: "gumbo-parser")
27-
end
28-
2923
desc "Run the gumbo parser test suite"
30-
task "test" => nokogiri_makefile do
24+
task "test" => [nokogiri_makefile, gtest_pkg] do
3125
sh("make", "-j2", "-C", gumbotest_builddir, "check")
3226
end
3327

28+
file gumbotest_configure do
29+
sh("autoreconf", "-fiv", chdir: "gumbo-parser")
30+
end
31+
3432
# Make sure the libgumbo configure script is created before trying to compile the extension.
3533
file nokogiri_makefile => gumbotest_configure
3634

0 commit comments

Comments
 (0)