From e35ea9486e5ef8bd1c805b8087c2675343aa8101 Mon Sep 17 00:00:00 2001 From: Abdelatif Guettouche Date: Sat, 27 Mar 2021 12:37:10 +0100 Subject: [PATCH] mqtt: Add glue code to download MQTT-C. Signed-off-by: Abdelatif Guettouche --- netutils/mqttc/.gitignore | 2 ++ netutils/mqttc/Kconfig | 18 +++++++++++++++ netutils/mqttc/Make.defs | 32 ++++++++++++++++++++++++++ netutils/mqttc/Makefile | 48 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 100 insertions(+) create mode 100644 netutils/mqttc/.gitignore create mode 100644 netutils/mqttc/Kconfig create mode 100644 netutils/mqttc/Make.defs create mode 100644 netutils/mqttc/Makefile diff --git a/netutils/mqttc/.gitignore b/netutils/mqttc/.gitignore new file mode 100644 index 000000000..5d6e9a06e --- /dev/null +++ b/netutils/mqttc/.gitignore @@ -0,0 +1,2 @@ +/MQTT-C +/*tar.gz diff --git a/netutils/mqttc/Kconfig b/netutils/mqttc/Kconfig new file mode 100644 index 000000000..d17d19480 --- /dev/null +++ b/netutils/mqttc/Kconfig @@ -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 diff --git a/netutils/mqttc/Make.defs b/netutils/mqttc/Make.defs new file mode 100644 index 000000000..878961a03 --- /dev/null +++ b/netutils/mqttc/Make.defs @@ -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 diff --git a/netutils/mqttc/Makefile b/netutils/mqttc/Makefile new file mode 100644 index 000000000..3398f9a22 --- /dev/null +++ b/netutils/mqttc/Makefile @@ -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