netutils/cjson: update download URL for cJSON tarball to include refs/tags

Modified the CMakeLists.txt and Makefile to ensure the correct format for downloading the cJSON tarball from GitHub by including 'refs/tags/' in the URL. This change addresses issues with fetching the correct version of the library.

Signed-off-by: Arjav Patel <arjav1528@gmail.com>
This commit is contained in:
Arjav Patel 2026-02-12 17:30:41 +05:30 committed by Alan C. Assis
parent 7289c27a85
commit 1ab486d1d0
2 changed files with 5 additions and 2 deletions

View file

@ -30,12 +30,13 @@ if(CONFIG_NETUTILS_CJSON)
set(CONFIG_NETUTILS_CJSON_VERSION "1.7.10")
endif()
# GitHub requires refs/tags/ in the archive URL for tag downloads
if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/cJSON)
FetchContent_Declare(
cJSON
DOWNLOAD_NAME "v${CONFIG_NETUTILS_CJSON_VERSION}.tar.gz"
DOWNLOAD_DIR ${CMAKE_CURRENT_LIST_DIR}
URL "${CONFIG_NETUTILS_CJSON_URL}/v${CONFIG_NETUTILS_CJSON_VERSION}.tar.gz"
URL "${CONFIG_NETUTILS_CJSON_URL}/refs/tags/v${CONFIG_NETUTILS_CJSON_VERSION}.tar.gz"
SOURCE_DIR
${CMAKE_CURRENT_LIST_DIR}/cJSON
BINARY_DIR

View file

@ -49,10 +49,12 @@ CSRCS = $(CJSON_SRCDIR)$(DELIM)cJSON.c
CSRCS += $(CJSON_SRCDIR)$(DELIM)cJSON_Utils.c
# Download and unpack tarball if no git repo found
# GitHub requires refs/tags/ in the archive URL for tag downloads (see
# https://docs.github.com/en/repositories/working-with-files/using-files/downloading-source-code-archives)
ifeq ($(wildcard $(CJSON_UNPACKNAME)/.git),)
$(CJSON_TARBALL):
@echo "Downloading: $(CJSON_TARBALL)"
$(Q) curl -O -L $(CONFIG_NETUTILS_CJSON_URL)/$(CJSON_TARBALL)
$(Q) curl -O -L $(CONFIG_NETUTILS_CJSON_URL)/refs/tags/$(CJSON_TARBALL)
$(CJSON_UNPACKNAME): $(CJSON_TARBALL)
@echo "Unpacking: $(CJSON_TARBALL) -> $(CJSON_UNPACKNAME)"