--- /dev/null
+diff -u -r ../mosquitto-1.4.10/src/CMakeLists.txt ./src/CMakeLists.txt
+--- ../mosquitto-1.4.10/src/CMakeLists.txt 2016-08-17 13:05:14.000000000 +0200
++++ ./src/CMakeLists.txt 2017-01-24 23:40:30.787022276 +0100
+@@ -107,7 +111,7 @@
+ endif (UUID_HEADER)
+ endif(NOT APPLE)
+
+-target_link_libraries(mosquitto ${MOSQ_LIBS})
++target_link_libraries(mosquitto ${MOSQ_LIBS} log)
+
+ if (UNIX)
+ if (APPLE)
-TERMUX_PKG_DESCRIPTION="MQTT library"
TERMUX_PKG_HOMEPAGE=https://mosquitto.org/
+TERMUX_PKG_DESCRIPTION="MQTT library"
TERMUX_PKG_VERSION=1.4.10
+TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://mosquitto.org/files/source/mosquitto-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=437648d68a4a781dd8d913814cd5451f59ab4a5fcf84cccaf7c36e6a07459770
-TERMUX_PKG_BUILD_IN_SRC=Yes
TERMUX_PKG_DEPENDS="c-ares, openssl"
TERMUX_PKG_MAINTAINER="Nathaniel Wesley Filardo @nwf"
-
-termux_step_configure() {
- # Prevent cmake configuration.
- return
-}
-
-termux_step_make() {
- for i in lib client; do make -C $i; done
-}
-termux_step_make_install() {
- for i in lib client; do make -C $i DESTDIR=${TERMUX_PREFIX} install; done
-}
-
+TERMUX_PKG_EXTRA_CONFIGURE_ARGS="\
+-DWITH_THREADING=OFF
+-DWITH_TLS_PSK=OFF"
+TERMUX_PKG_RM_AFTER_INSTALL="include/mosquittopp.h lib/libmosquittopp.so"
+++ /dev/null
-diff --git a/config.mk b/config.mk
-index 087766c..6ff9bc1 100644
---- a/config.mk
-+++ b/config.mk
-@@ -26,10 +26,10 @@ WITH_TLS:=yes
- # Comment out to disable TLS/PSK support in the broker and client. Requires
- # WITH_TLS=yes.
- # This must be disabled if using openssl < 1.0.
--WITH_TLS_PSK:=yes
-+WITH_TLS_PSK:=no
-
- # Comment out to disable client client threading support.
--WITH_THREADING:=yes
-+WITH_THREADING:=no
-
- # Comment out to remove bridge support from the broker. This allow the broker
- # to connect to other brokers and subscribe/publish to topics. You probably
-@@ -124,8 +124,7 @@ LIB_LIBS:=
- PASSWD_LIBS:=
-
- ifeq ($(UNAME),Linux)
-- BROKER_LIBS:=$(BROKER_LIBS) -lrt -Wl,--dynamic-list=linker.syms
-- LIB_LIBS:=$(LIB_LIBS) -lrt
-+ BROKER_LIBS:=$(BROKER_LIBS) -Wl,--dynamic-list=linker.syms
- endif
-
- CLIENT_LDFLAGS:=$(LDFLAGS) -L../lib ../lib/libmosquitto.so.${SOVERSION}
-@@ -241,7 +240,7 @@ ifeq ($(WITH_DOCS),yes)
- endif
-
- INSTALL?=install
--prefix=/usr/local
-+prefix=
- mandir=${prefix}/share/man
- localedir=${prefix}/share/locale
- STRIP?=strip
+Submitted for upstream inclusion at:
+https://github.com/eclipse/mosquitto/pull/360
+
+diff -u -r ../mosquitto-1.4.10/src/CMakeLists.txt ./src/CMakeLists.txt
+--- ../mosquitto-1.4.10/src/CMakeLists.txt 2016-08-17 13:05:14.000000000 +0200
++++ ./src/CMakeLists.txt 2017-01-24 22:30:42.611308509 +0100
+@@ -86,7 +86,11 @@
+ if (APPLE)
+ set (MOSQ_LIBS ${MOSQ_LIBS} dl m)
+ else (APPLE)
+- set (MOSQ_LIBS ${MOSQ_LIBS} rt dl m)
++ set (MOSQ_LIBS ${MOSQ_LIBS} dl m)
++ find_library(LIBRT rt)
++ if (LIBRT)
++ set (MOSQ_LIBS ${MOSQ_LIBS} rt)
++ endif (LIBRT)
+ endif (APPLE)
+ endif (UNIX)
+
diff -u -r ../mosquitto-1.4.10/lib/CMakeLists.txt ./lib/CMakeLists.txt
--- ../mosquitto-1.4.10/lib/CMakeLists.txt 2016-08-17 13:05:14.000000000 +0200
+++ ./lib/CMakeLists.txt 2017-01-15 21:09:21.548573341 +0100
-TERMUX_SUBPKG_DEPENDS="libmosquitto"
-TERMUX_SUBPKG_INCLUDE="bin/mosquitto_pub bin/mosquitto_sub"
-TERMUX_SUBPKG_DESCRIPTION="mosquitto_pub and _sub clients"
+TERMUX_SUBPKG_DEPENDS="libmosquitto, libuuid"
+TERMUX_SUBPKG_INCLUDE="bin/ share/man/ etc/"
+TERMUX_SUBPKG_DESCRIPTION="MQTT version 3.1/3.1.1 compatible message broker and clients"
--- /dev/null
+Submitted for upstream inclusion at:
+https://github.com/eclipse/mosquitto/pull/361
+
+diff -u -r ../mosquitto-1.4.10/src/conf.c ./src/conf.c
+--- ../mosquitto-1.4.10/src/conf.c 2016-08-17 13:05:14.000000000 +0200
++++ ./src/conf.c 2017-01-24 10:50:34.011878190 +0100
+@@ -36,7 +36,7 @@
+ #endif
+
+ #if !defined(WIN32) && !defined(__CYGWIN__)
+-# include <sys/syslog.h>
++# include <syslog.h>
+ #endif
+
+ #include <mosquitto_broker.h>