Skip to content

Commit

Permalink
* Fix build with FreeBSD-11 that has cuse4bsd included in the base.
Browse files Browse the repository at this point in the history
* Reduce WARN level to 5 to avoid the -Wmissing-variable-declarations
  warnings.
  • Loading branch information
kaiwang27 committed Dec 4, 2015
1 parent 0598b87 commit 4176a6b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
19 changes: 17 additions & 2 deletions uhidd/Makefile
@@ -1,3 +1,12 @@
# Get __FreeBSD_version
.if !defined(OSVERSION)
.if exists(/usr/include/sys/param.h)
OSVERSION!= awk '/^\#define[[:blank:]]__FreeBSD_version/ {print $$3}' < /usr/include/sys/param.h
.else
OSVERSION!= sysctl -n kern.osreldate
.endif
.endif

PROG= uhidd
SRCS= uhidd.c uhidd_vhid_cuse.c uhidd_hidcore.c uhidd_hidump.c uhidd_kbd.c \
uhidd_cc.c lex.l uhidd_mouse.c parser.y y.tab.h usage_in_page.c \
Expand All @@ -8,14 +17,20 @@ 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
LIBDIR= ${PREFIX}/lib

DPADD= ${LIBUSB} ${LIBPTHREAD} ${LIBUTIL}
LDADD= -lcuse4bsd -lusb -lpthread -lutil
LDADD= -lusb -lpthread -lutil

.if ${OSVERSION} >= 1100023
LDADD+= -lcuse
.else
LDADD+= -lcuse4bsd
.endif

CFLAGS+= -I. -I${.CURDIR} -I${LOCALBASE}/include -g
LDFLAGS+= -L${LIBDIR}
Expand Down
8 changes: 8 additions & 0 deletions uhidd/uhidd_cuse4bsd.c
Expand Up @@ -29,7 +29,11 @@ __FBSDID("$FreeBSD$");

#include <sys/param.h>
#include <sys/wait.h>
#if __FreeBSD_version >= 1100023
#include <cuse.h>
#else
#include <cuse4bsd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
Expand Down Expand Up @@ -71,7 +75,11 @@ ucuse_init(void)
if (verbose)
syslog(LOG_INFO, "Attempt to load kernel"
" module cuse4bsd.ko...");
#if __FreeBSD_version >= 1100023
status = system("kldload cuse");
#else
status = system("kldload cuse4bsd");
#endif
if (WEXITSTATUS(status) != 0) {
syslog(LOG_ERR, "Failed to load cuse4bsd"
" kernel module");
Expand Down
4 changes: 4 additions & 0 deletions uhidd/uhidd_vhid_cuse.c
Expand Up @@ -36,7 +36,11 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#include <string.h>
#include <syslog.h>
#if __FreeBSD_version >= 1100023
#include <cuse.h>
#else
#include <cuse4bsd.h>
#endif
#include "uhidd.h"

/*
Expand Down

0 comments on commit 4176a6b

Please sign in to comment.