mosquitto: New package

This commit is contained in:
Konstantin Podsvirov
2021-11-06 09:19:27 +03:00
parent 5999f300ab
commit 63bfa84684
6 changed files with 233 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8c795f6e..c6b631da 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,12 +67,9 @@ option(WITH_THREADING "Include client library threading support?" ON)
if (WITH_THREADING)
add_definitions("-DWITH_THREADING")
if (WIN32)
- if (CMAKE_CL_64)
- set (PTHREAD_LIBRARIES C:\\pthreads\\Pre-built.2\\lib\\x64\\pthreadVC2.lib)
- else (CMAKE_CL_64)
- set (PTHREAD_LIBRARIES C:\\pthreads\\Pre-built.2\\lib\\x86\\pthreadVC2.lib)
- endif (CMAKE_CL_64)
- set (PTHREAD_INCLUDE_DIR C:\\pthreads\\Pre-built.2\\include)
+ find_package(Threads REQUIRED)
+ set (PTHREAD_LIBRARIES Threads::Threads)
+ set (PTHREAD_INCLUDE_DIR "")
elseif (ANDROID)
set (PTHREAD_LIBRARIES "")
set (PTHREAD_INCLUDE_DIR "")

View File

@@ -0,0 +1,16 @@
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 5da221dc..31cc35e3 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -96,7 +96,10 @@ set_target_properties(libmosquitto PROPERTIES
SOVERSION 1
)
-install(TARGETS libmosquitto RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+install(TARGETS libmosquitto
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
if (WITH_STATIC_LIBRARIES)
add_library(libmosquitto_static STATIC ${C_SRC})

View File

@@ -0,0 +1,19 @@
diff --git a/plugins/dynamic-security/CMakeLists.txt b/plugins/dynamic-security/CMakeLists.txt
index 465b99b2..643de1de 100644
--- a/plugins/dynamic-security/CMakeLists.txt
+++ b/plugins/dynamic-security/CMakeLists.txt
@@ -35,7 +35,12 @@ if (CJSON_FOUND AND WITH_TLS)
target_link_libraries(mosquitto_dynamic_security ${CJSON_LIBRARIES} ${OPENSSL_LIBRARIES})
if(WIN32)
target_link_libraries(mosquitto_dynamic_security mosquitto)
- endif(WIN32)
+ install(TARGETS mosquitto_dynamic_security
+ DESTINATION "${CMAKE_INSTALL_BINDIR}")
+ else()
+ install(TARGETS mosquitto_dynamic_security
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+ endif()
- install(TARGETS mosquitto_dynamic_security RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif()

View File

@@ -0,0 +1,87 @@
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
index 2c8b0955..a5b93e35 100644
--- a/man/CMakeLists.txt
+++ b/man/CMakeLists.txt
@@ -4,44 +4,45 @@
# could not be found, then the man pages will not be built or installed -
# because the install is optional.
-if(NOT WIN32)
- find_program(XSLTPROC xsltproc OPTIONAL)
- if(XSLTPROC)
- function(compile_manpage page)
- add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/man/${page}
- COMMAND xsltproc ${CMAKE_SOURCE_DIR}/man/${page}.xml -o ${CMAKE_SOURCE_DIR}/man/
- MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/man/${page}.xml)
- add_custom_target(${page} ALL DEPENDS ${CMAKE_SOURCE_DIR}/man/${page})
- endfunction()
+find_program(XSLTPROC xsltproc OPTIONAL)
+if(XSLTPROC)
+ function(compile_manpage page)
+ add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/man/${page}
+ COMMAND xsltproc ${CMAKE_SOURCE_DIR}/man/${page}.xml -o ${CMAKE_SOURCE_DIR}/man/
+ MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/man/${page}.xml)
+ add_custom_target(${page} ALL DEPENDS ${CMAKE_SOURCE_DIR}/man/${page})
+ endfunction()
- compile_manpage("mosquitto_ctrl.1")
- compile_manpage("mosquitto_ctrl_dynsec.1")
- compile_manpage("mosquitto_passwd.1")
- compile_manpage("mosquitto_pub.1")
- compile_manpage("mosquitto_sub.1")
- compile_manpage("mosquitto_rr.1")
- compile_manpage("libmosquitto.3")
- compile_manpage("mosquitto.conf.5")
- compile_manpage("mosquitto-tls.7")
- compile_manpage("mqtt.7")
- compile_manpage("mosquitto.8")
- else()
- message(FATAL_ERROR "xsltproc not found: manpages cannot be built")
- endif()
+ compile_manpage("mosquitto_ctrl.1")
+ compile_manpage("mosquitto_ctrl_dynsec.1")
+ compile_manpage("mosquitto_passwd.1")
+ compile_manpage("mosquitto_pub.1")
+ compile_manpage("mosquitto_sub.1")
+ compile_manpage("mosquitto_rr.1")
+ compile_manpage("libmosquitto.3")
+ compile_manpage("mosquitto.conf.5")
+ compile_manpage("mosquitto-tls.7")
+ compile_manpage("mqtt.7")
+ compile_manpage("mosquitto.8")
-endif()
+ install(FILES
+ mosquitto_ctrl.1
+ mosquitto_ctrl_dynsec.1
+ mosquitto_passwd.1
+ mosquitto_pub.1
+ mosquitto_sub.1
+ mosquitto_rr.1
+ DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
+ OPTIONAL)
+
+ install(FILES libmosquitto.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 OPTIONAL)
+ install(FILES mosquitto.conf.5 DESTINATION ${CMAKE_INSTALL_MANDIR}/man5 OPTIONAL)
+ install(FILES mosquitto-tls.7 mqtt.7 DESTINATION ${CMAKE_INSTALL_MANDIR}/man7 OPTIONAL)
+ install(FILES mosquitto.8 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8 OPTIONAL)
-install(FILES
- mosquitto_ctrl.1
- mosquitto_ctrl_dynsec.1
- mosquitto_passwd.1
- mosquitto_pub.1
- mosquitto_sub.1
- mosquitto_rr.1
- DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
- OPTIONAL)
+elseif(WIN32)
+ message(WARNING "xsltproc not found: manpages cannot be built")
+else()
+ message(FATAL_ERROR "xsltproc not found: manpages cannot be built")
+endif()
-install(FILES libmosquitto.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 OPTIONAL)
-install(FILES mosquitto.conf.5 DESTINATION ${CMAKE_INSTALL_MANDIR}/man5 OPTIONAL)
-install(FILES mosquitto-tls.7 mqtt.7 DESTINATION ${CMAKE_INSTALL_MANDIR}/man7 OPTIONAL)
-install(FILES mosquitto.8 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8 OPTIONAL)

View File

@@ -0,0 +1,16 @@
diff --git a/lib/cpp/CMakeLists.txt b/lib/cpp/CMakeLists.txt
index 1748b14c..882b662c 100644
--- a/lib/cpp/CMakeLists.txt
+++ b/lib/cpp/CMakeLists.txt
@@ -14,7 +14,10 @@ set_target_properties(mosquittopp PROPERTIES
VERSION ${VERSION}
SOVERSION 1
)
-install(TARGETS mosquittopp RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+install(TARGETS mosquittopp
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
if (WITH_STATIC_LIBRARIES)
add_library(mosquittopp_static STATIC

View File

@@ -0,0 +1,75 @@
# Maintainer: Konstantin Podsvirov <konstantin@podsvirov.pro>
_realname=mosquitto
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.0.13
pkgrel=1
pkgdesc="An Open Source MQTT Broker (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="https://mosquitto.org"
license=('EPL' 'EDL')
depends=("${MINGW_PACKAGE_PREFIX}-c-ares"
"${MINGW_PACKAGE_PREFIX}-cjson"
"${MINGW_PACKAGE_PREFIX}-libwebsockets"
"${MINGW_PACKAGE_PREFIX}-libwinpthread"
"${MINGW_PACKAGE_PREFIX}-openssl")
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
"${MINGW_PACKAGE_PREFIX}-ninja"
"${MINGW_PACKAGE_PREFIX}-winpthreads"
"${MINGW_PACKAGE_PREFIX}-docbook-xsl")
options=('staticlibs' '!strip' '!buildflags')
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/eclipse/mosquitto/archive/v${pkgver}.tar.gz"
'001-mosquitto-2.0.13-win-threads.patch'
'002-mosquitto-2.0.13-install-libmosquitto-archive.patch'
'003-mosquitto-2.0.13-fix-security-module-destination.patch'
'004-mosquitto-2.0.13-make-man.patch'
'005-mosquitto-2.0.13-install-libmosquittopp-archive.patch')
sha256sums=('303a05823b3aaef531c10031d85722959e7365453d6fe80193d63289028e18f4'
'cb7117abf7ea9ec7c5895277cb0de0e04fba7d7a5ff341ae926565bfb95bcc21'
'70df36f050967bec3e784938480fa50a071d2400a321409b9f1d9905e08cc460'
'd722372d407310816b03ca44ad68136026c07a831770b7338a7155abd3492bfa'
'8f2a4e8ba68a225fba339aa2550ba1de697a469dc248497c9592dfa8e6ff3bec'
'70aeb38c93b30182103a86fe831c4d6f9efd0ae5dddb0ff1f47ef1900ee9e8ef')
prepare() {
cd "${srcdir}/${_realname}-${pkgver}"
patch -p1 -i "${srcdir}/001-mosquitto-2.0.13-win-threads.patch"
patch -p1 -i "${srcdir}/002-mosquitto-2.0.13-install-libmosquitto-archive.patch"
patch -p1 -i "${srcdir}/003-mosquitto-2.0.13-fix-security-module-destination.patch"
patch -p1 -i "${srcdir}/004-mosquitto-2.0.13-make-man.patch"
patch -p1 -i "${srcdir}/005-mosquitto-2.0.13-install-libmosquittopp-archive.patch"
}
build() {
[[ -d "${srcdir}/build-${MSYSTEM}" ]] && rm -rf "${srcdir}/build-${MSYSTEM}"
mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
${MINGW_PREFIX}/bin/cmake \
-G"Ninja" \
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_SBINDIR=bin \
-DWITH_STATIC_LIBRARIES=ON \
-DWITH_PIC=ON \
../${_realname}-${pkgver}
cmake --build ./
}
check() {
cd "${srcdir}/build-${MSYSTEM}"
ctest ./ || true
}
package() {
cd "${srcdir}/build-${MSYSTEM}"
DESTDIR=${pkgdir} cmake --install ./
install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE.txt" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}