netutils/cjson: update cJSON download URL format

Modified CMakeLists.txt, Kconfig, and Makefile to change the cJSON download URL to include 'refs/tags/' for proper version fetching. This ensures compatibility with GitHub's archive download requirements.

Signed-off-by: Arjav Patel <arjav1528@gmail.com>
This commit is contained in:
Arjav Patel 2026-02-12 17:54:54 +05:30 committed by Alan C. Assis
parent 1ab486d1d0
commit 76e02c0dd6
3 changed files with 6 additions and 8 deletions

View file

@ -23,20 +23,20 @@
if(CONFIG_NETUTILS_CJSON)
if(NOT CONFIG_NETUTILS_CJSON_URL)
set(CONFIG_NETUTILS_CJSON_URL "https://github.com/DaveGamble/cJSON/archive")
set(CONFIG_NETUTILS_CJSON_URL
"https://github.com/DaveGamble/cJSON/archive/refs/tags")
endif()
if(NOT CONFIG_NETUTILS_CJSON_VERSION)
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}/refs/tags/v${CONFIG_NETUTILS_CJSON_VERSION}.tar.gz"
URL "${CONFIG_NETUTILS_CJSON_URL}/v${CONFIG_NETUTILS_CJSON_VERSION}.tar.gz"
SOURCE_DIR
${CMAKE_CURRENT_LIST_DIR}/cJSON
BINARY_DIR

View file

@ -14,7 +14,7 @@ if NETUTILS_CJSON
config NETUTILS_CJSON_URL
string "URL where cJSON library can be downloaded"
default "https://github.com/DaveGamble/cJSON/archive"
default "https://github.com/DaveGamble/cJSON/archive/refs/tags"
config NETUTILS_CJSON_VERSION
string "Version number"

View file

@ -28,7 +28,7 @@ include $(APPDIR)/Make.defs
WD := ${shell echo $(CURDIR) | sed -e 's/ /\\ /g'}
CONFIG_NETUTILS_CJSON_URL ?= "https://github.com/DaveGamble/cJSON/archive"
CONFIG_NETUTILS_CJSON_URL ?= "https://github.com/DaveGamble/cJSON/archive/refs/tags"
CONFIG_NETUTILS_CJSON_VERSION ?= "1.7.10"
CJSON_VERSION = $(patsubst "%",%,$(strip $(CONFIG_NETUTILS_CJSON_VERSION)))
@ -49,12 +49,10 @@ 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)/refs/tags/$(CJSON_TARBALL)
$(Q) curl -O -L $(CONFIG_NETUTILS_CJSON_URL)/$(CJSON_TARBALL)
$(CJSON_UNPACKNAME): $(CJSON_TARBALL)
@echo "Unpacking: $(CJSON_TARBALL) -> $(CJSON_UNPACKNAME)"