mqtt: Add glue code to download MQTT-C.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche 2021-03-27 12:37:10 +01:00 committed by Xiang Xiao
parent 52d853e642
commit e35ea9486e
4 changed files with 100 additions and 0 deletions

2
netutils/mqttc/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/MQTT-C
/*tar.gz

18
netutils/mqttc/Kconfig Normal file
View File

@ -0,0 +1,18 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config NETUTILS_MQTTC
tristate "Enable MQTT-C"
default n
---help---
Enable MQTT-C
if NETUTILS_MQTTC
config NETUTILS_MQTTC_VERSION
string "MQTT-C Version"
default "1.1.4"
endif

32
netutils/mqttc/Make.defs Normal file
View File

@ -0,0 +1,32 @@
############################################################################
# apps/netutils/mqttc/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
ifneq ($(CONFIG_NETUTILS_MQTTC),)
CONFIGURED_APPS += $(APPDIR)/netutils/mqttc
CFLAGS += -D__unix__
CXXFLAGS += -D__unix__
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" \
$(APPDIR)/netutils/mqttc/MQTT-C/include}
CXXFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" \
$(APPDIR)/netutils/mqttc/MQTT-C/include}
endif

48
netutils/mqttc/Makefile Normal file
View File

@ -0,0 +1,48 @@
############################################################################
# apps/netutils/mqttc/Makefile
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(APPDIR)/Make.defs
MQTTC_VERSION := $(patsubst "%",%,$(CONFIG_NETUTILS_MQTTC_VERSION))
MQTTC_TARBALL = $(MQTTC_VERSION).tar.gz
MQTTC_UNPACK = MQTT-C
MQTTC_SRCDIR = $(MQTTC_UNPACK)$(DELIM)src
DEPPATH += --dep-path $(MQTTC_SRCDIR)
VPATH += :$(MQTTC_SRCDIR)
CSRCS := $(notdir $(wildcard $(MQTTC_SRCDIR)$(DELIM)*.c))
$(MQTTC_TARBALL):
$(Q) echo "Downloading MQTT-C-$(MQTTC_VERSION)"
$(Q) curl -O -L https://github.com/LiamBindle/MQTT-C/archive/$(MQTTC_TARBALL)
$(MQTTC_UNPACK): $(MQTTC_TARBALL)
$(Q) tar zxf $(MQTTC_TARBALL)
$(Q) mv MQTT-C-$(MQTTC_VERSION) $(MQTTC_UNPACK)
$(Q) touch $(MQTTC_UNPACK)
context:: $(MQTTC_UNPACK)
distclean::
$(call DELFILE, $(MQTTC_TARBALL))
$(call DELDIR, $(MQTTC_UNPACK))
include $(APPDIR)/Application.mk