-
Notifications
You must be signed in to change notification settings - Fork 28
Split sources for easier buildsystem integration #19
Conversation
Concept ACK |
This allows for tighter integration with upstream projects. Otherwise it should be a no-op.
Rebased |
Requires bitcoin-core/univalue-subtree#19 . This addresses issues like the one in bitcoin#12467, where some of our compiler flags end up being dropped during the subconfigure of Univalue. Specifically, we're still using the compiler-default c++ version rather than forcing c++11. We can drop the need subconfigure completely in favor of a tighter build integration, where the sources are listed separately from the build recipes, so that they may be included directly by upstream projects. This is similar to the way leveldb build integration works in Core. Upstream benefits of this approach include: Better caching (for ex. ccache and autoconf) No need for a slow subconfigure No more missing compile flags Compile only the objects needed There are no benefits to Univalue itself that I can think of. These changes should be a no-op there, and to downstreams as well until they take advantage of the new sources.mk. Once merged, This Core branch is ready-ish for PR, and takes advantage of the features added here. This also removes the option to use an external univalue to avoid similar ABI issues with mystery binaries.
Updated the Core implementation here as well: https://github.com/theuni/bitcoin/commits/univalue-split . |
Requires bitcoin-core/univalue-subtree#19 . This addresses issues like the one in bitcoin#12467, where some of our compiler flags end up being dropped during the subconfigure of Univalue. Specifically, we're still using the compiler-default c++ version rather than forcing c++17. We can drop the need subconfigure completely in favor of a tighter build integration, where the sources are listed separately from the build recipes, so that they may be included directly by upstream projects. This is similar to the way leveldb build integration works in Core. Core benefits of this approach include: - Better caching (for ex. ccache and autoconf) - No need for a slow subconfigure - Faster autoconf - No more missing compile flags - Compile only the objects needed There are no benefits to Univalue itself that I can think of. These changes should be a no-op there, and to downstreams as well until they take advantage of the new sources.mk. This also removes the option to use an external univalue to avoid similar ABI issues with mystery binaries.
Concept ACK. What is the reason to keep the |
@hebasto That's just a convenience Makefile target to regenerate That commit is part of this PR because |
Requires bitcoin-core/univalue-subtree#19 . This addresses issues like the one in bitcoin#12467, where some of our compiler flags end up being dropped during the subconfigure of Univalue. Specifically, we're still using the compiler-default c++ version rather than forcing c++17. We can drop the need subconfigure completely in favor of a tighter build integration, where the sources are listed separately from the build recipes, so that they may be included directly by upstream projects. This is similar to the way leveldb build integration works in Core. Core benefits of this approach include: - Better caching (for ex. ccache and autoconf) - No need for a slow subconfigure - Faster autoconf - No more missing compile flags - Compile only the objects needed There are no benefits to Univalue itself that I can think of. These changes should be a no-op there, and to downstreams as well until they take advantage of the new sources.mk. This also removes the option to use an external univalue to avoid similar ABI issues with mystery binaries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK 4a5b0a1
One small question about FORCE
inline.
@@ -30,89 +27,32 @@ $(GENBIN): $(GEN_SRCS) | |||
@echo Building $@ | |||
$(AM_V_at)c++ -I$(top_srcdir)/include -o $@ $< | |||
|
|||
gen: lib/univalue_escapes.h $(GENBIN) | |||
@echo Updating $< | |||
gen: $(GENBIN) FORCE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this FORCE
doing anything? As far as I understand, FORCE
has no special meaning and by convention is used for a target that doesn't have any prerequisites or recipe, and is therefore always run: https://www.gnu.org/software/make/manual/html_node/Force-Targets.html#Force-Targets. I think the intention is to make sure that $(GENBIN)
is always rebuilt, but I have some questions:
- doesn't there need to be a
FORCE:
target defined for this to work? The various examples I've seen have always included an emptyFORCE:
target. - If the intention is to always rebuild
$(GENBIN)
, then shouldn'tFORCE
be a dependency of$(GENBIN)
? If it's a dependency ofgen
, thengen
will get rereun, but it might be using an old version of$(GENBIN)
. - Doesn't
.INTERMEDIATE: $(GENBIN)
mean that$(GENBIN)
will be deleted at the end of the make anyway, and will therefore be rebuilt on eachmake gen
? - Doesn't the fact that
gen
isPHONY
mean that it'll be run everymake gen
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't there need to be a FORCE: target defined for this to work?
FORCE is a phony variable here used to make gen always run. (But leaving it undeclared would work too, it would still just always run because it would never complete its goal of generating a file called FORCE
)
If the intention is to always rebuild
$(GENBIN), then shouldn't FORCE be a dependency of $ (GENBIN)?
The intention is for $(GENBIN)
to be a real target, and for gen
to be a phony convenience target that always rebuilds the header.
Doesn't .INTERMEDIATE:
$(GENBIN) mean that $ (GENBIN) will be deleted at the end of the make anyway, and will therefore be rebuilt on each make gen?
Yup!
Doesn't the fact that gen is PHONY mean that it'll be run every make gen?
Yup!
The idea here is that "gen" is a convenience target for regenerating the univalue_escapes.h file. It is never run automatically, it is just a way to generate a header that's committed to the repo. As such, when a user does make gen
, it should always regenerate the file. The current behavior of depending on its own output is broken.
There's no reason to ever keep $(GENBIN) around, so it's an intermediate. make gen
essentially never needs to be used, it's possible that its only use is to demonstrate how the .h was generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @theuni! All makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 4a5b0a1
c390ac375f Merge bitcoin-core/univalue-subtree#19: Split sources for easier buildsystem integration 4a5b0a1c65 build: Move source entries out to sources.mk 6c7d94b33c build: cleanup wonky gen usage a222637c6d Merge bitcoin#23: Merge changes from jgarzik/univalue@1ae6a23 f77d0f718d Merge commit '1ae6a231a0169938eb3972c1d48dd17cba5947e1' into HEAD 1ae6a231a0 Merge pull request bitcoin#57 from MarcoFalke/test_fix 92bdd11f0b univalue_write: remove unneeded sstream.h include ffb621c130 Merge pull request bitcoin#56 from drodil/remove_sstream_header f33acf9fe8 Merge commit '7890db9~' into HEAD 66e0adec4d Remove unnecessary sstream header from univalue.h 88967f6586 Version 1.0.4 1dc113dbef Merge pull request bitcoin#50 from luke-jr/pushKV_bool 72392fb227 [tests] test pushKV for boolean values c23132bcf4 Pushing boolean value to univalue correctly 81faab26a1 Merge pull request bitcoin#48 from fwolfst/47-UPDATE_MIT_LINK_TO_HTTPS b17634ef24 Update URLs to MIT license. 88ab64f6b5 Merge pull request bitcoin#46 from jasonbcox/master 35ed96da31 Merge pull request bitcoin#44 from MarcoFalke/Mf1709-univalue-cherrypick-explicit 420c226290 Merge pull request bitcoin#45 from MarcoFalke/Mf1710-univalue-revert-test git-subtree-dir: src/univalue git-subtree-split: c390ac375f2fad0433c8fb1b4b5e30749e112a89
a44caf65fe Merge bitcoin-core/univalue-subtree#28: Import fixes for sanitizer reported issues 135254331e Import fixes for sanitizer reported issues d5fb86940e refactor: use c++11 range based for loop in checkObject ff9c379304 refactor: Use nullptr (c++11) instead of NULL 08a99754d5 build: use ax_cxx_compile_stdcxx.m4 to check for C++11 support 66d3713ce7 Merge bitcoin-core/univalue-subtree#29: ci: travis -> cirrus 808d487292 ci: travis -> cirrus c390ac375f Merge bitcoin-core/univalue-subtree#19: Split sources for easier buildsystem integration 4a5b0a1c65 build: Move source entries out to sources.mk 6c7d94b33c build: cleanup wonky gen usage a222637c6d Merge bitcoin#23: Merge changes from jgarzik/univalue@1ae6a23 f77d0f718d Merge commit '1ae6a231a0169938eb3972c1d48dd17cba5947e1' into HEAD 1ae6a231a0 Merge pull request bitcoin#57 from MarcoFalke/test_fix 92bdd11f0b univalue_write: remove unneeded sstream.h include ffb621c130 Merge pull request bitcoin#56 from drodil/remove_sstream_header f33acf9fe8 Merge commit '7890db9~' into HEAD 66e0adec4d Remove unnecessary sstream header from univalue.h 88967f6586 Version 1.0.4 1dc113dbef Merge pull request bitcoin#50 from luke-jr/pushKV_bool 72392fb227 [tests] test pushKV for boolean values c23132bcf4 Pushing boolean value to univalue correctly 81faab26a1 Merge pull request bitcoin#48 from fwolfst/47-UPDATE_MIT_LINK_TO_HTTPS b17634ef24 Update URLs to MIT license. 88ab64f6b5 Merge pull request bitcoin#46 from jasonbcox/master 35ed96da31 Merge pull request bitcoin#44 from MarcoFalke/Mf1709-univalue-cherrypick-explicit 420c226290 Merge pull request bitcoin#45 from MarcoFalke/Mf1710-univalue-revert-test git-subtree-dir: src/univalue git-subtree-split: a44caf65fe55b9dd8ddb08f04c0f70409efd53b3
a44caf65f Merge bitcoin-core/univalue-subtree#28: Import fixes for sanitizer reported issues 135254331 Import fixes for sanitizer reported issues d5fb86940 refactor: use c++11 range based for loop in checkObject ff9c37930 refactor: Use nullptr (c++11) instead of NULL 08a99754d build: use ax_cxx_compile_stdcxx.m4 to check for C++11 support 66d3713ce Merge bitcoin-core/univalue-subtree#29: ci: travis -> cirrus 808d48729 ci: travis -> cirrus c390ac375 Merge bitcoin-core/univalue-subtree#19: Split sources for easier buildsystem integration 4a5b0a1c6 build: Move source entries out to sources.mk 6c7d94b33 build: cleanup wonky gen usage a222637 Merge dogecoin#23: Merge changes from jgarzik/univalue@1ae6a23 98fadc0 Merge dogecoin#24: Push bool into array correctly 5f03f1f Push bool into array correctly f77d0f7 Merge commit '1ae6a231a0169938eb3972c1d48dd17cba5947e1' into HEAD 98261b1 Merge dogecoin#22: Clamp JSON object depth to PHP limit 54c4015 Clamp JSON object depth to PHP limit 5a58a46 Merge dogecoin#21: Remove hand-coded UniValue destructor. b4cdfc4 Remove hand-coded UniValue destructor. 1ae6a23 Merge pull request dogecoin#57 from MarcoFalke/test_fix 92bdd11 univalue_write: remove unneeded sstream.h include ffb621c Merge pull request dogecoin#56 from drodil/remove_sstream_header f33acf9 Merge commit '7890db9~' into HEAD 7fba60b Merge dogecoin#17: [docs] Update readme 4577454 Merge dogecoin#13: Fix typo 66e0ade Remove unnecessary sstream header from univalue.h ac7e73c [docs] Update readme 7890db9 Merge #11: Remove deprecated std pair wrappers 88967f6 Version 1.0.4 40e3485 Merge dogecoin#14: Cleaned up namespace imports to reduce symbol collisions 1dc113d Merge pull request dogecoin#50 from luke-jr/pushKV_bool 72392fb [tests] test pushKV for boolean values c23132b Pushing boolean value to univalue correctly 4a49647 Fix typo 85052a4 Remove deprecated std::pair wrappers 81faab2 Merge pull request dogecoin#48 from fwolfst/47-UPDATE_MIT_LINK_TO_HTTPS b17634e Update URLs to MIT license. 51d3ab3 Merge #10: Add pushKV(key, boolean) function (replaces #5) 129bad9 [tests] test pushKV for boolean values b3c44c9 Pushing boolean value to univalue correctly 07947ff Merge #9: [tests] Fix BOOST_CHECK_THROW macro ec849d9 [tests] Fix BOOST_CHECK_THROW macro 88ab64f Merge pull request dogecoin#46 from jasonbcox/master 35ed96d Merge pull request dogecoin#44 from MarcoFalke/Mf1709-univalue-cherrypick-explicit 420c226 Merge pull request dogecoin#45 from MarcoFalke/Mf1710-univalue-revert-test d208f98 Cleaned up namespace imports to reduce symbol collisions 31bc9f5 Merge #8: Remove unused Homebrew workaround fa04209 Remove HomeBrew workaround a523e08 Merge #7: Declare single-argument (non-converting) constructors "explicit" a9e53b3 Merge #4: Pull upstream fe805ea Declare single-argument (non-converting) constructors "explicit" 8a2d6f1 Merge pull request dogecoin#41 from jgarzik/get-obj-map ba341a2 Add getObjMap() helper method. Also, constify checkObject(). ceb1194 Handle .pushKV() and .checkObject() edge cases. 107db98 Add ::push_back(double) method for feature parity. d415300 Move one-line implementation of UniValue::read() to header. 52e85b3 Move exception-throwing get_* methods into separate implementation module. dac5296 README.md: update code quotes 3e31dcf README.md: close code quote d09b842 Update README.md f1b86ed Convert README to markdown style. 1dfe464 Import UniValue class unit tests from bitcoin project. 0d3e74d operator[] takes size_t index parameter (versus unsigned int) 640158f Private findKey() method becomes size_t clean, and returns bool on failure. 7099135 Merge pull request dogecoin#36 from ryanofsky/pr/end-str a31231b Version 1.0.3 4fd5444 Reject unterminated strings 81eba33 Merge pull request dogecoin#26 from isle2983/pushBackHelpers 3640541 Merge PR dogecoin#32 from branch 'nul-not-special' of git://github.com/ryanofsky/univalue into merge 89bb073 Merge pull request dogecoin#31 from ryanofsky/raw-literals 511008c Merge pull request dogecoin#30 from ryanofsky/test-driver 77974f3 Merge pull request dogecoin#34 from paveljanik/20161116_Wshadow_codepoint a38fcd3 Do not shadow member variable codepoint. fd32d1a Don't require nul-terminated string inputs 0bb1439 Support parsing raw literals in UniValue 28876d0 Merge pull request dogecoin#29 from btcdrak/exportspace 839ccd7 Add test driver for JSONTestSuite 26ef3ff Remove trailing whitespace from JSON export cfa0384 Convenience wrappers for push_back-ing integer types git-subtree-dir: src/univalue git-subtree-split: a44caf65fe55b9dd8ddb08f04c0f70409efd53b3
a44caf65fe Merge bitcoin-core/univalue-subtree#28: Import fixes for sanitizer reported issues 135254331e Import fixes for sanitizer reported issues d5fb86940e refactor: use c++11 range based for loop in checkObject ff9c379304 refactor: Use nullptr (c++11) instead of NULL 08a99754d5 build: use ax_cxx_compile_stdcxx.m4 to check for C++11 support 66d3713ce7 Merge bitcoin-core/univalue-subtree#29: ci: travis -> cirrus 808d487292 ci: travis -> cirrus c390ac375f Merge bitcoin-core/univalue-subtree#19: Split sources for easier buildsystem integration 4a5b0a1c65 build: Move source entries out to sources.mk 6c7d94b33c build: cleanup wonky gen usage a222637c6d Merge #23: Merge changes from jgarzik/univalue@1ae6a23 f77d0f718d Merge commit '1ae6a231a0169938eb3972c1d48dd17cba5947e1' into HEAD 1ae6a231a0 Merge pull request #57 from MarcoFalke/test_fix 92bdd11f0b univalue_write: remove unneeded sstream.h include ffb621c130 Merge pull request #56 from drodil/remove_sstream_header f33acf9fe8 Merge commit '7890db9~' into HEAD 66e0adec4d Remove unnecessary sstream header from univalue.h 88967f6586 Version 1.0.4 1dc113dbef Merge pull request #50 from luke-jr/pushKV_bool 72392fb227 [tests] test pushKV for boolean values c23132bcf4 Pushing boolean value to univalue correctly 81faab26a1 Merge pull request #48 from fwolfst/47-UPDATE_MIT_LINK_TO_HTTPS b17634ef24 Update URLs to MIT license. 88ab64f6b5 Merge pull request #46 from jasonbcox/master 35ed96da31 Merge pull request #44 from MarcoFalke/Mf1709-univalue-cherrypick-explicit 420c226290 Merge pull request #45 from MarcoFalke/Mf1710-univalue-revert-test git-subtree-dir: src/univalue git-subtree-split: a44caf65fe55b9dd8ddb08f04c0f70409efd53b3
68c8f5532 Merge bitcoin-core/univalue-subtree#34: doc: remove TODO 297c53a5e doc: remove TODO 6c19d050a Merge bitcoin-core/univalue-subtree#33: Add getInt<Integral>() helper 09e4a930f Add getInt helper 10619e0d9 Merge bitcoin-core/univalue-subtree#32: refactor: include-what-you-use 431cdf5d2 refactor: use constexpr where appropriate 64fc881fa refactor: cleanup headers for iwyu 9c35bf38e Merge bitcoin-core/univalue-subtree#30: doc: note that our API has diverged from upstream 09b65facb doc: note that our API has diverged from upstream a44caf65f Merge bitcoin-core/univalue-subtree#28: Import fixes for sanitizer reported issues 135254331 Import fixes for sanitizer reported issues d5fb86940 refactor: use c++11 range based for loop in checkObject ff9c37930 refactor: Use nullptr (c++11) instead of NULL 08a99754d build: use ax_cxx_compile_stdcxx.m4 to check for C++11 support 66d3713ce Merge bitcoin-core/univalue-subtree#29: ci: travis -> cirrus 808d48729 ci: travis -> cirrus c390ac375 Merge bitcoin-core/univalue-subtree#19: Split sources for easier buildsystem integration 4a5b0a1c6 build: Move source entries out to sources.mk 6c7d94b33 build: cleanup wonky gen usage git-subtree-dir: src/univalue git-subtree-split: 68c8f5532d02203ec37eb4b2baf8492249f73ab6
This addresses issues like the one in bitcoin/bitcoin#12467, where some of our compiler flags end up being dropped during the subconfigure of Univalue. Specifically, we're still using the compiler-default c++ version rather than forcing c++17.
We can drop the need subconfigure completely in favor of a tighter build integration, where the sources are listed separately from the build recipes, so that they may be included directly by upstream projects. This is similar to the way leveldb build integration works in Core.
A similar split was recently added for minisketch: sipa/minisketch#8
Upstream benefits of this approach include:
There are no benefits to Univalue itself that I can think of. These changes should be a no-op here, and to downstreams as well until they take advantage of the new sources.mk. Once merged, This Core branch is ready-ish for PR, and takes advantage of the features added here.
libsecp256k1 will get the same treatment once this is done.