summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2018-04-11 10:40:08 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2018-04-11 10:40:08 +0300
commit375cf3d9ce71cc0a55f319dd2188c1bf03d7b057 (patch)
treeb27cc2183fb2467843678a77eef1a95f9b41a493
parentf151afa59c71f98664e94f4e974ebabac6daf757 (diff)
xboxdrv-scm
-rw-r--r--games-util/xboxdrv/files/github-144.patch15
-rw-r--r--games-util/xboxdrv/files/org.seul.Xboxdrv.conf7
-rw-r--r--games-util/xboxdrv/files/xboxdrv-scm-fix-c++14.patch16
-rw-r--r--games-util/xboxdrv/files/xboxdrv-scm-scons.patch13
-rw-r--r--games-util/xboxdrv/files/xboxdrv.confd5
-rw-r--r--games-util/xboxdrv/files/xboxdrv.initd18
-rw-r--r--games-util/xboxdrv/files/xboxdrv.service14
-rw-r--r--games-util/xboxdrv/files/xboxdrv.udev-rules5
-rw-r--r--games-util/xboxdrv/metadata.xml8
-rw-r--r--games-util/xboxdrv/xboxdrv-scm.ebuild64
10 files changed, 165 insertions, 0 deletions
diff --git a/games-util/xboxdrv/files/github-144.patch b/games-util/xboxdrv/files/github-144.patch
new file mode 100644
index 0000000..5782e1a
--- /dev/null
+++ b/games-util/xboxdrv/files/github-144.patch
@@ -0,0 +1,15 @@
+diff -Naur xboxdrv-linux-0.8.5.orig/src/usb_gsource.cpp xboxdrv-linux-0.8.5/src/usb_gsource.cpp
+--- xboxdrv-linux-0.8.5.orig/src/usb_gsource.cpp 2013-04-07 18:27:49.000000000 +0100
++++ xboxdrv-linux-0.8.5/src/usb_gsource.cpp 2016-07-02 12:35:41.692355904 +0100
+@@ -174,7 +174,10 @@
+ gboolean
+ USBGSource::on_source()
+ {
+- libusb_handle_events(NULL);
++ struct timeval to;
++ to.tv_sec = 0;
++ to.tv_usec = 0;
++ libusb_handle_events_timeout_completed(NULL, &to, NULL);
+ return TRUE;
+ }
+
diff --git a/games-util/xboxdrv/files/org.seul.Xboxdrv.conf b/games-util/xboxdrv/files/org.seul.Xboxdrv.conf
new file mode 100644
index 0000000..fc685d6
--- /dev/null
+++ b/games-util/xboxdrv/files/org.seul.Xboxdrv.conf
@@ -0,0 +1,7 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <policy context="default">
+ <allow own="org.seul.Xboxdrv"/>
+ </policy>
+</busconfig>
diff --git a/games-util/xboxdrv/files/xboxdrv-scm-fix-c++14.patch b/games-util/xboxdrv/files/xboxdrv-scm-fix-c++14.patch
new file mode 100644
index 0000000..80a8d8f
--- /dev/null
+++ b/games-util/xboxdrv/files/xboxdrv-scm-fix-c++14.patch
@@ -0,0 +1,16 @@
+Cast boost::shared_ptr explicitly for C++14.
+See also: https://bugs.gentoo.org/show_bug.cgi?id=594674
+
+--- a/src/controller_slot.cpp
++++ b/src/controller_slot.cpp
+@@ -67,9 +67,9 @@ ControllerSlot::disconnect()
+ }
+
+ bool
+ ControllerSlot::is_connected() const
+ {
+- return m_thread;
++ return static_cast<bool>(m_thread);
+ }
+
+ /* EOF */
diff --git a/games-util/xboxdrv/files/xboxdrv-scm-scons.patch b/games-util/xboxdrv/files/xboxdrv-scm-scons.patch
new file mode 100644
index 0000000..d6df8d9
--- /dev/null
+++ b/games-util/xboxdrv/files/xboxdrv-scm-scons.patch
@@ -0,0 +1,13 @@
+https://dev.gentoo.org/~vapier/scons-blows.txt
+
+diff -Naur xboxdrv-linux-0.8.8.orig/SConstruct xboxdrv-linux-0.8.8/SConstruct
+--- xboxdrv-linux-0.8.8.orig/SConstruct 2015-11-09 10:19:35.000000000 +0000
++++ xboxdrv-linux-0.8.8/SConstruct 2016-07-02 16:13:52.560961836 +0100
+@@ -84,6 +84,7 @@
+ opts.Add('CXXFLAGS', 'C++ Compiler flags')
+ opts.Add('LINKFLAGS', 'Linker Compiler flags')
+ opts.Add('AR', 'Library archiver')
++opts.Add('RANLIB', 'Archive indexer')
+ opts.Add('CC', 'C Compiler')
+ opts.Add('CXX', 'C++ Compiler')
+ opts.Add('BUILD', 'Build type: release, custom, development')
diff --git a/games-util/xboxdrv/files/xboxdrv.confd b/games-util/xboxdrv/files/xboxdrv.confd
new file mode 100644
index 0000000..99363c9
--- /dev/null
+++ b/games-util/xboxdrv/files/xboxdrv.confd
@@ -0,0 +1,5 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+XBOXDRV_OPTS=""
+#XBOXDRV_OPTS="${XBOXDRV_OPTS} --next-controller --config /etc/xboxdrv/controller.ini"
diff --git a/games-util/xboxdrv/files/xboxdrv.initd b/games-util/xboxdrv/files/xboxdrv.initd
new file mode 100644
index 0000000..8602c7e
--- /dev/null
+++ b/games-util/xboxdrv/files/xboxdrv.initd
@@ -0,0 +1,18 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+PIDFILE="/var/run/${SVCNAME}.pid"
+
+start() {
+ ebegin "Starting xboxdrv"
+ start-stop-daemon --start --pidfile "${PIDFILE}" --exec /usr/bin/xboxdrv -- \
+ --daemon --detach --pid-file "${PIDFILE}" ${XBOXDRV_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping xboxdrv"
+ start-stop-daemon --stop --pidfile "${PIDFILE}"
+ eend $?
+}
diff --git a/games-util/xboxdrv/files/xboxdrv.service b/games-util/xboxdrv/files/xboxdrv.service
new file mode 100644
index 0000000..b0d3726
--- /dev/null
+++ b/games-util/xboxdrv/files/xboxdrv.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Userspace Xbox 360 Controller driver
+BindsTo=sys-subsystem-usb-xbox-controller0.device
+After=sys-subsystem-usb-xbox-controller0.device
+
+[Service]
+BusName=org.seul.Xboxdrv
+ExecStart=/usr/bin/xboxdrv --silent --daemon
+KillSignal=SIGINT
+# xboxdrv can not stop gracefully if controller gets unplugged
+TimeoutStopSec=2
+
+[Install]
+WantedBy=multi-user.target
diff --git a/games-util/xboxdrv/files/xboxdrv.udev-rules b/games-util/xboxdrv/files/xboxdrv.udev-rules
new file mode 100644
index 0000000..c571b2b
--- /dev/null
+++ b/games-util/xboxdrv/files/xboxdrv.udev-rules
@@ -0,0 +1,5 @@
+SUBSYSTEM=="usb", ACTION=="add",\
+ ENV{ID_MODEL_FROM_DATABASE}=="Xbox*Controller|Xbox*Controller S",\
+ TAG+="systemd",\
+ ENV{SYSTEMD_ALIAS}="/sys/subsystem/usb/xbox/controller$number",\
+ ENV{SYSTEMD_WANTS}+="xboxdrv.service"
diff --git a/games-util/xboxdrv/metadata.xml b/games-util/xboxdrv/metadata.xml
new file mode 100644
index 0000000..3c18668
--- /dev/null
+++ b/games-util/xboxdrv/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>games@gentoo.org</email>
+ <name>Gentoo Games Project</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/games-util/xboxdrv/xboxdrv-scm.ebuild b/games-util/xboxdrv/xboxdrv-scm.ebuild
new file mode 100644
index 0000000..52befd7
--- /dev/null
+++ b/games-util/xboxdrv/xboxdrv-scm.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit linux-info scons-utils toolchain-funcs systemd udev git-r3
+
+#MY_P=${PN}-linux-${PV}
+DESCRIPTION="Userspace Xbox 360 Controller driver"
+HOMEPAGE="http://pingus.seul.org/~grumbel/xboxdrv/"
+SRC_URI=""
+EGIT_REPO_URI="https://github.com/xboxdrv/xboxdrv.git"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="dev-libs/boost:=
+ dev-libs/dbus-glib:=
+ virtual/libudev:=
+ sys-apps/dbus:=
+ dev-libs/glib:2=
+ virtual/libusb:1=
+ x11-libs/libX11:="
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+#S=${WORKDIR}/${MY_P}
+
+PATCHES=(
+ "${FILESDIR}"/${P}-scons.patch
+ "${FILESDIR}"/github-144.patch
+ "${FILESDIR}"/${P}-fix-c++14.patch
+)
+
+CONFIG_CHECK="~INPUT_EVDEV ~INPUT_JOYDEV ~INPUT_UINPUT ~!JOYSTICK_XPAD"
+
+src_compile() {
+ escons \
+ BUILD=custom \
+ CXX="$(tc-getCXX)" \
+ AR="$(tc-getAR)" \
+ RANLIB="$(tc-getRANLIB)" \
+ CXXFLAGS="-Wall ${CXXFLAGS}" \
+ LINKFLAGS="${LDFLAGS}"
+}
+
+src_install() {
+ dobin xboxdrv
+ doman doc/xboxdrv.1
+ dodoc AUTHORS NEWS PROTOCOL README.md TODO
+
+ newinitd "${FILESDIR}"/xboxdrv.initd xboxdrv
+ newconfd "${FILESDIR}"/xboxdrv.confd xboxdrv
+
+ insinto /etc/dbus-1/system.d/
+ doins "${FILESDIR}/org.seul.Xboxdrv.conf"
+
+ udev_newrules "${FILESDIR}"/xboxdrv.udev-rules 99-xbox-controller.rules
+ systemd_dounit "${FILESDIR}"/xboxdrv.service
+}
+
+pkg_postinst() {
+ udev_reload
+}