mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 06:49:38 -04:00
Merge bitcoin/bitcoin#32019: cmake: Check for makensis
and zip
tools before using them for optional deploy
targets
1f9b2e150c
cmake: Require `zip` only for `deploy` target (Hennadii Stepanov)0aeff29951
cmake: Check for `makensis` tool before using it (Hennadii Stepanov) Pull request description: For `x86_64-w64-mingw32` and `*-apple-darwin` targets, the optional `deploy` target requires dedicated tools: `makensis` and `zip`, respectively. This PR introduces a uniform checks for those tools when attempting to build the `deploy` target, ensuring they are not required for configuring and building any other targets. Here is an example of workflow for `x86_64-w64-mingw32`: ``` $ # `nsis` is not installed $ cmake -B build -G "GNU Makefiles" --toolchain depends/x86_64-w64-mingw32/toolchain.cmake $ cmake --build build -j $(nproc) $ cmake --build build -t deploy Error: NSIS not found. Please install NSIS and/or ensure that its executable is accessible to the find_program() command— for example, by setting the MAKENSIS_EXECUTABLE variable or another relevant CMake variable. Then re-run cmake to regenerate the build system. Built target deploy $ sudo apt install nsis $ cmake -B build $ cmake --build build -t deploy ... [100%] Generating bitcoin-win64-setup.exe [100%] Built target deploy ``` Fixes https://github.com/bitcoin/bitcoin/issues/32018. ACKs for top commit: hodlinator: re-ACK1f9b2e150c
fanquake: ACK1f9b2e150c
Tree-SHA512: 5e2bd28a13bd8fa7c4ba8cf1756d200a4651afe83c463d76ece10027cca343e124eff97012a5368028f761df60f420ab891106b4e33b50045051d57c7464ff98
This commit is contained in:
commit
d61a847af0
2 changed files with 26 additions and 12 deletions
|
@ -44,6 +44,14 @@ endfunction()
|
|||
|
||||
function(add_windows_deploy_target)
|
||||
if(MINGW AND TARGET bitcoin-qt AND TARGET bitcoind AND TARGET bitcoin-cli AND TARGET bitcoin-tx AND TARGET bitcoin-wallet AND TARGET bitcoin-util AND TARGET test_bitcoin)
|
||||
find_program(MAKENSIS_EXECUTABLE makensis)
|
||||
if(NOT MAKENSIS_EXECUTABLE)
|
||||
add_custom_target(deploy
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Error: NSIS not found"
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# TODO: Consider replacing this code with the CPack NSIS Generator.
|
||||
# See https://cmake.org/cmake/help/latest/cpack_gen/nsis.html
|
||||
include(GenerateSetupNsi)
|
||||
|
@ -58,7 +66,7 @@ function(add_windows_deploy_target)
|
|||
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoin-wallet> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoin-wallet>
|
||||
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoin-util> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoin-util>
|
||||
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:test_bitcoin> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:test_bitcoin>
|
||||
COMMAND makensis -V2 ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.nsi
|
||||
COMMAND ${MAKENSIS_EXECUTABLE} -V2 ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.nsi
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_target(deploy DEPENDS ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.exe)
|
||||
|
@ -112,16 +120,22 @@ function(add_macos_deploy_target)
|
|||
DEPENDS ${PROJECT_BINARY_DIR}/dist/${macos_app}/Contents/MacOS/Bitcoin-Qt
|
||||
)
|
||||
|
||||
find_program(ZIP_COMMAND zip REQUIRED)
|
||||
add_custom_command(
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/dist/${osx_volname}.zip
|
||||
WORKING_DIRECTORY dist
|
||||
COMMAND ${PROJECT_SOURCE_DIR}/cmake/script/macos_zip.sh ${ZIP_COMMAND} ${osx_volname}.zip
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_target(deploy
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/dist/${osx_volname}.zip
|
||||
)
|
||||
find_program(ZIP_EXECUTABLE zip)
|
||||
if(NOT ZIP_EXECUTABLE)
|
||||
add_custom_target(deploy
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Error: ZIP not found"
|
||||
)
|
||||
else()
|
||||
add_custom_command(
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/dist/${osx_volname}.zip
|
||||
WORKING_DIRECTORY dist
|
||||
COMMAND ${PROJECT_SOURCE_DIR}/cmake/script/macos_zip.sh ${ZIP_EXECUTABLE} ${osx_volname}.zip
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_target(deploy
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/dist/${osx_volname}.zip
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
add_dependencies(deploydir bitcoin-qt)
|
||||
add_dependencies(deploy deploydir)
|
||||
|
|
|
@ -141,7 +141,7 @@ brew install python
|
|||
#### Deploy Dependencies
|
||||
|
||||
You can [deploy](#3-deploy-optional) a `.zip` containing the Bitcoin Core application.
|
||||
It is required that you have `python` installed.
|
||||
It is required that you have `python` and `zip` installed.
|
||||
|
||||
## Building Bitcoin Core
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue