diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2022-03-18 04:31:36 -0700 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2022-03-19 15:01:22 -0700 |
commit | 66e7ac19546b1158c7fd3ce8e088b0ad5f385a33 (patch) | |
tree | b53d29db7ed87a673f5b05c9f3d5b5517919e226 /Meta | |
parent | 6b5f0d11ce4754264cf4a6615076fd3522b0e958 (diff) | |
download | serenity-66e7ac19546b1158c7fd3ce8e088b0ad5f385a33.zip |
Meta: Error out on find_program errors with CMake less than 3.18
We have seen some cases where the build fails for folks, and they are
missing unzip/tar/gzip etc. We can catch some of these in CMake itself,
so lets make sure to handle that uniformly across the build system.
The REQUIRED flag to `find_program` was only added on in CMake 3.18 and
above, so we can't rely on that to actually halt the program execution.
Diffstat (limited to 'Meta')
-rw-r--r-- | Meta/CMake/check_for_dependencies.cmake | 23 | ||||
-rw-r--r-- | Meta/CMake/time_zone_data.cmake | 2 | ||||
-rw-r--r-- | Meta/CMake/unicode_data.cmake | 2 | ||||
-rw-r--r-- | Meta/CMake/wasm_spec_tests.cmake | 4 | ||||
-rw-r--r-- | Meta/Lagom/CMakeLists.txt | 1 |
5 files changed, 28 insertions, 4 deletions
diff --git a/Meta/CMake/check_for_dependencies.cmake b/Meta/CMake/check_for_dependencies.cmake new file mode 100644 index 0000000000..6ab71c9c43 --- /dev/null +++ b/Meta/CMake/check_for_dependencies.cmake @@ -0,0 +1,23 @@ +# +# Check for the dependencies that the Serenity (target) and Lagom (host) builds require. +# + +# FIXME: With cmake 3.18, we can change unzip/untar/gzip steps to use +# file( ARCHIVE_EXTRACT) instead +# +# Additionally we have to emit an error message for each tool, +# as REQUIRED only works with cmake 3.18 and above. +find_program(UNZIP_TOOL unzip REQUIRED) +if (NOT UNZIP_TOOL) + message(FATAL_ERROR "Failed to locate unzip on your machine, please install it and re-read the SerenityOS build documentation.") +endif() + +find_program(TAR_TOOL tar REQUIRED) +if (NOT TAR_TOOL) + message(FATAL_ERROR "Failed to locate tar on your machine, please install it and re-read the SerenityOS build documentation.") +endif() + +find_program(GZIP_TOOL gzip REQUIRED) +if (NOT GZIP_TOOL) + message(FATAL_ERROR "Failed to locate gzip on your machine, please install it and re-read the SerenityOS build documentation.") +endif() diff --git a/Meta/CMake/time_zone_data.cmake b/Meta/CMake/time_zone_data.cmake index 032aad100d..f60ce486cd 100644 --- a/Meta/CMake/time_zone_data.cmake +++ b/Meta/CMake/time_zone_data.cmake @@ -41,7 +41,7 @@ set(TZDB_ZONE_1970_PATH "${TZDB_PATH}/${TZDB_ZONE_1970_SOURCE}") function(extract_tzdb_file source path) if(EXISTS "${TZDB_ZIP_PATH}" AND NOT EXISTS "${path}") message(STATUS "Extracting TZDB ${source} from ${TZDB_ZIP_PATH}...") - execute_process(COMMAND tar -C "${TZDB_PATH}" -xf "${TZDB_ZIP_PATH}" "${source}" RESULT_VARIABLE tar_result) + execute_process(COMMAND "${TAR_TOOL}" -C "${TZDB_PATH}" -xf "${TZDB_ZIP_PATH}" "${source}" RESULT_VARIABLE tar_result) if (NOT tar_result EQUAL 0) message(FATAL_ERROR "Failed to unzip ${source} from ${TZDB_ZIP_PATH} with status ${tar_result}") endif() diff --git a/Meta/CMake/unicode_data.cmake b/Meta/CMake/unicode_data.cmake index 1d89f13253..c4965a473a 100644 --- a/Meta/CMake/unicode_data.cmake +++ b/Meta/CMake/unicode_data.cmake @@ -91,7 +91,7 @@ set(CLDR_UNITS_PATH "${CLDR_PATH}/${CLDR_UNITS_SOURCE}") function(extract_cldr_file source path) if(EXISTS "${CLDR_ZIP_PATH}" AND NOT EXISTS "${path}") message(STATUS "Extracting CLDR ${source} from ${CLDR_ZIP_PATH}...") - execute_process(COMMAND unzip -q "${CLDR_ZIP_PATH}" "${source}/**" -d "${CLDR_PATH}" RESULT_VARIABLE unzip_result) + execute_process(COMMAND "${UNZIP_TOOL}" -q "${CLDR_ZIP_PATH}" "${source}/**" -d "${CLDR_PATH}" RESULT_VARIABLE unzip_result) if (NOT unzip_result EQUAL 0) message(FATAL_ERROR "Failed to unzip ${source} from ${CLDR_ZIP_PATH} with status ${unzip_result}") endif() diff --git a/Meta/CMake/wasm_spec_tests.cmake b/Meta/CMake/wasm_spec_tests.cmake index 6b90373ecf..17c9110e71 100644 --- a/Meta/CMake/wasm_spec_tests.cmake +++ b/Meta/CMake/wasm_spec_tests.cmake @@ -22,8 +22,8 @@ if(INCLUDE_WASM_SPEC_TESTS) if(EXISTS ${WASM_SPEC_TEST_GZ_PATH} AND NOT EXISTS ${WASM_SPEC_TEST_PATH}) message(STATUS "Extracting the WebAssembly testsuite from ${WASM_SPEC_TEST_GZ_PATH}...") file(MAKE_DIRECTORY ${WASM_SPEC_TEST_PATH}) - execute_process(COMMAND gzip -k -d ${WASM_SPEC_TEST_GZ_PATH}) - execute_process(COMMAND tar -xf ${WASM_SPEC_TEST_TAR_PATH}) + execute_process(COMMAND "${GZIP_TOOL}" -k -d ${WASM_SPEC_TEST_GZ_PATH}) + execute_process(COMMAND "${TAR_TOOL}" -xf ${WASM_SPEC_TEST_TAR_PATH}) execute_process(COMMAND rm ${WASM_SPEC_TEST_TAR_PATH}) file(GLOB WASM_TESTS "${CMAKE_BINARY_DIR}/testsuite-main/*.wast") foreach(PATH ${WASM_TESTS}) diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index 4ca364be40..b4c29c8cf9 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -32,6 +32,7 @@ if(NOT COMMAND serenity_option) endmacro() endif() +include(check_for_dependencies) include(lagom_options) if(ENABLE_ALL_THE_DEBUG_MACROS) |