Hello,

This is my first port. I'm looking for mentorship, testing, and feedback
to eventually get this committed. I've read the porting guide,
bsd.port.mk(5), rc.subr(8), and login.conf(5) when making this port.

This is a port for open Home Automation Bus https://www.openhab.org/.
From the project github and DESCR:

The open Home Automation Bus (openHAB) project aims at providing a
universal integration platform for all things around home automation.
It is a pure Java solution, fully based on OSGi.

It is designed to be vendor-neutral as well as hardware/protocol-agnostic.
openHAB brings together different bus systems, hardware devices,
and interface protocols by dedicated bindings. These bindings send
and receive commands and status updates on the openHAB event bus.
This concept allows designing user interfaces with a unique look&feel,
but with the possibility to operate devices based on a big number
of different technologies. Besides the user interfaces, it also
brings the power of automation logic across different system

I had a few challenges when making this port.

Firstly, there is no archive root when extracting the distfile. Initially
I had set ${WRKDIST}=${WRKDIR} and had do-install copy everything from
${WRKDIST}. This turned out to be a problem with 'make fake' since it was
recursively trying to copy fake-amd64. I eventually opted to override
EXTRACT_CASES for tar.gz to create a subdir and extract there. I was hoping
for a variable that might let me set a directory instead, but I imagine most
distfiles extract with an archive root.

Secondly, I considered using the javaPathHelper within the rc file, but
ultimately opted to use the scripts that come with Apache Karaf. The
start.sh packaged with openHAB just calls these under the hood. They do
a lot of bootstrapping for the environment, so calling java directly
would cause a number of issues. Unfortunately, these scripts rely on
the JAVA_HOME environment variable to be set. I packaged a openhab.login
so I could set this variable via setenv. I was hoping the packaging process
would allow me to substitute build variables similar to the rc file. This way
I could do something like:

:setenv=JAVA_HOME="$(${LOCALBASE}/bin/javaPathHelper -h openhab"

I quickly realized it wasn't doing it when $ was substituted for the user
per login.conf(5) and copied verbatim. This left me no choice but to
hard-code the path (perhaps logic could be added for this case?)

Lastly, it's possible to patch this to break out configuration to /etc,
logging to /var/log, as well as the data, cache, state, etc -- however,
most Karaf-based applications don't typically change these, and most other
Java-related ports I've looked at didn't either. This was mostly done
for myself as I'm an experienced Java developer looking to contribute to
openHAB (and use it!), however, I'm happy to make any changes to how it's
installed based on feedback.

Thank you!

--
Chaz

Index: user.list
===================================================================
RCS file: /cvs/ports/infrastructure/db/user.list,v
retrieving revision 1.436
diff -u -p -r1.436 user.list
--- user.list   5 Jan 2024 14:40:32 -0000       1.436
+++ user.list   7 Jan 2024 04:58:41 -0000
@@ -404,3 +404,4 @@ id  user            group           port
 893 _azorius           _azorius        www/azorius
 894 _gonic             _gonic          audio/gonic
 895 _soju              _soju           net/soju
+896 _openhab           _openhab        misc/openhab

Attachment: openhab-4.1.0.tar.gz
Description: application/gzip

Reply via email to