diff mbox series

Fix build if DOWNLOAD is set, but no JSON

Message ID 1516722999-32469-1-git-send-email-sbabic@denx.de
State Changes Requested
Headers show
Series Fix build if DOWNLOAD is set, but no JSON | expand

Commit Message

Stefano Babic Jan. 23, 2018, 3:56 p.m. UTC
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).

Signed-off-by: Stefano Babic <sbabic@denx.de>
Reported-by: Jörg Krause <joerg.krause@embedded.rocks>
---
 corelib/Makefile    | 2 +-
 handlers/Config.in  | 1 +
 suricatta/Config.in | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

Comments

Jörg Krause Jan. 24, 2018, 3:17 p.m. UTC | #1
Hi Stefano,

On Tue, 2018-01-23 at 16:56 +0100, Stefano Babic wrote:
> 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).
> 
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> Reported-by: Jörg Krause <joerg.krause@embedded.rocks>
> ---
>  corelib/Makefile    | 2 +-
>  handlers/Config.in  | 1 +
>  suricatta/Config.in | 1 +
>  3 files changed, 3 insertions(+), 1 deletion(-)
> 
> 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..c8b1df7 100644
> --- a/handlers/Config.in
> +++ b/handlers/Config.in
> @@ -165,6 +165,7 @@ config SWUFORWARDER_HANDLER
>  	bool "SWU forwarder"
>  	depends on HAVE_LIBCURL
>  	select CURL
> +	select CHANNEL_CURL
>  	select JSON
>  	default n
>  	help
> diff --git a/suricatta/Config.in b/suricatta/Config.in
> index 62e448a..de25d59 100644
> --- a/suricatta/Config.in
> +++ b/suricatta/Config.in
> @@ -73,6 +73,7 @@ config SURICATTA_HAWKBIT
>  	depends on HAVE_JSON_C
>  	select JSON
>  	select CURL
> +	select CHANNEL_CURL
>  	help
>  	  Support for hawkBit server.
>  	  https://projects.eclipse.org/projects/iot.hawkbit

How about:

```
config CHANNEL_CURL
	bool
	depends on HAVE_LIBCURL
	depends on HAVE_JSON_C
	select CURL
	select JSON

config SWUFORWARDER_HANDLER
  	bool "SWU forwarder"
	depends on HAVE_LIBCURL
	depends on HAVE_JSON_C
	select CHANNEL_CURL
	help
	  ...

comment "SWU forwarder needs libcurl and JSON-C"
	depends on !HAVE_LIBCURL || !HAVE_JSON_C

config SURICATTA_HAWKBIT
  	bool "Suricatta Hawkbit"
	depends on HAVE_LIBCURL
	depends on HAVE_JSON_C
	select CHANNEL_CURL
	help
	  ...

comment "Suricatta Hawkbit needs libcurl and JSON-C"
	depends on !HAVE_LIBCURL || !HAVE_JSON_C
```

Best regards,
Jörg Krause
Stefano Babic Jan. 24, 2018, 3:27 p.m. UTC | #2
On 24/01/2018 16:17, Jörg Krause wrote:
> Hi Stefano,
> 
> On Tue, 2018-01-23 at 16:56 +0100, Stefano Babic wrote:
>> 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).
>>
>> Signed-off-by: Stefano Babic <sbabic@denx.de>
>> Reported-by: Jörg Krause <joerg.krause@embedded.rocks>
>> ---
>>  corelib/Makefile    | 2 +-
>>  handlers/Config.in  | 1 +
>>  suricatta/Config.in | 1 +
>>  3 files changed, 3 insertions(+), 1 deletion(-)
>>
>> 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..c8b1df7 100644
>> --- a/handlers/Config.in
>> +++ b/handlers/Config.in
>> @@ -165,6 +165,7 @@ config SWUFORWARDER_HANDLER
>>  	bool "SWU forwarder"
>>  	depends on HAVE_LIBCURL
>>  	select CURL
>> +	select CHANNEL_CURL
>>  	select JSON
>>  	default n
>>  	help
>> diff --git a/suricatta/Config.in b/suricatta/Config.in
>> index 62e448a..de25d59 100644
>> --- a/suricatta/Config.in
>> +++ b/suricatta/Config.in
>> @@ -73,6 +73,7 @@ config SURICATTA_HAWKBIT
>>  	depends on HAVE_JSON_C
>>  	select JSON
>>  	select CURL
>> +	select CHANNEL_CURL
>>  	help
>>  	  Support for hawkBit server.
>>  	  https://projects.eclipse.org/projects/iot.hawkbit
> 
> How about:
> 
> ```
> config CHANNEL_CURL
> 	bool
> 	depends on HAVE_LIBCURL
> 	depends on HAVE_JSON_C
> 	select CURL
> 	select JSON
> 
> config SWUFORWARDER_HANDLER
>   	bool "SWU forwarder"
> 	depends on HAVE_LIBCURL
> 	depends on HAVE_JSON_C
> 	select CHANNEL_CURL
> 	help
> 	  ...
> 
> comment "SWU forwarder needs libcurl and JSON-C"
> 	depends on !HAVE_LIBCURL || !HAVE_JSON_C
> 
> config SURICATTA_HAWKBIT
>   	bool "Suricatta Hawkbit"
> 	depends on HAVE_LIBCURL
> 	depends on HAVE_JSON_C
> 	select CHANNEL_CURL
> 	help
> 	  ...
> 
> comment "Suricatta Hawkbit needs libcurl and JSON-C"
> 	depends on !HAVE_LIBCURL || !HAVE_JSON_C
> ```
> 

It is better, thanks - I send V2.

Best regards,
Stefano Babic
diff mbox series

Patch

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..c8b1df7 100644
--- a/handlers/Config.in
+++ b/handlers/Config.in
@@ -165,6 +165,7 @@  config SWUFORWARDER_HANDLER
 	bool "SWU forwarder"
 	depends on HAVE_LIBCURL
 	select CURL
+	select CHANNEL_CURL
 	select JSON
 	default n
 	help
diff --git a/suricatta/Config.in b/suricatta/Config.in
index 62e448a..de25d59 100644
--- a/suricatta/Config.in
+++ b/suricatta/Config.in
@@ -73,6 +73,7 @@  config SURICATTA_HAWKBIT
 	depends on HAVE_JSON_C
 	select JSON
 	select CURL
+	select CHANNEL_CURL
 	help
 	  Support for hawkBit server.
 	  https://projects.eclipse.org/projects/iot.hawkbit