On 2020/01/04 19:10, Jan-Piet Mens wrote:
> Hello!
> 
> This is a new port for msoak(1), a utility with which to simultaneously
> subscribe to an arbitrary number of topics on any number of MQTT brokers and
> optionally modify or normalize received payloads with Lua functions before
> printing them out.
> 
> I am the author of said utility, too.
> 
> Tested on 6.6-CURRENT
> 
> I'm hoping somebody can test this and give me feedback on my first package
> for OpenBSD!
> 
> Under the assumption that MQTT is not in everybody's repertoire (why not
> actually, it's great! :-), I have a short writeup about it at [1].
> 
> Thank you and best regards,
> 
>       -JP
> 
> [1] 
> https://jpmens.net/2013/02/25/lots-of-messages-mqtt-pub-sub-and-the-mosquitto-broker/

Works for me, and a good first submission :) I've attached a tweaked
version, and will add commentary inline on a diff from your version:

: diff 986cac26887f6f0aacfba950d103b81aa829a56f /usr/ports/mystuff
: blob - 2c4b80e099a70cfb148c14beb35a29f0b7c13064
: file + net/msoak/Makefile
: --- net/msoak/Makefile
: +++ net/msoak/Makefile
: @@ -1,38 +1,37 @@
:  # $OpenBSD$
:  
:  COMMENT =    subscribe to multiple MQTT brokers and topics simultaneously
: -V =          0.5
: -DISTNAME =   msoak-${V}
: +
: +GH_ACCOUNT = jpmens
: +GH_PROJECT = msoak
: +GH_TAGNAME = 0.5
: +
:  CATEGORIES = net
:  
: -HOMEPAGE =   https://github.com/jpmens/msoak

Use standard location for GH_* variables in Makefile, no need to set
DISTNAME/HOMEPAGE which are set by default when GH_* are set

:  MAINTAINER = Jan-Piet Mens <po...@jpmens.net>
:  
: -# License GPLv2+
: +# GPLv2+
:  PERMIT_PACKAGE=      Yes
:  
: -GH_ACCOUNT = jpmens
: -GH_PROJECT = msoak
: -GH_TAGNAME = ${V}
: +WANTLIB +=   ${MODLUA_WANTLIB} c config mosquitto

Standard location for WANTLIB, use lua lib name coming from MODULES=lang/lua

:  
: -BUILD_DEPENDS =      devel/libconfig \
: -             net/mosquitto \
: -             devel/lua-compat53
: +MODULES =    lang/lua
: +MODLUA_SA =  Yes
: +NO_TEST =    Yes

use MODULES=lang/lua to provide standard variables for lua ports,
set MODLUA_SA because it's a standalone port rather than lua library
(the module has some setup for multiple flavours for multiple lua
versions). set NO_TEST.

: -RUN_DEPENDS =        devel/libconfig \
: -             net/mosquitto \
: -             devel/lua-compat53
: +LIB_DEPENDS =        devel/libconfig \
: +             net/mosquitto

library dependencies should use LIB_DEPENDS (+WANTLIB) rather
than BUILD+RUN_DEPENDS.

:  
: -WANTLIB +=   c config lua5.1 mosquitto
: +BUILD_DEPENDS =      devel/lua-compat53
: +RUN_DEPENDS =        devel/lua-compat53

I've left this in for now, but I don't see where lua-compat53 is used,
and it seems to work OK without, if it's not really needed then let's
skip the dependency.

:  
: -CFLAGS =     -I/usr/local/include -I/usr/local/include/lua-5.1/
: -LDFLAGS =    -L /usr/local/lib -llua5.1 -lmosquitto -lconfig
: +CFLAGS +=    -I${LOCALBASE}/include -I${MODLUA_INCL_DIR}
: +LDFLAGS =    -L${LOCALBASE}/lib ${MODLUA_LIB} -lmosquitto -lconfig

change = to += for CFLAGS - don't override standard flags,
avoid hardcoding paths that are normally set by ports infrastructure.

:  
: -
:  MAKE_FLAGS=  CFLAGS="${CFLAGS}"
:  MAKE_FLAGS+= LDFLAGS="${LDFLAGS}"
: -MAKE_FLAGS+= BINDIR=/usr/local/bin
: -MAKE_FLAGS+= MANDIR=/usr/local/man
: +MAKE_FLAGS+= BINDIR=${TRUEPREFIX}/bin
: +MAKE_FLAGS+= MANDIR=${TRUEPREFIX}/man

(LOCALBASE is "from some other port", TRUEPREFIX is "this port")

:  
:  post-install:
:       ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/msoak

I see the Makefile in msoak distribution normally uses lua 5.3,
if you want to do that in the port too then you can just add

MODLUA_VERSION =        5.3

- with the change I made to use the lua "MODULES" (the actual file
is found in lang/lua/lua.port.mk) then setting this will change the
paths/libs/dependencies automatically.

Attachment: msoak,2.tgz
Description: application/tar-gz

Reply via email to