Skip to content

Commit ba441d4

Browse files
author
MacroFake
committed
Merge bitcoin#26313: doc: consolidate library documentation to libraries.md
af781bf doc: fix typo in doc/libraries.md (fanquake) 9e9ae61 doc: remove library commentary from src/Makefile.am (fanquake) Pull request description: Deduplicate the makefile comments, in favour of doc/libraries.md. I think a single, more comprehensive source of truth is preferable. Diagrams are also useful. Came up in bitcoin#26292 (comment). ACKs for top commit: ryanofsky: Code review ACK af781bf, nice cleanups hebasto: ACK af781bf, I have reviewed the code and it looks OK, I agree it can be merged. Tree-SHA512: df61ed1394102221701ae2dfa42886dfabe9d9fd7f601b794e2195f93d8f7c2a1cd1c000a77d0a969b42328e8ebc0387755c57291837b283fdf376dbd98fdda1
2 parents e7a0e96 + af781bf commit ba441d4

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

doc/design/libraries.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class bitcoin-qt,bitcoind,bitcoin-cli,bitcoin-wallet bold
8383

8484
</td></tr></table>
8585

86-
- The graph shows what _linker symbols_ (functions and variables) from each library other libraries can call and reference directly, but it is not a call graph. For example, there is no arrow connecting *libbitcoin_wallet* and *libbitcoin_node* libraries, because these libraries are intended to be modular and not depend on each other's internal implementation details. But wallet code still is still able to call node code indirectly through the `interfaces::Chain` abstract class in [`interfaces/chain.h`](../../src/interfaces/chain.h) and node code calls wallet code through the `interfaces::ChainClient` and `interfaces::Chain::Notifications` abstract classes in the same file. In general, defining abstract classes in [`src/interfaces/`](../../src/interfaces/) can be a convenient way of avoiding unwanted direct dependencies or circular dependencies between libraries.
86+
- The graph shows what _linker symbols_ (functions and variables) from each library other libraries can call and reference directly, but it is not a call graph. For example, there is no arrow connecting *libbitcoin_wallet* and *libbitcoin_node* libraries, because these libraries are intended to be modular and not depend on each other's internal implementation details. But wallet code is still able to call node code indirectly through the `interfaces::Chain` abstract class in [`interfaces/chain.h`](../../src/interfaces/chain.h) and node code calls wallet code through the `interfaces::ChainClient` and `interfaces::Chain::Notifications` abstract classes in the same file. In general, defining abstract classes in [`src/interfaces/`](../../src/interfaces/) can be a convenient way of avoiding unwanted direct dependencies or circular dependencies between libraries.
8787

8888
- *libbitcoin_consensus* should be a standalone dependency that any library can depend on, and it should not depend on any other libraries itself.
8989

src/Makefile.am

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,7 @@ obj/build.h: FORCE
346346
"$(abs_top_srcdir)"
347347
libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
348348

349-
350-
# server: shared between bitcoind and bitcoin-qt
351-
# Contains code accessing mempool and chain state that is meant to be separated
352-
# from wallet and gui code (see node/README.md). Shared code should go in
353-
# libbitcoin_common or libbitcoin_util libraries, instead.
349+
# node #
354350
libbitcoin_node_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) $(MINIUPNPC_CPPFLAGS) $(NATPMP_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
355351
libbitcoin_node_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
356352
libbitcoin_node_a_SOURCES = \
@@ -441,7 +437,9 @@ endif
441437
if !ENABLE_WALLET
442438
libbitcoin_node_a_SOURCES += dummywallet.cpp
443439
endif
440+
#
444441

442+
# zmq #
445443
if ENABLE_ZMQ
446444
libbitcoin_zmq_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS)
447445
libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
@@ -452,10 +450,9 @@ libbitcoin_zmq_a_SOURCES = \
452450
zmq/zmqrpc.cpp \
453451
zmq/zmqutil.cpp
454452
endif
453+
#
455454

456-
457-
# wallet: shared between bitcoind and bitcoin-qt, but only linked
458-
# when wallet enabled
455+
# wallet #
459456
libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) $(BDB_CPPFLAGS) $(SQLITE_CFLAGS)
460457
libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
461458
libbitcoin_wallet_a_SOURCES = \
@@ -494,14 +491,17 @@ endif
494491
if USE_BDB
495492
libbitcoin_wallet_a_SOURCES += wallet/bdb.cpp wallet/salvage.cpp
496493
endif
494+
#
497495

496+
# wallet tool #
498497
libbitcoin_wallet_tool_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS)
499498
libbitcoin_wallet_tool_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
500499
libbitcoin_wallet_tool_a_SOURCES = \
501500
wallet/wallettool.cpp \
502501
$(BITCOIN_CORE_H)
502+
#
503503

504-
# crypto primitives library
504+
# crypto #
505505
crypto_libbitcoin_crypto_base_la_CPPFLAGS = $(AM_CPPFLAGS)
506506

507507
# Specify -static in both CXXFLAGS and LDFLAGS so libtool will only build a
@@ -581,8 +581,9 @@ crypto_libbitcoin_crypto_arm_shani_la_CPPFLAGS = $(AM_CPPFLAGS)
581581
crypto_libbitcoin_crypto_arm_shani_la_CXXFLAGS += $(ARM_SHANI_CXXFLAGS)
582582
crypto_libbitcoin_crypto_arm_shani_la_CPPFLAGS += -DENABLE_ARM_SHANI
583583
crypto_libbitcoin_crypto_arm_shani_la_SOURCES = crypto/sha256_arm_shani.cpp
584+
#
584585

585-
# consensus: shared between all executables that validate any consensus rules.
586+
# consensus #
586587
libbitcoin_consensus_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
587588
libbitcoin_consensus_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
588589
libbitcoin_consensus_a_SOURCES = \
@@ -618,8 +619,9 @@ libbitcoin_consensus_a_SOURCES = \
618619
util/strencodings.cpp \
619620
util/strencodings.h \
620621
version.h
622+
#
621623

622-
# common: shared between bitcoind, and bitcoin-qt and non-server tools
624+
# common #
623625
libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS)
624626
libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
625627
libbitcoin_common_a_SOURCES = \
@@ -658,8 +660,9 @@ libbitcoin_common_a_SOURCES = \
658660
script/standard.cpp \
659661
warnings.cpp \
660662
$(BITCOIN_CORE_H)
663+
#
661664

662-
# util: shared between all executables.
665+
# util #
663666
libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS)
664667
libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
665668
libbitcoin_util_a_SOURCES = \
@@ -707,8 +710,9 @@ libbitcoin_util_a_SOURCES = \
707710
if USE_LIBEVENT
708711
libbitcoin_util_a_SOURCES += util/url.cpp
709712
endif
713+
#
710714

711-
# cli: shared between bitcoin-cli and bitcoin-qt
715+
# cli #
712716
libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
713717
libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
714718
libbitcoin_cli_a_SOURCES = \

0 commit comments

Comments
 (0)