Skip to content

Commit

Permalink
cmake: Require zip only for deploy target
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Mar 10, 2025
1 parent f52377b commit b86eb5f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
32 changes: 22 additions & 10 deletions cmake/module/Maintenance.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,28 @@ 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
COMMAND ${CMAKE_COMMAND} -E echo "Error: ZIP not found."
COMMAND ${CMAKE_COMMAND} -E echo "Please install ZIP and/or ensure that its executable is accessible to the find_program() command—"
COMMAND ${CMAKE_COMMAND} -E echo "for example, by setting the ZIP_EXECUTABLE variable or another relevant CMake variable."
COMMAND ${CMAKE_COMMAND} -E echo "Then re-run cmake to regenerate the build system."
COMMAND ${CMAKE_COMMAND} -E echo
VERBATIM
)
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)
Expand Down
2 changes: 1 addition & 1 deletion doc/build-osx.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit b86eb5f

Please sign in to comment.