hc
2023-02-13 e440ec23c5a540cdd3f7464e8779219be6fd3d95
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
From 37a6666a532e9cbc42b56301f27919ae7c00d2eb Mon Sep 17 00:00:00 2001
From: Stefano Babic <sbabic@denx.de>
Date: Tue, 23 Jan 2018 16:52:32 +0100
Subject: [PATCH] Fix build if DOWNLOAD is set, but no JSON
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
 
The downloader does not require JSON, but channel_curl is built
even if not called. Build fails with the error:
 
corelib/channel_curl.c:27:10: fatal error: json-c/json.h: No such file or directory
 
Add a CONFIG_CHANNEL_CURL that is automatically set by the modules
reuiring it (suricatta and swuforwarder).
 
Backported from: 37a6666a532e9cbc42b56301f27919ae7c00d2eb
 
Signed-off-by: Stefano Babic <sbabic@denx.de>
Reported-by: Jörg Krause <joerg.krause@embedded.rocks>
Acked-by: Jörg Krause <joerg.krause@embedded.rocks>
Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
---
 Kconfig             | 7 +++++++
 corelib/Makefile    | 2 +-
 handlers/Config.in  | 8 +++++---
 suricatta/Config.in | 3 +--
 4 files changed, 14 insertions(+), 6 deletions(-)
 
diff --git a/Kconfig b/Kconfig
index 4469096..e344572 100644
--- a/Kconfig
+++ b/Kconfig
@@ -294,6 +294,13 @@ config DOWNLOAD
 comment "Image downloading support needs libcurl"
     depends on !HAVE_LIBCURL
 
+config CHANNEL_CURL
+    bool
+    depends on HAVE_LIBCURL
+    depends on HAVE_JSON_C
+    select CURL
+    select JSON
+
 config HASH_VERIFY
     bool "Allow to add sha256 hash to each image"
     depends on HAVE_LIBSSL
diff --git a/corelib/Makefile b/corelib/Makefile
index 282bffd..4b30f9c 100644
--- a/corelib/Makefile
+++ b/corelib/Makefile
@@ -17,4 +17,4 @@ lib-$(CONFIG_ENCRYPTED_IMAGES)    += swupdate_decrypt.o
 lib-$(CONFIG_LIBCONFIG)        += swupdate_settings.o \
                    parsing_library_libconfig.o
 lib-$(CONFIG_JSON)        += parsing_library_libjson.o
-lib-$(CONFIG_CURL)        += channel_curl.o
+lib-$(CONFIG_CHANNEL_CURL)    += channel_curl.o
diff --git a/handlers/Config.in b/handlers/Config.in
index 596f069..6226b59 100644
--- a/handlers/Config.in
+++ b/handlers/Config.in
@@ -54,7 +54,6 @@ config UBIVIDOFFSET
       if your NAND driver incorrectly reports that it can handle
       sub-page accesses when it should not.
 
-
 config CFI
     bool "cfi"
     depends on MTD
@@ -164,8 +163,8 @@ comment "remote handler needs zeromq"
 config SWUFORWARDER_HANDLER
     bool "SWU forwarder"
     depends on HAVE_LIBCURL
-    select CURL
-    select JSON
+    depends on HAVE_JSON_C
+    select CHANNEL_CURL
     default n
     help
       This allows to build a chain of updater. A
@@ -174,6 +173,9 @@ config SWUFORWARDER_HANDLER
       embedded SWU to the other devices using the
       Webserver REST API.
 
+comment "swuforward handler needs json-c and curl"
+    depends on !HAVE_JSON_C || !HAVE_LIBCURL
+
 comment "SWU forwarder requires libcurl"
     depends on !HAVE_LIBCURL
 
diff --git a/suricatta/Config.in b/suricatta/Config.in
index 62e448a..2586169 100644
--- a/suricatta/Config.in
+++ b/suricatta/Config.in
@@ -71,8 +71,7 @@ config SURICATTA_HAWKBIT
     bool "hawkBit support"
     depends on HAVE_LIBCURL
     depends on HAVE_JSON_C
-    select JSON
-    select CURL
+    select CHANNEL_CURL
     help
       Support for hawkBit server.
       https://projects.eclipse.org/projects/iot.hawkbit
-- 
2.16.1