Skip to content

Commit

Permalink
mosquitto: Various SunOS fixes and improvements.
Browse files Browse the repository at this point in the history
Includes SMF support.  Submitted by Jorge Schrauwen in #59.
While here fix a hardcoded /var.
  • Loading branch information
jperkin committed Apr 16, 2020
1 parent f352590 commit 0553638
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 10 deletions.
6 changes: 4 additions & 2 deletions net/mosquitto/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.9 2020/02/29 18:29:01 gdt Exp $
# $NetBSD: Makefile,v 1.10 2020/04/16 15:19:11 jperkin Exp $

VERSION= 1.6.9
DISTNAME= mosquitto-${VERSION}
Expand All @@ -18,6 +18,7 @@ USE_LANGUAGES+= c c++
USE_CMAKE= yes
USE_TOOLS+= gmake

LDFLAGS.SunOS+= -lsocket -lnsl
CMAKE_ARGS+= -DCMAKE_INSTALL_SYSCONFDIR=${PREFIX}/share/examples

MOSQUITTO_USER= mosquitto
Expand All @@ -35,9 +36,10 @@ SUBST_CLASSES+= paths
SUBST_STAGE.paths= post-configure
SUBST_MESSAGE.paths= Substituting paths
SUBST_FILES.paths= mosquitto.conf
SUBST_VARS.paths= SSLCERTS
SUBST_VARS.paths= SSLCERTS VARBASE

RCD_SCRIPTS= mosquitto
SMF_METHODS= mosquitto
FILES_SUBST+= MOSQUITTO_USER=${MOSQUITTO_USER}
FILES_SUBST+= MOSQUITTO_GROUP=${MOSQUITTO_GROUP}
FILES_SUBST+= PKG_SYSCONFDIR=${PKG_SYSCONFDIR}
Expand Down
6 changes: 3 additions & 3 deletions net/mosquitto/distinfo
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
$NetBSD: distinfo,v 1.7 2020/02/29 18:29:01 gdt Exp $
$NetBSD: distinfo,v 1.8 2020/04/16 15:19:11 jperkin Exp $

SHA1 (mosquitto-1.6.9.tar.gz) = 424686c7cc3e0a9eced4875bef23ed666537d890
RMD160 (mosquitto-1.6.9.tar.gz) = f10560110d223861d35c7d22f620282028a8241e
SHA512 (mosquitto-1.6.9.tar.gz) = f78228a1e8305e4d89b34250981ed2c5fe5317636003636dc90f6fa2b1e3ca3c8fadb705ee7301f5252456cb093a6547bd46a255ca3d9fb5cdced697738d6eb7
Size (mosquitto-1.6.9.tar.gz) = 610934 bytes
SHA1 (patch-lib_CMakeLists.txt) = cddb8803a759820c8059028f924b56c22689ee54
SHA1 (patch-lib_net__mosq.c) = a38294cdfea98f2da0879ea93373c5f04aebdb20
SHA1 (patch-mosquitto.conf) = 0ea671cfe3a332e9f0027b2410b212797fc1db17
SHA1 (patch-src_CMakeLists.txt) = 2346ee3f13ab7f7e2c34492a4271e0b1adcae4fb
SHA1 (patch-mosquitto.conf) = ca82a8a1bdc59d5e6f4121d8474693245b923789
SHA1 (patch-src_CMakeLists.txt) = 66571704d96c672b8c1537794cf492e9cfce2e0c
33 changes: 33 additions & 0 deletions net/mosquitto/files/smf/manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='@SMF_NAME@'>
<service name='@SMF_PREFIX@/@SMF_NAME@' type='service' version='1'>
<create_default_instance enabled='false' />
<single_instance />

<!-- dependencies -->
<dependency name='fs-root' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/root' />
</dependency>
<dependency name='network-service' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/network/service'/>
</dependency>
<dependency name='config-file' grouping='require_all' restart_on='none' type='path'>
<service_fmri value='file://localhost/@PKG_SYSCONFDIR@/mosquitto.conf' />
</dependency>

<method_context></method_context>
<exec_method type='method' name='start' exec='@PREFIX@/@SMF_METHOD_FILE.mosquitto@ -d -c @PKG_SYSCONFDIR@/mosquitto.conf' timeout_seconds='60' />
<exec_method type='method' name='stop' exec=':kill' timeout_seconds='30' />

<template>
<common_name>
<loctext xml:lang='C'>Mosquitto MQTT Broker</loctext>
</common_name>
<documentation>
<doc_link name='Mosquitto' uri='https://mosquitto.org/'/>
<manpage title='mosquitto' section='8M' manpath='man' />
</documentation>
</template>
</service>
</service_bundle>
14 changes: 14 additions & 0 deletions net/mosquitto/files/smf/mosquitto.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!@SMF_METHOD_SHELL@
#
# $NetBSD: mosquitto.sh,v 1.1 2020/04/16 15:19:11 jperkin Exp $
#

. /lib/svc/share/smf_include.sh

if [ ! -d @VARBASE@/run/mosquitto ]; then
@MKDIR@ @VARBASE@/run/mosquitto
@CHMOD@ 0750 @VARBASE@/run/mosquitto
@CHOWN@ @MOSQUITTO_USER@:@MOSQUITTO_GROUP@ @VARBASE@/run/mosquitto
fi

@PREFIX@/sbin/mosquitto "$@"
4 changes: 2 additions & 2 deletions net/mosquitto/patches/patch-mosquitto.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$NetBSD: patch-mosquitto.conf,v 1.1 2019/07/20 23:09:27 gdt Exp $
$NetBSD: patch-mosquitto.conf,v 1.2 2020/04/16 15:19:11 jperkin Exp $

Log to syslog, instead of (perhaps) not logging.

Expand All @@ -16,7 +16,7 @@ that seems like it should perhaps be command-line, not config.
+
+### PKGSRC ADJUSTMENTS FOR TRADITIONAL UNIX NORMS
+
+pid_file /var/run/mosquitto/mosquitto.pid
+pid_file @VARBASE@/run/mosquitto/mosquitto.pid
+
+log_dest syslog
+
Expand Down
18 changes: 15 additions & 3 deletions net/mosquitto/patches/patch-src_CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
$NetBSD: patch-src_CMakeLists.txt,v 1.1 2019/07/20 23:09:27 gdt Exp $
$NetBSD: patch-src_CMakeLists.txt,v 1.2 2020/04/16 15:19:11 jperkin Exp $

On NetBSD, don't use -ldl (why?).

Sent upstream via email 20190427.

--- src/CMakeLists.txt.orig 2019-04-17 19:54:00.000000000 +0000
--- src/CMakeLists.txt.orig 2020-02-27 23:49:51.000000000 +0000
+++ src/CMakeLists.txt
@@ -146,6 +146,8 @@ endif (HAVE_GETADDRINFO_A)
@@ -151,6 +151,8 @@ endif (HAVE_GETADDRINFO_A AND WITH_ADNS)
if (UNIX)
if (APPLE)
set (MOSQ_LIBS ${MOSQ_LIBS} dl m)
Expand All @@ -15,3 +15,15 @@ Sent upstream via email 20190427.
elseif(QNX)
set(MOSQ_LIBS ${MOSQ_LIBS} m socket)
else(APPLE)
@@ -184,9 +186,9 @@ target_link_libraries(mosquitto ${MOSQ_L
if (UNIX)
if (APPLE)
set_target_properties(mosquitto PROPERTIES LINK_FLAGS "-Wl,-exported_symbols_list -Wl,${mosquitto_SOURCE_DIR}/src/linker-macosx.syms")
- else (APPLE)
+ elseif (NOT CMAKE_SYSTEM_NAME STREQUAL SunOS)
set_target_properties(mosquitto PROPERTIES LINK_FLAGS "-Wl,-dynamic-list=${mosquitto_SOURCE_DIR}/src/linker.syms")
- endif (APPLE)
+ endif ()
endif (UNIX)

install(TARGETS mosquitto RUNTIME DESTINATION "${CMAKE_INSTALL_SBINDIR}")

0 comments on commit 0553638

Please sign in to comment.