sysutils/uhidd: grab and modernize

- Add CUSE option and enable on FreeBSD 11.0-CURRENT
- Convert to vendor install
- Convert to option target helpers
- Convert to service(8) that runs rc.d in sanitized environment
- Convert DEVD substitution to SUB_LIST (without SUB_FILES)
- Reformat patches with makepatch
- Fix PREFIX != LOCALBASE for libcuse4bsd.so
- Remove no longer required byacc(1) workaround
- Take maintainership
This commit is contained in:
Jan Beich
2015-08-21 18:04:28 +00:00
parent a26966c607
commit 435434ace6
6 changed files with 38 additions and 49 deletions

View File

@@ -3,56 +3,55 @@
PORTNAME= uhidd
PORTVERSION= 0.2.1
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= sysutils
MASTER_SITES= GOOGLE_CODE \
http://people.freebsd.org/~kaiw/distfiles/
MAINTAINER= ports@FreeBSD.org
MAINTAINER= jbeich@FreeBSD.org
COMMENT= Userland USB HID device driver using libusb20
LICENSE= BSD2CLAUSE
BUILD_DEPENDS= cuse4bsd-kmod>=0.1.24:${PORTSDIR}/multimedia/cuse4bsd-kmod
LIB_DEPENDS= libcuse4bsd.so:${PORTSDIR}/multimedia/cuse4bsd-kmod
USES= uidfix
MAKE_ENV+= BINDIR="${PREFIX}/sbin" MANDIR="${MANPREFIX}/man/man"
MAKE_ARGS= LIBDIR="${LOCALBASE}/lib"
USE_RC_SUBR= uhidd
SUB_FILES= pkg-message
LIBDIR= ${PREFIX}/lib
OPTIONS_DEFINE= DEVD
OPTIONS_DEFINE= CUSE DEVD
OPTIONS_DEFAULT= DEVD
OPTIONS_SUB= yes
.include <bsd.port.pre.mk>
.if exists(/usr/lib/libcuse.so)
OPTIONS_DEFAULT+= CUSE
.else
OPTIONS_EXCLUDE+= CUSE
.endif
LIBCUSE= ${LIBDIR}/libcuse4bsd.so
CUSE_DESC= Use cuse(3) over multimedia/cuse4bsd-kmod
CUSE_BUILD_DEPENDS_OFF= cuse4bsd-kmod>=0.1.24:${PORTSDIR}/multimedia/cuse4bsd-kmod
CUSE_LIB_DEPENDS_OFF= libcuse4bsd.so:${PORTSDIR}/multimedia/cuse4bsd-kmod
CUSE_SUB_LIST_OFF= LIBCUSE="${LOCALBASE}/lib/libcuse4bsd.so"
CUSE_SUB_LIST= LIBCUSE=""
.if defined(DEBUG_FLAGS)
MAKE_ENV+= DEBUG_FLAGS='${DEBUG_FLAGS}'
.endif
.if ${OSVERSION} > 1000012
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-uhidd-parser.y
.endif
post-patch: .SILENT
${FIND} ${WRKSRC}/uhidd -type f -not -name Makefile \
-exec ${REINPLACE_CMD} 's|/usr/local|${PREFIX}|g' {} +
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/uhidd/uhidd ${STAGEDIR}${PREFIX}/sbin
${INSTALL_MAN} ${WRKSRC}/uhidd/uhidd.8 ${STAGEDIR}${PREFIX}/man/man8
${INSTALL_MAN} ${WRKSRC}/uhidd/uhidd.conf.5 ${STAGEDIR}${PREFIX}/man/man5
.if ${PORT_OPTIONS:MDEVD}
post-patch-CUSE-on: .SILENT
${FIND} ${WRKSRC}/uhidd -type f -not \
-exec ${REINPLACE_CMD} -i '.cuse.bak' \
-Ee '/_init|\.c/!s|cuse4bsd|cuse|' {} +
post-install-DEVD-on:
@${MKDIR} ${STAGEDIR}${PREFIX}/etc/devd
${REINPLACE_CMD} -E \
-e "s|%%PREFIX%%|${PREFIX}|" \
-e "s|%%LIBCUSE%%|${LIBCUSE}|" \
${REINPLACE_CMD} ${_SUB_LIST_TEMP} \
${WRKSRC}/uhidd/uhidd-devd.conf.sample
${INSTALL_DATA} ${WRKSRC}/uhidd/uhidd-devd.conf.sample \
${STAGEDIR}${PREFIX}/etc/devd
.endif
.include <bsd.port.post.mk>
.include <bsd.port.mk>

View File

@@ -1,10 +0,0 @@
--- uhidd/parser.y.old 2012-10-14 22:33:00.000000000 +0200
+++ uhidd/parser.y 2012-10-14 22:33:06.000000000 +0200
@@ -39,7 +39,6 @@
#include "uhidd.h"
extern int yylex(void);
-extern int yyparse(void);
extern int lineno;
extern FILE *yyin;

View File

@@ -1,11 +0,0 @@
--- uhidd/Makefile.old 2013-12-19 06:20:40.000000000 +0100
+++ uhidd/Makefile 2013-12-19 06:19:20.000000000 +0100
@@ -8,7 +8,7 @@
CLEANFILES= ${GENSRCS}
MAN= uhidd.conf.5 uhidd.8
-WARNS?= 6
+WARNS?= 5
PREFIX?= /usr/local
LOCALBASE?= /usr/local

View File

@@ -0,0 +1,11 @@
--- uhidd/Makefile.orig 2012-10-14 00:38:33 UTC
+++ uhidd/Makefile
@@ -8,7 +8,7 @@ GENSRCS= usage_in_page.c usage_page.c
CLEANFILES= ${GENSRCS}
MAN= uhidd.conf.5 uhidd.8
-WARNS?= 6
+WARNS?= 5
PREFIX?= /usr/local
LOCALBASE?= /usr/local

View File

@@ -1,5 +1,5 @@
--- uhidd/usb_hid_usages.orig 2012-10-21 19:01:23.182592810 +0200
+++ uhidd/usb_hid_usages 2012-10-21 19:02:36.603616460 +0200
--- uhidd/usb_hid_usages.orig 2009-07-30 10:46:10 UTC
+++ uhidd/usb_hid_usages
@@ -1270,8 +1270,8 @@
0x48 Top Corner Distortion Balance
0x4A Bottom Corner Distortion Control

View File

@@ -24,7 +24,7 @@ according to which sub class drivers you want to use.
To manually start/stop uhidd daemon on certain device, run:
%%PREFIX%%/etc/rc.d/uhidd [start|stop] /dev/ugen.X.Y
service uhidd [start|stop] /dev/ugen.X.Y
See http://wiki.FreeBSD.org/uhidd for more details about how to install and
setup the daemon.