[mosquitto] Add support for static build

This commit is contained in:
NancyLi1013 2020-03-31 19:39:03 -07:00
parent b79f7675aa
commit fed53f5771
3 changed files with 43 additions and 9 deletions

View File

@ -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.

View File

@ -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)

View File

@ -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)