diff --git a/ports/mosquitto/CONTROL b/ports/mosquitto/CONTROL index 3b06305c5..6955ef15d 100644 --- a/ports/mosquitto/CONTROL +++ b/ports/mosquitto/CONTROL @@ -1,5 +1,5 @@ Source: mosquitto -Version: 1.6.8 +Version: 1.6.8-1 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. diff --git a/ports/mosquitto/portfile.cmake b/ports/mosquitto/portfile.cmake index 2a5d7274e..2c04a7bb0 100644 --- a/ports/mosquitto/portfile.cmake +++ b/ports/mosquitto/portfile.cmake @@ -1,5 +1,3 @@ -vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT) # This is a lie. mosquitto can be build staticlly it just must be implemented by vcpkg - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO eclipse/mosquitto @@ -10,6 +8,7 @@ vcpkg_from_github( archive-dest.patch win64-cmake.patch libwebsockets.patch + support-static-build.patch ) vcpkg_configure_cmake( @@ -43,11 +42,8 @@ file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/mosquitto_rr${VCPKG_TARGET_EXECUTABLE_SU file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/mosquitto_sub${VCPKG_TARGET_EXECUTABLE_SUFFIX}) file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/mosquitto_sub${VCPKG_TARGET_EXECUTABLE_SUFFIX}) -#if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin") - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) - endif() -#endif() +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file diff --git a/ports/mosquitto/support-static-build.patch b/ports/mosquitto/support-static-build.patch new file mode 100644 index 000000000..28d7d779a --- /dev/null +++ b/ports/mosquitto/support-static-build.patch @@ -0,0 +1,38 @@ +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index bd60b75..cc01a2a 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -60,7 +60,7 @@ if (UNIX AND NOT APPLE) + endif (UNIX AND NOT APPLE) + + if (WIN32) +- set (LIBRARIES ${LIBRARIES} ws2_32) ++ set (LIBRARIES ${LIBRARIES} ws2_32 crypt32) + endif (WIN32) + + if (WITH_SRV) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 7898ff5..23b3fe8 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -158,7 +158,7 @@ if (UNIX) + endif (UNIX) + + if (WIN32) +- set (MOSQ_LIBS ${MOSQ_LIBS} ws2_32) ++ set (MOSQ_LIBS ${MOSQ_LIBS} ws2_32 crypt32) + endif (WIN32) + + if (WITH_WEBSOCKETS) +@@ -189,6 +189,10 @@ install(FILES mosquitto_broker.h mosquitto_plugin.h DESTINATION "${CMAKE_INSTALL + + if (WITH_TLS) + add_executable(mosquitto_passwd mosquitto_passwd.c) +- target_link_libraries(mosquitto_passwd ${OPENSSL_LIBRARIES}) ++ if(WIN32) ++ target_link_libraries(mosquitto_passwd ${OPENSSL_LIBRARIES} ws2_32 crypt32) ++ else() ++ target_link_libraries(mosquitto_passwd ${OPENSSL_LIBRARIES}) ++ endif() + install(TARGETS mosquitto_passwd RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + endif (WITH_TLS)