Skip to content

Commit cd97905

Browse files
committed
cmake: Move internal binaries from bin/ to libexec/
This change moves binaries that are not typically invoked directly by users from the `bin/` directory to the `libexec/` directory in CMake installs and binary releases. The goal is to simplify the contents of `bin/` for end users while still making all binaries available when needed. After this change, the binaries remaining in `bin/` are: - bitcoin - bitcoin-cli - bitcoind - bitcoin-qt - bitcoin-tx - bitcoin-util - bitcoin-wallet And the binaries that are moved to `libexec/` are: - bench_bitcoin - bitcoin-chainstate(*) - bitcoin-gui(***) - bitcoin-node(***) - test_bitcoin(**) - test_bitcoin-qt (*) bitcoin-chainstate was previously missing an install rule and was actually not installed even when it was enabled. (**) test_bitcoin is the only libexec/ binary that is currently included in bitcoin binary releases. The others are only installed when building from source with relevant cmake options enabled. (***) bitcoin-node and bitcoin-gui are not currently built by default or included in binary releases but both of these changes are planned and implemented in bitcoin#31802
1 parent c540ede commit cd97905

File tree

9 files changed

+19
-13
lines changed

9 files changed

+19
-13
lines changed

ci/test/03_test_script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ if [ "$RUN_UNIT_TESTS" = "true" ]; then
145145
fi
146146

147147
if [ "$RUN_UNIT_TESTS_SEQUENTIAL" = "true" ]; then
148-
DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" "${BASE_OUTDIR}"/bin/test_bitcoin --catch_system_errors=no -l test_suite
148+
DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" "${BASE_BUILD_DIR}"/bin/test_bitcoin --catch_system_errors=no -l test_suite
149149
fi
150150

151151
if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then

cmake/module/InstallBinaryComponent.cmake

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@ include(GNUInstallDirs)
77

88
function(install_binary_component component)
99
cmake_parse_arguments(PARSE_ARGV 1
10-
IC # prefix
11-
"HAS_MANPAGE" # options
12-
"" # one_value_keywords
13-
"" # multi_value_keywords
10+
IC # prefix
11+
"HAS_MANPAGE;INTERNAL" # options
12+
"" # one_value_keywords
13+
"" # multi_value_keywords
1414
)
1515
set(target_name ${component})
16+
if(IC_INTERNAL)
17+
set(runtime_dest ${CMAKE_INSTALL_LIBEXECDIR})
18+
else()
19+
set(runtime_dest ${CMAKE_INSTALL_BINDIR})
20+
endif()
1621
install(TARGETS ${target_name}
17-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
22+
RUNTIME DESTINATION ${runtime_dest}
1823
COMPONENT ${component}
1924
)
2025
if(INSTALL_MAN AND IC_HAS_MANPAGE)

contrib/guix/libexec/codesign.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ mkdir -p "$DISTSRC"
110110

111111
# Apply detached codesignatures (in-place)
112112
signapple apply dist/Bitcoin-Qt.app codesignatures/osx/"${HOST}"/dist/Bitcoin-Qt.app
113-
find "${DISTNAME}" -wholename "*/bin/*" -type f | while read -r bin
113+
find "${DISTNAME}" \( -wholename "*/bin/*" -o -wholename "*/libexec/*" \) -type f | while read -r bin
114114
do
115115
signapple apply "${bin}" "codesignatures/osx/${HOST}/${bin}.${ARCH}sign"
116116
done

contrib/macdeploy/detached-sig-create.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ ${SIGNAPPLE} apply "${UNSIGNED_BUNDLE}" "${OUTROOT}/${BUNDLE_ROOT}/${BUNDLE_NAME
4444
${SIGNAPPLE} notarize --detach "${OUTROOT}/${BUNDLE_ROOT}" --passphrase "${api_key_pass}" "$2" "$3" "${UNSIGNED_BUNDLE}"
4545

4646
# Sign each binary
47-
find . -maxdepth 3 -wholename "*/bin/*" -type f -exec realpath --relative-to=. {} \; | while read -r bin
47+
find . -maxdepth 3 \( -wholename "*/bin/*" -o -wholename "*/libexec/*" \) -type f -exec realpath --relative-to=. {} \; | while read -r bin
4848
do
4949
bin_dir=$(dirname "${bin}")
5050
bin_name=$(basename "${bin}")

src/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ if(ENABLE_IPC AND BUILD_DAEMON)
367367
bitcoin_ipc
368368
$<TARGET_NAME_IF_EXISTS:bitcoin_wallet>
369369
)
370-
install_binary_component(bitcoin-node)
370+
install_binary_component(bitcoin-node INTERNAL)
371371
endif()
372372

373373
if(ENABLE_IPC AND BUILD_TESTS)
@@ -469,6 +469,7 @@ if(BUILD_UTIL_CHAINSTATE)
469469
core_interface
470470
bitcoinkernel
471471
)
472+
install_binary_component(bitcoin-chainstate INTERNAL)
472473
endif()
473474

474475

src/bench/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ add_test(NAME bench_sanity_check
8383
COMMAND bench_bitcoin -sanity-check
8484
)
8585

86-
install_binary_component(bench_bitcoin)
86+
install_binary_component(bench_bitcoin INTERNAL)

src/qt/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ if(ENABLE_IPC)
282282
bitcoin_ipc
283283
)
284284
import_plugins(bitcoin-gui)
285-
install_binary_component(bitcoin-gui)
285+
install_binary_component(bitcoin-gui INTERNAL)
286286
if(WIN32)
287287
set_target_properties(bitcoin-gui PROPERTIES WIN32_EXECUTABLE TRUE)
288288
endif()

src/qt/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ if(WIN32 AND VCPKG_TARGET_TRIPLET)
4545
)
4646
endif()
4747

48-
install_binary_component(test_bitcoin-qt)
48+
install_binary_component(test_bitcoin-qt INTERNAL)

src/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,4 @@ endfunction()
213213

214214
add_all_test_targets()
215215

216-
install_binary_component(test_bitcoin)
216+
install_binary_component(test_bitcoin INTERNAL)

0 commit comments

Comments
 (0)