mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-23 11:07:10 +01:00
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.
This commit is contained in:
parent
8d0764cca8
commit
a8ae8773c5
40
ports/mosquitto/0001-win64-cmake.patch
Normal file
40
ports/mosquitto/0001-win64-cmake.patch
Normal file
@ -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>
|
||||
|
8
ports/mosquitto/CONTROL
Normal file
8
ports/mosquitto/CONTROL
Normal file
@ -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/
|
68
ports/mosquitto/cmake-2.patch
Normal file
68
ports/mosquitto/cmake-2.patch
Normal file
@ -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)
|
13
ports/mosquitto/cmake.patch
Normal file
13
ports/mosquitto/cmake.patch
Normal file
@ -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)
|
56
ports/mosquitto/portfile.cmake
Normal file
56
ports/mosquitto/portfile.cmake
Normal file
@ -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()
|
Loading…
x
Reference in New Issue
Block a user