MFH: r481153 r483677

- Update to 1.5.3

PR:		231047
Submitted by:	Iblis Lin <iblis@hs.ntnu.edu.tw>
Approved by:	joe@thrallingpenguin.com (maintainer)

net/mosquitto: Fix OpenSSL build

PR:		232168
Submitted by:	Nathan <ndowens@yahoo.com>
Approved by:	joe@thrallingpenguin.com (maintainer)
This commit is contained in:
Antoine Brodin 2018-11-09 22:52:39 +00:00
parent 7b448d4687
commit 2ec180ffa5
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/branches/2018Q4/; revision=484553
14 changed files with 129 additions and 106 deletions

View File

@ -2,8 +2,8 @@
# $FreeBSD$
PORTNAME= mosquitto
PORTVERSION= 1.4.14
PORTREVISION= 2
PORTVERSION= 1.5.3
PORTREVISION= 1
CATEGORIES= net
MASTER_SITES= http://mosquitto.org/files/source/
@ -26,6 +26,8 @@ USERS= nobody
OPTIONS_DEFINE= WS
CMAKE_ARGS+= -DCMAKE_LIBDATADIR="${PREFIX}/libdata"
WS_DESC= MQTT over Websockets support
WS_LIB_DEPENDS= libwebsockets.so:net/libwebsockets
WS_CMAKE_ON= -DWITH_WEBSOCKETS=ON

View File

@ -1,3 +1,3 @@
TIMESTAMP = 1512592902
SHA256 (mosquitto-1.4.14.tar.gz) = 156b1fa731d12baad4b8b22f7b6a8af50ba881fc711b81e9919ec103cf2942d1
SIZE (mosquitto-1.4.14.tar.gz) = 365596
TIMESTAMP = 1538306679
SHA256 (mosquitto-1.5.3.tar.gz) = 3081a998d303a883b1cd064009beabc88aa9159e26f5258a4ae6007160491d10
SIZE (mosquitto-1.5.3.tar.gz) = 425844

View File

@ -27,7 +27,7 @@ mosquitto_config=${mosquitto_config:="%%PREFIX%%/etc/mosquitto/mosquitto.conf"}
command=%%PREFIX%%/sbin/mosquitto
command_args="-c ${mosquitto_config} -d"
pidfile=$(grep pid_file ${mosquitto_config} | awk '{print($2)}')
pidfile=$(grep pidfile ${mosquitto_config} | awk '{print($2)}')
required_files=${mosquitto_config}
extra_commands="reload"

View File

@ -1,21 +1,24 @@
--- CMakeLists.txt.orig 2017-07-10 22:46:01 UTC
--- CMakeLists.txt.orig 2018-09-25 15:27:43 UTC
+++ CMakeLists.txt
@@ -13,6 +13,9 @@ cmake_minimum_required(VERSION 2.8)
@@ -15,6 +15,9 @@ set (VERSION 1.5.3)
set (VERSION 1.4.14)
add_definitions (-DCMAKE -DVERSION=\"${VERSION}\")
+include_directories(%%PREFIX%%/include)
+link_directories(%%PREFIX%%/lib)
+include_directories(/usr/local/include)
+link_directories(/usr/local/lib)
+
if (WIN32)
execute_process(COMMAND cmd /c echo %DATE% %TIME% OUTPUT_VARIABLE TIMESTAMP
OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -47,7 +50,7 @@ else (WIN32)
set (BINDIR .)
set (SBINDIR .)
@@ -40,9 +43,9 @@ else (WIN32)
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIBDIR}")
set (INCLUDEDIR include)
set (DATAROOTDIR share)
- set (MANDIR "${DATAROOTDIR}/man")
+ set (MANDIR "man")
set (SHAREDIR "${DATAROOTDIR}/mosquitto")
- set (PKGCONFIGDIR "${LIBDIR}/pkgconfig")
+ set (PKGCONFIGDIR "${CMAKE_LIBDATADIR}/pkgconfig")
endif (WIN32)
option(WITH_TLS

View File

@ -1,13 +1,11 @@
--- config.mk.orig 2017-07-10 22:46:01 UTC
--- config.mk.orig 2018-09-25 15:27:43 UTC
+++ config.mk
@@ -249,7 +249,7 @@ ifeq ($(WITH_DOCS),yes)
@@ -275,7 +275,7 @@ ifeq ($(WITH_WEBSOCKETS),static)
endif
INSTALL?=install
-prefix=/usr/local
-mandir=${prefix}/share/man
-localedir=${prefix}/share/locale
+prefix=${PREFIX}
+mandir=${PREFIX}/share/man
+localedir=${PREFIX}/share/locale
STRIP?=strip
-prefix?=/usr/local
+prefix?=${PREFIX}
incdir?=${prefix}/include
libdir?=${prefix}/lib${LIB_SUFFIX}
localedir?=${prefix}/share/locale

View File

@ -1,25 +1,33 @@
From 9f74e09373f3be7b77f510ef8b0ae2c887f7b325 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 4 Oct 2016 14:35:33 +0200
Subject: [PATCH] [280] Fix build with libressl
Closes #280
Fix building with libressl which broke in commit fff741613 (Support for
openssl 1.1.0).
Bug: #280
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
--- lib/mosquitto_internal.h.orig 2017-07-10 22:46:01 UTC
--- lib/mosquitto_internal.h.orig 2018-09-25 15:27:43 UTC
+++ lib/mosquitto_internal.h
@@ -25,6 +25,9 @@ Contributors:
#ifdef WITH_TLS
# include <openssl/ssl.h>
+# if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
+# define HAVE_OPENSSL_OPAQUE_STRUCTS
+# endif
#else
# include <time.h>
@@ -31,11 +31,7 @@ Contributors:
#endif
#include <stdlib.h>
-#if defined(WITH_THREADING) && !defined(WITH_BROKER)
-# include <pthread.h>
-#else
-# include <dummypthread.h>
-#endif
+#include <pthread.h>
#ifdef WITH_SRV
# include <ares.h>
@@ -194,7 +190,7 @@ struct mosquitto {
#endif
bool want_write;
bool want_connect;
-#if defined(WITH_THREADING) && !defined(WITH_BROKER)
+
pthread_mutex_t callback_mutex;
pthread_mutex_t log_callback_mutex;
pthread_mutex_t msgtime_mutex;
@@ -205,7 +201,7 @@ struct mosquitto {
pthread_mutex_t out_message_mutex;
pthread_mutex_t mid_mutex;
pthread_t thread_id;
-#endif
+
bool clean_session;
#ifdef WITH_BROKER
char *old_id; /* for when a duplicate client connects, but we still want to

View File

@ -0,0 +1,13 @@
--- lib/socks_mosq.c.orig 2018-09-30 11:40:37 UTC
+++ lib/socks_mosq.c
@@ -24,6 +24,10 @@ Contributors:
#else
# include <arpa/inet.h>
#endif
+#ifdef __FreeBSD__
+# include <sys/socket.h>
+# include <netinet/in.h>
+#endif
#include "mosquitto_internal.h"
#include "memory_mosq.h"

View File

@ -1,13 +0,0 @@
--- lib/tls_mosq.h.orig 2017-07-10 22:46:01 UTC
+++ lib/tls_mosq.h
@@ -26,8 +26,9 @@ Contributors:
#ifdef WITH_TLS
#include <openssl/ssl.h>
+#include <sys/socket.h>
#ifdef WITH_TLS_PSK
-# if OPENSSL_VERSION_NUMBER >= 0x10000000
+# if OPENSSL_VERSION_NUMBER >= 0x10000000 && !defined(OPENSSL_NO_PSK)
# define REAL_WITH_TLS_PSK
# else
# warning "TLS-PSK not supported, openssl too old."

View File

@ -1,6 +1,6 @@
--- mosquitto.conf.orig 2015-05-07 13:21:22 UTC
--- mosquitto.conf.orig 2018-08-16 16:05:26 UTC
+++ mosquitto.conf
@@ -32,7 +32,7 @@
@@ -28,7 +28,7 @@
# This should be set to /var/run/mosquitto.pid if mosquitto is
# being run automatically on boot with an init script and
# start-stop-daemon or similar.
@ -9,7 +9,7 @@
# When run as root, drop privileges to this user and its primary
# group.
@@ -40,7 +40,7 @@
@@ -36,7 +36,7 @@
# If run as a non-root user, this setting has no effect.
# Note that on Windows this has no effect and so mosquitto should
# be started by the user you wish it to run as.
@ -18,7 +18,7 @@
# The maximum number of QoS 1 and 2 messages currently inflight per
# client.
@@ -133,7 +133,7 @@
@@ -160,7 +160,7 @@
#bind_address
# Port to use for the default listener.

View File

@ -1,14 +1,14 @@
--- src/CMakeLists.txt.orig 2017-07-10 22:46:01 UTC
--- src/CMakeLists.txt.orig 2018-09-25 15:27:43 UTC
+++ src/CMakeLists.txt
@@ -77,6 +77,7 @@ if (WIN32 OR CYGWIN)
@@ -114,6 +114,7 @@ if (WIN32 OR CYGWIN)
endif (WIN32 OR CYGWIN)
add_definitions (-DWITH_BROKER)
+add_definitions (-DWITH_THREADING)
add_executable(mosquitto ${MOSQ_SRCS})
set (MOSQ_LIBS ${MOSQ_LIBS} ${OPENSSL_LIBRARIES})
@@ -96,7 +97,7 @@ if (UNIX)
@@ -131,7 +132,7 @@ if (UNIX)
if (APPLE)
set (MOSQ_LIBS ${MOSQ_LIBS} dl m)
else (APPLE)
@ -17,10 +17,11 @@
find_library(LIBRT rt)
if (LIBRT)
set (MOSQ_LIBS ${MOSQ_LIBS} rt)
@@ -141,6 +142,5 @@ if (${WITH_TLS} STREQUAL ON)
@@ -185,7 +186,6 @@ if (${WITH_TLS} STREQUAL ON)
endif (${WITH_TLS} STREQUAL ON)
if (UNIX)
if (UNIX AND NOT APPLE)
- install(CODE "EXEC_PROGRAM(/sbin/ldconfig)")
endif (UNIX)
endif (UNIX AND NOT APPLE)

View File

@ -0,0 +1,33 @@
lib/mosquitto_internal.h | 3 +++
src/mosquitto_passwd.c | 4 ++--
src/security_default.c | 2 +-
3 files changed, 6 insertions(+), 3 deletions(-)
--- src/mosquitto_passwd.c.orig 2018-10-11 00:27:05 UTC
+++ src/mosquitto_passwd.c
@@ -17,6 +17,7 @@ Contributors:
#include "config.h"
#include <errno.h>
+#include <openssl/opensslv.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
#include <openssl/buffer.h>
@@ -99,7 +100,7 @@ int output_new_password(FILE *fptr, const char *userna
unsigned char hash[EVP_MAX_MD_SIZE];
unsigned int hash_len;
const EVP_MD *digest;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#ifdef HAVE_OPENSSL_OPAQUE_STRUCTS
EVP_MD_CTX context;
#else
EVP_MD_CTX *context;
@@ -126,7 +127,7 @@ int output_new_password(FILE *fptr, const char *userna
return 1;
}
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
EVP_MD_CTX_init(&context);
EVP_DigestInit_ex(&context, digest, NULL);
EVP_DigestUpdate(&context, password, strlen(password));

View File

@ -0,0 +1,11 @@
--- src/security_default.c.orig 2018-10-11 00:28:56 UTC
+++ src/security_default.c
@@ -18,7 +18,7 @@ Contributors:
#include <stdio.h>
#include <string.h>
-
+#include <openssl/opensslv.h>
#include "mosquitto_broker_internal.h"
#include "memory_mosq.h"
#include "util_mosq.h"

View File

@ -1,36 +0,0 @@
lib/mosquitto_internal.h | 3 +++
src/mosquitto_passwd.c | 4 ++--
src/security_default.c | 2 +-
3 files changed, 6 insertions(+), 3 deletions(-)
--- src/mosquitto_passwd.c.orig 2017-07-10 22:46:01 UTC
+++ src/mosquitto_passwd.c
@@ -90,7 +90,7 @@ int output_new_password(FILE *fptr, const char *userna
unsigned char hash[EVP_MAX_MD_SIZE];
unsigned int hash_len;
const EVP_MD *digest;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#ifndef HAVE_OPENSSL_OPAQUE_STRUCTS
EVP_MD_CTX context;
#else
EVP_MD_CTX *context;
@@ -117,7 +117,7 @@ int output_new_password(FILE *fptr, const char *userna
return 1;
}
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#ifndef HAVE_OPENSSL_OPAQUE_STRUCTS
EVP_MD_CTX_init(&context);
EVP_DigestInit_ex(&context, digest, NULL);
EVP_DigestUpdate(&context, password, strlen(password));
--- src/security_default.c.orig 2017-07-10 22:46:01 UTC
+++ src/security_default.c
@@ -790,7 +790,7 @@ int mosquitto_psk_key_get_default(struct mosquitto_db
int _pw_digest(const char *password, const unsigned char *salt, unsigned int salt_len, unsigned char *hash, unsigned int *hash_len)
{
const EVP_MD *digest;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#ifndef HAVE_OPENSSL_OPAQUE_STRUCTS
EVP_MD_CTX context;
digest = EVP_get_digestbyname("sha512");

View File

@ -6,6 +6,7 @@ bin/mosquitto_sub
@sample %%ETCDIR%%/pskfile.sample
@sample %%ETCDIR%%/pwfile.sample
include/mosquitto.h
include/mosquitto_broker.h
include/mosquitto_plugin.h
include/mosquittopp.h
lib/libmosquitto.so
@ -14,6 +15,8 @@ lib/libmosquitto.so.%%PORTVERSION%%
lib/libmosquittopp.so
lib/libmosquittopp.so.1
lib/libmosquittopp.so.%%PORTVERSION%%
libdata/pkgconfig/libmosquitto.pc
libdata/pkgconfig/libmosquittopp.pc
man/man1/mosquitto_passwd.1.gz
man/man1/mosquitto_pub.1.gz
man/man1/mosquitto_sub.1.gz