aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungho Kim <melchi45@gmail.com>2018-03-31 08:34:51 +0900
committerRobert Schumacher <roschuma@microsoft.com>2018-03-30 16:34:51 -0700
commita8ae8773c5943c0c6a123e1c49c73cbb69e3add6 (patch)
tree061b4cc24d7a8bd58ad05859a4bcd0579003b755
parent8d0764cca8915ee08701eb0d2416154abfb1e5ab (diff)
downloadvcpkg-a8ae8773c5943c0c6a123e1c49c73cbb69e3add6.tar.gz
vcpkg-a8ae8773c5943c0c6a123e1c49c73cbb69e3add6.zip
add Mosquitto library for IoT (#3127)
* initial commit of 1.4.15 for mosquitto lib. initial commit of 1.4.15 for mosquitto lib. * bug fixed for win64 on mosquitto and install error bug fixed for win64 on mosquitto and install error * [mosquitto] Use patches to simplify portfile.
-rw-r--r--ports/mosquitto/0001-win64-cmake.patch40
-rw-r--r--ports/mosquitto/CONTROL8
-rw-r--r--ports/mosquitto/cmake-2.patch68
-rw-r--r--ports/mosquitto/cmake.patch13
-rw-r--r--ports/mosquitto/portfile.cmake56
5 files changed, 185 insertions, 0 deletions
diff --git a/ports/mosquitto/0001-win64-cmake.patch b/ports/mosquitto/0001-win64-cmake.patch
new file mode 100644
index 000000000..70888b637
--- /dev/null
+++ b/ports/mosquitto/0001-win64-cmake.patch
@@ -0,0 +1,40 @@
+--- a/config.h
++++ b/config.h
+@@ -16,7 +16,7 @@
+ # define EPROTO ECONNABORTED
+ #endif
+
+-#ifdef WIN32
++#ifdef WIN32 || WIN64
+ # ifndef strcasecmp
+ # define strcasecmp strcmpi
+ # endif
+--- a/lib/CMakeLists.txt
++++ b/lib/CMakeLists.txt
+@@ -4,8 +4,8 @@
+ if (${WITH_THREADING} STREQUAL ON)
+ add_definitions("-DWITH_THREADING")
+ if (WIN32)
+- set (PTHREAD_LIBRARIES C:\\pthreads\\Pre-built.2\\lib\\x86\\pthreadVC2.lib)
+- set (PTHREAD_INCLUDE_DIR C:\\pthreads\\Pre-built.2\\include)
++ set (PTHREAD_LIBRARIES ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/lib/pthreadsVC2.lib)
++ set (PTHREAD_INCLUDE_DIR ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/include)
+ else (WIN32)
+ find_library(LIBPTHREAD pthread)
+ if (LIBPTHREAD)
+--- a/lib/net_mosq.h
++++ b/lib/net_mosq.h
+@@ -20,7 +20,12 @@
+ #include <unistd.h>
+ #else
+ #include <winsock2.h>
++#if defined(_MSC_VER) && _MSC_VER > 1900
++#undef ssize_t
+ typedef int ssize_t;
++#else
++typedef int ssize_t;
++#endif
+ #endif
+
+ #include <mosquitto_internal.h>
+
diff --git a/ports/mosquitto/CONTROL b/ports/mosquitto/CONTROL
new file mode 100644
index 000000000..81d12dc23
--- /dev/null
+++ b/ports/mosquitto/CONTROL
@@ -0,0 +1,8 @@
+Source: mosquitto
+Version: 1.4.15
+Build-Depends: c-ares, libwebsockets, openssl, pthreads
+Description: Mosquitto is an open source message broker that implements the MQ Telemetry Transport protocol versions 3.1 and
+ 3.1.1. MQTT provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it
+ suitable for "machine to machine" messaging such as with low power sensors or mobile devices such as phones, embedded
+ computers or microcontrollers like the Arduino. you can see more information from this url
+ https://mosquitto.org/download/
diff --git a/ports/mosquitto/cmake-2.patch b/ports/mosquitto/cmake-2.patch
new file mode 100644
index 000000000..bd5121c72
--- /dev/null
+++ b/ports/mosquitto/cmake-2.patch
@@ -0,0 +1,68 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 3a68061..e4197fd 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -24,10 +24,10 @@ endif (WIN32)
+ add_definitions (-DCMAKE -DVERSION=\"${VERSION}\" -DTIMESTAMP=\"${TIMESTAMP}\")
+
+ if (WIN32)
+- set (BINDIR .)
+- set (SBINDIR .)
++ set (BINDIR bin)
++ set (SBINDIR bin)
+ set (SYSCONFDIR .)
+- set (LIBDIR .)
++ set (LIBDIR lib)
+ set (INCLUDEDIR include)
+ set (DATAROOTDIR share)
+ set (MANDIR man)
+@@ -86,10 +86,10 @@ option(WITH_SRV "Include SRV lookup support?" ON)
+ add_subdirectory(lib)
+ add_subdirectory(client)
+ add_subdirectory(src)
+-add_subdirectory(man)
++#add_subdirectory(man)
+
+ # ========================================
+ # Install config file
+ # ========================================
+
+-install(FILES mosquitto.conf aclfile.example pskfile.example pwfile.example DESTINATION "${SYSCONFDIR}")
++#install(FILES mosquitto.conf aclfile.example pskfile.example pwfile.example DESTINATION "${SYSCONFDIR}")
+diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
+index 1260761..aebd580 100644
+--- a/lib/CMakeLists.txt
++++ b/lib/CMakeLists.txt
+@@ -4,8 +4,8 @@ option(WITH_THREADING "Include client library threading support?" ON)
+ if (${WITH_THREADING} STREQUAL ON)
+ add_definitions("-DWITH_THREADING")
+ if (WIN32)
+- set (PTHREAD_LIBRARIES ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/lib/pthreadsVC2.lib)
+- set (PTHREAD_INCLUDE_DIR ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/include)
++ find_library(PTHREAD_LIBRARIES NAMES pthreadsVC2)
++ find_path(PTHREAD_INCLUDE_DIR pthread.h)
+ else (WIN32)
+ find_library(LIBPTHREAD pthread)
+ if (LIBPTHREAD)
+@@ -78,7 +78,7 @@ set_target_properties(libmosquitto PROPERTIES
+ SOVERSION 1
+ )
+
+-install(TARGETS libmosquitto RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}")
++install(TARGETS libmosquitto RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}" ARCHIVE DESTINATION "${LIBDIR}")
+ install(FILES mosquitto.h DESTINATION "${INCLUDEDIR}")
+
+ if (UNIX)
+diff --git a/lib/cpp/CMakeLists.txt b/lib/cpp/CMakeLists.txt
+index b80dc18..e91ec77 100644
+--- a/lib/cpp/CMakeLists.txt
++++ b/lib/cpp/CMakeLists.txt
+@@ -10,7 +10,7 @@ set_target_properties(mosquittopp PROPERTIES
+ VERSION ${VERSION}
+ SOVERSION 1
+ )
+-install(TARGETS mosquittopp RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}")
++install(TARGETS mosquittopp RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}" ARCHIVE DESTINATION "${LIBDIR}")
+ install(FILES mosquittopp.h DESTINATION "${INCLUDEDIR}")
+
+ if (UNIX)
diff --git a/ports/mosquitto/cmake.patch b/ports/mosquitto/cmake.patch
new file mode 100644
index 000000000..e20d3986e
--- /dev/null
+++ b/ports/mosquitto/cmake.patch
@@ -0,0 +1,13 @@
+--- a/lib/CMakeLists.txt
++++ b/lib/CMakeLists.txt
+@@ -4,8 +4,8 @@
+ if (${WITH_THREADING} STREQUAL ON)
+ add_definitions("-DWITH_THREADING")
+ if (WIN32)
+- set (PTHREAD_LIBRARIES C:\\pthreads\\Pre-built.2\\lib\\x86\\pthreadVC2.lib)
+- set (PTHREAD_INCLUDE_DIR C:\\pthreads\\Pre-built.2\\include)
++ set (PTHREAD_LIBRARIES ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/lib/pthreadsVC2.lib)
++ set (PTHREAD_INCLUDE_DIR ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/include)
+ else (WIN32)
+ find_library(LIBPTHREAD pthread)
+ if (LIBPTHREAD)
diff --git a/ports/mosquitto/portfile.cmake b/ports/mosquitto/portfile.cmake
new file mode 100644
index 000000000..a9c70f853
--- /dev/null
+++ b/ports/mosquitto/portfile.cmake
@@ -0,0 +1,56 @@
+include(vcpkg_common_functions)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ message("mosquitto only supports dynamic linkage")
+ set(VCPKG_LIBRARY_LINKAGE dynamic)
+endif()
+
+if(VCPKG_CRT_LINKAGE STREQUAL "static")
+ message(FATAL_ERROR "mosquitto does not support static CRT linkage")
+endif()
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO eclipse/mosquitto
+ REF v1.4.15
+ SHA512 428ef9434d3fe022232dcde415fe8cd948d237507d512871803a116230f9e011c10fa01313111ced0946f906e8cc7e26d9eee5de6caa7f82590753a4d087f6fd
+ HEAD_REF master
+)
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES
+ "${CMAKE_CURRENT_LIST_DIR}/0001-win64-cmake.patch"
+ "${CMAKE_CURRENT_LIST_DIR}/cmake.patch"
+ "${CMAKE_CURRENT_LIST_DIR}/cmake-2.patch"
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DWITH_SRV=OFF
+ -DWITH_WEBSOCKETS=ON
+ -DWITH_TLS=ON
+ -DWITH_TLS_PSK=ON
+ -DWITH_THREADING=ON
+ OPTIONS_RELEASE
+ -DENABLE_DEBUG=OFF
+ OPTIONS_DEBUG
+ -DENABLE_DEBUG=ON
+)
+
+vcpkg_install_cmake()
+
+# Remove debug/include
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+file(GLOB EXE ${CURRENT_PACKAGES_DIR}/bin/*.exe)
+file(GLOB DEBUG_EXE ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe)
+file(REMOVE ${EXE})
+file(REMOVE ${DEBUG_EXE})
+
+file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/mosquitto RENAME copyright)
+
+# Copy pdb
+vcpkg_copy_pdbs()