git: 5e7e4db9620d - main - misc/spacenavd-devel: Daemon for Spacenav driver

From: Michael Reifenberger <mr_at_FreeBSD.org>
Date: Wed, 23 Jul 2025 09:34:14 UTC
The branch main has been updated by mr:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5e7e4db9620d7c74a077b2cad029936257c5ac1e

commit 5e7e4db9620d7c74a077b2cad029936257c5ac1e
Author:     Michael Reifenberger <mr@FreeBSD.org>
AuthorDate: 2025-07-23 09:21:05 +0000
Commit:     Michael Reifenberger <mr@FreeBSD.org>
CommitDate: 2025-07-23 09:33:31 +0000

    misc/spacenavd-devel: Daemon for Spacenav driver
    
    Spacenavd is a free software user-space driver (daemon), for 6-dof
    input devices, like 3Dconnexion's space-mice. It's compatible with
    the original 3dxsrv proprietary daemon provided by 3Dconnexion,
    and works as a drop-in replacement with any program that was written
    for the 3Dconnexion driver, but also provides an improved
    communication mechanism for programs designed specifically to work
    with spacenavd.
    
    This gets used with a DIY Spacemouse and FreeCAD/OpenSCAD.
    
    There is a pending PR for misc/spacenavd but currently the owner of it
    is not responding so this is a adopted devel version
    
    PR:             283066
---
 misc/spacenavd-devel/Makefile            | 32 ++++++++++++++++++++++++++++++++
 misc/spacenavd-devel/Makefile.git_rev    |  2 ++
 misc/spacenavd-devel/distinfo            |  3 +++
 misc/spacenavd-devel/files/newVersion.sh | 22 ++++++++++++++++++++++
 misc/spacenavd-devel/files/spacenavd.in  | 32 ++++++++++++++++++++++++++++++++
 misc/spacenavd-devel/pkg-descr           |  7 +++++++
 misc/spacenavd-devel/pkg-plist           |  4 ++++
 7 files changed, 102 insertions(+)

diff --git a/misc/spacenavd-devel/Makefile b/misc/spacenavd-devel/Makefile
new file mode 100644
index 000000000000..5c94731e40b1
--- /dev/null
+++ b/misc/spacenavd-devel/Makefile
@@ -0,0 +1,32 @@
+PORTNAME=	spacenavd
+DISTVERSION=	r${GIT_SRC_DATE}
+CATEGORIES=	misc x11-drivers
+PKGNAMESUFFIX=	-devel
+
+MAINTAINER=	mr@freebsd.org
+COMMENT=	Daemon for Spacenav driver
+WWW=	http://spacenav.sourceforge.net/index.html
+
+LICENSE=	GPLv3+
+
+USES=		gmake xorg
+USE_GITHUB=	yes
+GH_ACCOUNT=	FreeSpacenav
+GH_PROJECT=	spacenavd
+GH_TAGNAME=	${GIT_SRC_HASH}
+USE_RC_SUBR=	spacenavd
+USE_XORG=	x11 xext xi xtst
+GNU_CONFIGURE=	yes
+ALL_TARGET=	${PORTNAME}
+
+.include	"Makefile.git_rev"
+
+post-configure:
+		@${REINPLACE_CMD} -e 's|/etc|${LOCALBASE}/etc|' \
+		${WRKSRC}/src/config.h
+
+post-install:
+	${INSTALL_DATA} ${WRKSRC}/doc/example-spnavrc ${STAGEDIR}${PREFIX}/etc/spnavrc.sample
+	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/spacenavd
+
+.include <bsd.port.mk>
diff --git a/misc/spacenavd-devel/Makefile.git_rev b/misc/spacenavd-devel/Makefile.git_rev
new file mode 100644
index 000000000000..5da29dcba95f
--- /dev/null
+++ b/misc/spacenavd-devel/Makefile.git_rev
@@ -0,0 +1,2 @@
+GIT_SRC_HASH=  df7a61e9eb5cded0764a0f9e21792a56dc64c2ab
+GIT_SRC_DATE=  20250714131520
diff --git a/misc/spacenavd-devel/distinfo b/misc/spacenavd-devel/distinfo
new file mode 100644
index 000000000000..69780cb851cd
--- /dev/null
+++ b/misc/spacenavd-devel/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1752571835
+SHA256 (FreeSpacenav-spacenavd-r20250714131520-df7a61e9eb5cded0764a0f9e21792a56dc64c2ab_GH0.tar.gz) = 0bdb6df0ab2cda996e0c8a99fa88d8e401424e82e7a68f80b909b560fe5aba86
+SIZE (FreeSpacenav-spacenavd-r20250714131520-df7a61e9eb5cded0764a0f9e21792a56dc64c2ab_GH0.tar.gz) = 63954
diff --git a/misc/spacenavd-devel/files/newVersion.sh b/misc/spacenavd-devel/files/newVersion.sh
new file mode 100644
index 000000000000..7d0c76215cae
--- /dev/null
+++ b/misc/spacenavd-devel/files/newVersion.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+CURDIR=`pwd`
+WRKDIR=`pwd`/work
+#mkdir -p "${WRKDIR}"
+
+if [ \! -d "${CURDIR}/spacenavd-repo" ]; then
+ git clone -b master https://github.com/FreeSpacenav/spacenavd.git "${CURDIR}/spacenavd-repo";
+else
+  cd "${CURDIR}/spacenavd-repo"
+  git pull https://github.com/FreeSpacenav/spacenavd.git;
+fi
+
+cd "${CURDIR}/spacenavd-repo"
+GIT_SRC_HASH=`git log -n 1 --pretty=format:"%H"`;
+GIT_SRC_DATE=`git log -n 1 --date=iso-local -n 1 --pretty=format:"%cd" | \
+    cut -c '1-19' | sed -e 's,-,,g' -e 's,:,,g' -e 's, ,,g'`
+
+echo "$GIT_SRC_HASH, $GIT_SRC_DATE"
+echo "GIT_SRC_HASH=  ${GIT_SRC_HASH}"    > ${CURDIR}/Makefile.git_rev
+echo "GIT_SRC_DATE=  ${GIT_SRC_DATE}"   >> ${CURDIR}/Makefile.git_rev
+
diff --git a/misc/spacenavd-devel/files/spacenavd.in b/misc/spacenavd-devel/files/spacenavd.in
new file mode 100644
index 000000000000..987f055e22b3
--- /dev/null
+++ b/misc/spacenavd-devel/files/spacenavd.in
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# $FreeBSD$
+#
+# PROVIDE: spacenavd
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add these lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# spacenavd_enable (bool):	Set to NO by default.
+#				Set it to YES to enable spacenavd.
+# spacenavd_config (path):	Set to %%PREFIX%%/etc/spnavrc
+#				by default.
+
+. /etc/rc.subr
+
+name=spacenavd
+rcvar=spacenavd_enable
+
+load_rc_config $name
+
+: ${spacenavd_enable:="NO"}
+: ${spacenavd_config="%%PREFIX%%/etc/spnavrc"}
+
+command=%%PREFIX%%/bin/${name}
+pidfile=/var/run/${name}.pid
+
+command_args="-v -c $spacenavd_config -p $pidfile"
+
+run_rc_command "$1"
diff --git a/misc/spacenavd-devel/pkg-descr b/misc/spacenavd-devel/pkg-descr
new file mode 100644
index 000000000000..d271af4f4677
--- /dev/null
+++ b/misc/spacenavd-devel/pkg-descr
@@ -0,0 +1,7 @@
+Spacenavd is a free software user-space driver (daemon), for 6-dof
+input devices, like 3Dconnexion's space-mice. It's compatible with
+the original 3dxsrv proprietary daemon provided by 3Dconnexion,
+and works as a drop-in replacement with any program that was written
+for the 3Dconnexion driver, but also provides an improved
+communication mechanism for programs designed specifically to work
+with spacenavd.
diff --git a/misc/spacenavd-devel/pkg-plist b/misc/spacenavd-devel/pkg-plist
new file mode 100644
index 000000000000..bf7578255ddf
--- /dev/null
+++ b/misc/spacenavd-devel/pkg-plist
@@ -0,0 +1,4 @@
+bin/spacenavd
+bin/spnavd_ctl
+etc/rc.d/spacenavd
+@sample etc/spnavrc.sample