From e05cf2e11ee58bec9457c201fa1cc72831137399 Mon Sep 17 00:00:00 2001 From: Harry Ramsey Date: Tue, 17 Sep 2024 15:12:11 +0100 Subject: [PATCH 1/4] Improve submodule error messages for Github archives This commit improves the error messages informing users that have downloaded Github archives to instead download a release archive. This is due to Github not supporting submodules within archives and no trivial way for users to use git to download them. Signed-off-by: Harry Ramsey --- CMakeLists.txt | 6 +++++- Makefile | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 561498c5d4..958c247829 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -323,7 +323,11 @@ if(LIB_INSTALL_DIR) endif() if (NOT EXISTS "${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt") - message(FATAL_ERROR "${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt not found. Run `git submodule update --init` from the source tree to fetch the submodule contents.") + if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/") + message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/.git/ not found. Please ensure you have downloaded a release version of Mbed TLS from GitHub.") + else () + message(FATAL_ERROR "${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt not found. Run `git submodule update --init` from the source tree to fetch the submodule contents.") + endif() endif() add_subdirectory(framework) diff --git a/Makefile b/Makefile index 71ef1bef06..07eb5567af 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,19 @@ $(MBEDTLS_PATH)/framework/exported.make not found. Run `git submodule update --init` to fetch the submodule contents. This is a fatal error endef + ifeq (,$(wildcard .git)) + define error_message +$(MBEDTLS_PATH)/.git/ not found. +Please ensure you have downloaded a release version of Mbed TLS from GitHub. +This is a fatal error + endef + else + define error_message +$(MBEDTLS_PATH)/framework/exported.make not found. +Run `git submodule update --init` to fetch the submodule contents. +This is a fatal error + endef + endif $(error $(error_message)) endif include framework/exported.make From 6d9c389957b5af45162d81958a8778bf0d90fe4d Mon Sep 17 00:00:00 2001 From: Harry Ramsey Date: Mon, 28 Oct 2024 14:05:23 +0000 Subject: [PATCH 2/4] Further improve error message clarity This commit further improves error message clarity. Signed-off-by: Harry Ramsey --- CMakeLists.txt | 6 +++--- Makefile | 16 ++++------------ 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 958c247829..765293ec16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -323,10 +323,10 @@ if(LIB_INSTALL_DIR) endif() if (NOT EXISTS "${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt") - if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/") - message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/.git/ not found. Please ensure you have downloaded a release version of Mbed TLS from GitHub.") + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/") + message(FATAL_ERROR "${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt not found (and does appear to be a git checkout). Run `git submodule update --init` from the source tree to fetch the submodule contents.") else () - message(FATAL_ERROR "${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt not found. Run `git submodule update --init` from the source tree to fetch the submodule contents.") + message(FATAL_ERROR "${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt not found (and does not appear to be a git checkout). Please ensure you have downloaded the right archive from the release page on GitHub.") endif() endif() add_subdirectory(framework) diff --git a/Makefile b/Makefile index 07eb5567af..6e10cf6f0a 100644 --- a/Makefile +++ b/Makefile @@ -6,23 +6,15 @@ ifneq (,$(filter-out lib library/%,$(or $(MAKECMDGOALS),all))) ifeq (,$(wildcard framework/exported.make)) # Use the define keyword to get a multi-line message. # GNU make appends ". Stop.", so tweak the ending of our message accordingly. - define error_message -$(MBEDTLS_PATH)/framework/exported.make not found. -Run `git submodule update --init` to fetch the submodule contents. -This is a fatal error - endef ifeq (,$(wildcard .git)) - define error_message -$(MBEDTLS_PATH)/.git/ not found. -Please ensure you have downloaded a release version of Mbed TLS from GitHub. + define error_message +${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt not found (and does appear to be a git checkout). Run `git submodule update --init` from the source tree to fetch the submodule contents. This is a fatal error endef else define error_message -$(MBEDTLS_PATH)/framework/exported.make not found. -Run `git submodule update --init` to fetch the submodule contents. -This is a fatal error - endef +${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt not found (and does not appear to be a git checkout). Please ensure you have downloaded the right archive from the release page on GitHub. + endef endif $(error $(error_message)) endif From 66ce986ef31ef2a4f93ef240c7d1c300b76870e9 Mon Sep 17 00:00:00 2001 From: Harry Ramsey Date: Mon, 4 Nov 2024 11:37:05 +0000 Subject: [PATCH 3/4] Improve makefile error message This commit improves the makefile error message when using make, it no longer incorrectly reports that CMakeLists.txt cannot be found instead of exported.make. Signed-off-by: Harry Ramsey --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6e10cf6f0a..205d308bb2 100644 --- a/Makefile +++ b/Makefile @@ -8,13 +8,13 @@ ifneq (,$(filter-out lib library/%,$(or $(MAKECMDGOALS),all))) # GNU make appends ". Stop.", so tweak the ending of our message accordingly. ifeq (,$(wildcard .git)) define error_message -${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt not found (and does appear to be a git checkout). Run `git submodule update --init` from the source tree to fetch the submodule contents. +${MBEDTLS_FRAMEWORK_DIR}/exported.make not found (and does appear to be a git checkout). Run `git submodule update --init` from the source tree to fetch the submodule contents. This is a fatal error - endef + endef else - define error_message -${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt not found (and does not appear to be a git checkout). Please ensure you have downloaded the right archive from the release page on GitHub. - endef + define error_message +${MBEDTLS_FRAMEWORK_DIR}/exported.make not found (and does not appear to be a git checkout). Please ensure you have downloaded the right archive from the release page on GitHub. + endef endif $(error $(error_message)) endif From 0f07e76b4ba3f2e2e611cfbc8e84a392970ada71 Mon Sep 17 00:00:00 2001 From: Harry Ramsey Date: Mon, 4 Nov 2024 12:16:50 +0000 Subject: [PATCH 4/4] Fix undefined variable in makefile This commit replaces an undefined variable ${MBEDTLS_FRAMEWORK_DIR} for ${MBEDTLS_PATH}. Signed-off-by: Harry Ramsey --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 205d308bb2..1b480f54ab 100644 --- a/Makefile +++ b/Makefile @@ -8,12 +8,12 @@ ifneq (,$(filter-out lib library/%,$(or $(MAKECMDGOALS),all))) # GNU make appends ". Stop.", so tweak the ending of our message accordingly. ifeq (,$(wildcard .git)) define error_message -${MBEDTLS_FRAMEWORK_DIR}/exported.make not found (and does appear to be a git checkout). Run `git submodule update --init` from the source tree to fetch the submodule contents. +${MBEDTLS_PATH}/framework/exported.make not found (and does appear to be a git checkout). Run `git submodule update --init` from the source tree to fetch the submodule contents. This is a fatal error endef else define error_message -${MBEDTLS_FRAMEWORK_DIR}/exported.make not found (and does not appear to be a git checkout). Please ensure you have downloaded the right archive from the release page on GitHub. +${MBEDTLS_PATH}/framework/exported.make not found (and does not appear to be a git checkout). Please ensure you have downloaded the right archive from the release page on GitHub. endef endif $(error $(error_message))