From d532a663d0fe3ee758bf9598abe043bea99624f2 Mon Sep 17 00:00:00 2001 From: Harry Ramsey Date: Mon, 4 Nov 2024 10:50:30 +0000 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 | 11 ++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2eba16da5d..6a0e003b24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -284,7 +284,11 @@ if(LIB_INSTALL_DIR) endif() if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/framework/CMakeLists.txt") - message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/framework/CMakeLists.txt not found. Run `git submodule update --init` from the source tree to fetch the submodule contents.") + 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 (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 e0a7510d75..3b89183e1c 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,16 @@ 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. + 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. This is a fatal error + 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 + endif $(error $(error_message)) endif include framework/exported.make From bfd83badc86bd557384a4912d33ba28ef99c7b3a Mon Sep 17 00:00:00 2001 From: Harry Ramsey Date: Mon, 4 Nov 2024 11:39:46 +0000 Subject: [PATCH 2/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 3b89183e1c..89142b1b4c 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 0ad7cc2bf976d910f37b5a218cce5626c1393857 Mon Sep 17 00:00:00 2001 From: Harry Ramsey Date: Mon, 4 Nov 2024 12:18:53 +0000 Subject: [PATCH 3/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 89142b1b4c..bc01c8caba 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)) From e3fdd0a9c5f5663116a1b939348fb922faa6aa3d Mon Sep 17 00:00:00 2001 From: Harry Ramsey Date: Mon, 4 Nov 2024 15:14:53 +0000 Subject: [PATCH 4/4] Fix undefined variable in CMakeLists.txt This commit replaces an undefined variable ${MBEDTLS_FRAMEWORK_DIR} for ${CMAKE_CURRENT_SOURCE_DIR}. Signed-off-by: Harry Ramsey --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a0e003b24..7a19127a84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -285,9 +285,9 @@ endif() if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/framework/CMakeLists.txt") 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.") + message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_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 (and does not appear to be a git checkout). Please ensure you have downloaded the right archive from the release page on GitHub.") + message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_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)