Changeset View
Standalone View
Mk/Uses/evdev.mk
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
svn:keywords | null | FreeBSD=%H \ No newline at end of property |
svn:mime-type | null | text/plain \ No newline at end of property |
# $FreeBSD$ | |||||
# | |||||
# Handle Input event device headers patches and dependencies | |||||
# | |||||
# Feature: evdev | |||||
# Usage: USES=evdev | |||||
# Valid ARGS: ports base ports-patch | |||||
# | |||||
mat: What does ports-patch do ? | |||||
Done Inline ActionsI think that part can be reworded
1 implies 3 for some strange software like libinput that has both bundled evdev headers and external evdev headers dependency. wulf_cicgroup.ru: I think that part can be reworded
1. ports - introduces build dependence on devel/libevdev… | |||||
# ports for runtime evdev feature detection (libevdev) | |||||
# base for compile-time feature detection | |||||
# default: ports | |||||
Not Done Inline ActionsWe try to *never* do runtime feature detection mat: We try to *never* do runtime feature detection | |||||
Not Done Inline ActionsRuntime feature detection is what devel/libevdev (and than all dependent ports) does. I don`t think we are going to rewrite it. wulf_cicgroup.ru: Runtime feature detection is what devel/libevdev (and than all dependent ports) does. I don`t… | |||||
Not Done Inline ActionsI forgot to mention in my previous answer. If https://reviews.freebsd.org/D6998 would be commited than we would have at least two different event device implementation with different features - one in kernel and one Linux-derived in userspace (webcamd) wulf_cicgroup.ru: I forgot to mention in my previous answer. If https://reviews.freebsd.org/D6998 would be… | |||||
# EVDEV_WRKSRC top-level path for evdev headers and directory traversal | |||||
# default: ${WRKSRC} | |||||
# | |||||
# Provide support to convert port-supplied copies of evdev headers from Linux | |||||
# EVDEV_INCLUDE top-level path for port-supplied evdev headers | |||||
# default: ${EVDEV_WRKSRC}/include | |||||
# EVDEV_INPUT_H path to port-supplied input.h header | |||||
# default: ${EVDEV_INCLUDE}/linux/input.h | |||||
# EVDEV_UINPUT_H path to port-supplied uinput.h header | |||||
# default: ${EVDEV_INCLUDE}/linux/uinput.h | |||||
# | |||||
# This variables can be defined to convert sources from using port system supplied | |||||
# headers to base system supplied ones. | |||||
# EVDEV_SOURCE_REGEX a regular expression to match files that needs to be converted | |||||
# EVDEV_SOURCE_FILES list of files relative to ${EVDEV_WRKSRC} | |||||
# EVDEV_SOURCE_GLOB list of glob pattern find(1) will match with | |||||
# | |||||
# MAINTAINER: portmgr@FreeBSD.org | |||||
.if !defined(_INCLUDE_USES_EVDEV_MK) | |||||
_INCLUDE_USES_EVDEV_MK= yes | |||||
_valid_ARGS= ports base ports-patch | |||||
.if empty(evdev_ARGS) | |||||
evdev_ARGS= ports | |||||
.endif | |||||
# Sanity checks | |||||
.for _arg in ${evdev_ARGS} | |||||
. if ! ${_valid_ARGS:M${_arg}} | |||||
IGNORE= Incorrect 'USES+= evdev:${evdev_ARGS}' usage: argument [${_arg}] is not recognized | |||||
. endif | |||||
.endfor | |||||
.if ${evdev_ARGS} == ports | |||||
BUILD_DEPENDS+= ${LOCALBASE}/include/linux/input.h:devel/libevdev-headers | |||||
CFLAGS+= -I${LOCALBASE}/include | |||||
CXXFLAGS+= -I${LOCALBASE}/include | |||||
.endif | |||||
EVDEV_WRKSRC?= ${WRKSRC} | |||||
EVDEV_INCLUDE?= ${EVDEV_WRKSRC}/include | |||||
EVDEV_INPUT_H?= ${EVDEV_INCLUDE}/linux/input.h | |||||
EVDEV_UINPUT_H?= ${EVDEV_INCLUDE}/linux/uinput.h | |||||
EVDEV_HEADER_PATTERN= '/^ *\# *include/s|[<"]linux(/u?input\.h)[>"]|<dev/evdev\1>|' | |||||
_USES_patch+= 700:evdev-post-patch | |||||
evdev-post-patch: | |||||
.if ${evdev_ARGS} != base | |||||
# Patch port-bundled input.h and uinput.h to be FreeBSD-compatible | |||||
@if [ -f "${EVDEV_INPUT_H}" ]; then \ | |||||
${REINPLACE_CMD} -i '' -E -e \ | |||||
's/__u([[:digit:]]+)/uint\1_t/g ; \ | |||||
s/__s([[:digit:]]+)/int\1_t/g ; \ | |||||
/# *include/ s|<sys/ioctl.h>|<sys/ioccom.h>| ; \ | |||||
/# *include[[:space:]]+<linux\/types.h>/d ; \ | |||||
/EVIOC(RMFF|GRAB|REVOKE)/ s/_IOW(.*), *int/_IOWINT\1/ ; \ | |||||
/EVIOCGKEYCODE/ s/_IOR/_IOWR/ ; \ | |||||
/EVIOCGMTSLOTS/ s/_IOC_READ/IOC_INOUT/ ; \ | |||||
/#define/ s/_IOC_READ/IOC_OUT/ ; \ | |||||
/#define/ s/_IOC_WRITE/IOC_IN/' \ | |||||
"${EVDEV_INPUT_H}"; \ | |||||
fi | |||||
@if [ -f "${EVDEV_UINPUT_H}" ]; then \ | |||||
${REINPLACE_CMD} -i '' -E -e \ | |||||
's/__u([[:digit:]]+)/uint\1_t/g ; \ | |||||
s/__s([[:digit:]]+)/int\1_t/g ; \ | |||||
/# *include/s|<linux/types.h>|<sys/types.h>| ; \ | |||||
/#define/ s/_IOW(.*), *int/_IOWINT\1/ ; \ | |||||
/#define/ s/_IOW(.*), *char\*/_IO\1/ ; \ | |||||
/#define/ s/_IOC_READ/IOC_OUT/ ; \ | |||||
/UI_GET_SYSNAME/ s/300/44/ ; \ | |||||
/UI_GET_VERSION/ s/301/45/' \ | |||||
"${EVDEV_UINPUT_H}"; \ | |||||
fi | |||||
.else | |||||
# Patch port sources to include dev/evdev/ files instead of linux/ | |||||
. if exists(/usr/include/dev/evdev/input.h) | |||||
. if defined(EVDEV_SOURCE_FILES) | |||||
Done Inline ActionsI don't have this file on 9.3, 10.3 or 11.0, when is it present ? mat: I don't have this file on 9.3, 10.3 or 11.0, when is it present ? | |||||
Not Done Inline ActionsIt is not commited to source tree yet. That is why the word "coming" is included in review header. See https://reviews.freebsd.org/D6998 wulf_cicgroup.ru: It is not commited to source tree yet. That is why the word "coming" is included in review… | |||||
@cd ${EVDEV_WRKSRC}; \ | |||||
${REINPLACE_CMD} -i '' -E -e ${EVDEV_HEADER_PATTERN} \ | |||||
${EVDEV_SOURCE_FILES} | |||||
. elif defined(EVDEV_SOURCE_REGEX) | |||||
@${FIND} -E ${EVDEV_WRKSRC} -type f -iregex '${EVDEV_SOURCE_REGEX}' \ | |||||
-print0 | ${XARGS} -0 \ | |||||
${REINPLACE_CMD} -i '' -E -e ${EVDEV_HEADER_PATTERN} | |||||
. else | |||||
. for f in ${EVDEV_SOURCE_GLOB} | |||||
@${FIND} ${EVDEV_WRKSRC} -type f -name '${f}' -print0 | ${XARGS} -0 \ | |||||
${REINPLACE_CMD} -i '' -E -e ${EVDEV_HEADER_PATTERN} | |||||
. endfor | |||||
. endif | |||||
. endif | |||||
.endif | |||||
.endif |
What does ports-patch do ?