-
-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[build bug] Modifying gumbo source doesn't cause rebuilds #2718
Comments
Thanks for opening this issue up, this has been mildly annoying me, too. It's a side effect of how I ended up implementing the libgumbo build, as a separate library and not part of the extension -- using the Maybe that was a mistake, especially given your notes about link-time optimization in #2331, and I should have picked |
This is definitely not a priority. I just noticed it and thought I'd make a note of it. |
(Edit: I cleaned up this comment a bit since I posted it as I was rushing out the door without checking that it actually made any sense.) I'm running into this again so I'd like to spend a little bit of time looking at how difficult it would be to work around this. The build process is a little mysterious to me currently. When I run If I touch one of the gumbo source files and rerun If I change the ext.source_pattern = "{.,../../gumbo-parser/{src,test}}/*.{c,cc,cpp,h}" and rerun So I think we need to make two changes here:
I was surprised to see that touching the files causes them to be copied to |
I'm investigating adding a minimal amount of autoconf/automake to get gumbo to build normally. That should remove the bespoke Makefile system I constructed but more importantly, will hopefully allow miniportile to compile this correctly using |
@stevecheckoway This is an unfortunate situation and I'm sorry I haven't fixed it before now. The easiest situation would be to refactor the extconf.rb to allow us to re-run the libgumbo recipe on demand. If you want to inject automake I won't stop you, but that feels like a bigger change to me. Edit: I'm going to spike on the extconf.rb refactor now. |
Hmm, refactoring the extconf didn't fix this the way I'd hoped. Going to park it until tomorrow and try again with fresh eyes. |
As a workaround, you can run |
@stevecheckoway OK - pushed a branch that I think does what you want Branch is How to use it:
If you change a source file, LMK how it works for you. |
Getting gumbo to build using autoconf/automake was surprisingly easy. I was able to integrate it with mini_portile in a very simple manner: libgumbo_recipe = process_recipe("libgumbo", "1.0.0-nokogiri", static_p, cross_build_p, false) do |recipe|
recipe.source_directory = File.join(PACKAGE_ROOT_DIR, "gumbo-parser")
end I made The only hitch: It didn't solve the underlying problem in that modifying a file in I believe that the intended result of all: clean-ports
clean-ports: $(DLLIB)
-$(Q)$(RUBY) $(srcdir)/extconf.rb --clean --enable-static One way to deal with this is to modify that to something like this. File.open("Makefile", "at") do |mk|
mk.print(<<~EOF)
.PHONY: rebuild-libgumbo
$(TARGET_SO): rebuild-libgumbo
rebuild-libgumbo:
\t-$(Q)$(MAKE) -C tmp/#{libgumbo_recipe.host}/ports/libgumbo/1.0.0-nokogiri/libgumbo-1.0.0-nokogiri install
EOF
end This approach works. Presumably, it would mostly work for the non-autotools build. The problem it would have is the current I see two paths forward
Path 1's advantage is smallest change required to get 90% of the functionality. I see no disadvantages relative to the situation today. Path 2's advantages are it would unify how Having written this all out, I'll try out path 1 tomorrow and we can decide later if autotools are worth it. |
Ah great. I'll test that out tomorrow. |
@flavorjones, that branch works great! Since I've already gone through the exercise of autotoolizing libgumbo, I figured I'd push the branch in case you want to take a look. main...stevecheckoway:nokogiri:autotools-gumbo I added one improvement: |
OK - let me create a PR for my hack first, if that works and unblocks you. I'll take a look at the autotools branch as soon as I can, but a first glance looks great! |
See #3220 |
Aaaaand I pushed a slightly-tweaked version of your autotools branch at #3221 |
**What problem is this PR intended to solve?** Enable a faster development feedback loop when working on libgumbo. See notes in CONTRIBUTING.md for how to use it. Closes #2718
Please describe the bug
Modifying the gumbo source files doesn't cause
rake compile:nokogiri
to rebuild the extension.Help us reproduce what you're seeing
rake compile:nokogiri
touch gumbo-parser/src/util.h
rake compile:nokogiri
Note that the extension was already compiled for the first invocation so nothing needed to be done. In the second compilation, it also thinks there's nothing to do. (The same holds true if you actually modify the file, not merely touch it, but touching is traditionally sufficient for build systems.)
Expected behavior
I expect the gumbo library to be recompiled (or at least the parts of it that were changed) and the
nokogiri.bundle
to be rebuilt.Environment
main
branch.The text was updated successfully, but these errors were encountered: