diff options
author | Gary Wong <gtw@gnu.org> | 2020-09-21 22:13:23 -0600 |
---|---|---|
committer | Gary Wong <gtw@gnu.org> | 2020-09-21 22:13:23 -0600 |
commit | 4e31368ad249b8029fc4f20d89ff61a53dfc3983 (patch) | |
tree | fcfa6556008ca5772a129df0da9d679753553b21 | |
parent | 5a2ff3f7cf1c6d335f859edbc8034423189b4212 (diff) |
dev-libs/hidapi: Make the hidraw backend (and udev dependency) optional.
-rw-r--r-- | dev-libs/hidapi/Manifest | 4 | ||||
-rw-r--r-- | dev-libs/hidapi/files/hidapi-0.8.0-hidraw-optional.patch | 88 | ||||
-rw-r--r-- | dev-libs/hidapi/hidapi-0.8.0_rc1_p20140719.ebuild | 78 | ||||
-rw-r--r-- | dev-libs/hidapi/metadata.xml | 14 |
4 files changed, 184 insertions, 0 deletions
diff --git a/dev-libs/hidapi/Manifest b/dev-libs/hidapi/Manifest new file mode 100644 index 0000000..3c7a28c --- /dev/null +++ b/dev-libs/hidapi/Manifest @@ -0,0 +1,4 @@ +AUX hidapi-0.8.0-hidraw-optional.patch 2382 BLAKE2B f3dc67850380c207ee3bb01969ca94c6bfa1d605cd89611d8709865882fa35064c691b536041ea358c35e845695c6ae0d7340d629f2a7671282d6c611f0d3c3e SHA512 de5fa31575ac953ac66884dfc2558289b1e957892df9ff89d3ee0d09ffe55bbf5507c74f893256e133d9d50a8594e755d6addefef543f7641f14638cab2dd7c8 +DIST hidapi-0.8.0_rc1_p20140719.tgz 103079 BLAKE2B f40a4c17cb8c5eed41f4eea84fac46a879ec2057f28212aa43c8fd718ceea68d760785cb4f4e2ea3bcd2a4345b65d75d0d278b93697ec61963be9270684a15cb SHA512 204934a707da4e67b834823650b0cfd9be7b413972071129cc5aeeb93465834dde2f5ee23283c55d35b56e3aed8b7ad5fe947399839081f4d895fb65c8cd3e3d +EBUILD hidapi-0.8.0_rc1_p20140719.ebuild 2033 BLAKE2B 8e2092967f7233a06b937a73218d6bb0009b5d1dde5cdb2dded319d847af9f3b7261ee28db684bf7fb9b3cd635f327688ce091254f1beeb87c07ef901da87f9b SHA512 657b99d7bb44629163e0f65b69f98d3985f087133af83c2e502462d66c0bd4ad842db3df0f1d5a8a37a2aec8938839f8884183af00517d102a40eb459173ce4e +MISC metadata.xml 540 BLAKE2B 6396197ca946971d1e954233589189f5e91dd4dc4fd6182f5cdf24890a5601a5e32fa71e2f4b2a676d346cb8feb1232467fa569f9348a5b788f5ee4a6838d7dc SHA512 3e0185fa3a56d0bb18f1256fe9e5c74cb5cdaea91cd24054d12243512012fdead25ac69c84a82d282b070bd73be2a9a7e313e858c05e6c2fe49bd38cba4d28d1 diff --git a/dev-libs/hidapi/files/hidapi-0.8.0-hidraw-optional.patch b/dev-libs/hidapi/files/hidapi-0.8.0-hidraw-optional.patch new file mode 100644 index 0000000..faa1114 --- /dev/null +++ b/dev-libs/hidapi/files/hidapi-0.8.0-hidraw-optional.patch @@ -0,0 +1,88 @@ +diff --git a/Makefile.am b/Makefile.am +index 196c991b..5702f776 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -8,15 +8,22 @@ pkgconfigdir=$(libdir)/pkgconfig + endif + + if OS_LINUX ++if BUILD_HIDRAW + pkgconfig_DATA=pc/hidapi-hidraw.pc pc/hidapi-libusb.pc + else ++pkgconfig_DATA=pc/hidapi-libusb.pc ++endif ++else + pkgconfig_DATA=pc/hidapi.pc + endif + + SUBDIRS= + + if OS_LINUX +-SUBDIRS += linux libusb ++if BUILD_HIDRAW ++SUBDIRS += linux ++endif ++SUBDIRS += libusb + endif + + if OS_DARWIN +diff --git a/configure.ac b/configure.ac +index c6747f90..918da195 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -50,6 +50,8 @@ hidapi_prog_error() { + exit 1 + } + ++AC_ARG_WITH(udev, AC_HELP_STRING([--without-udev], [Ignore udev and omit hidraw backend])) ++ + AC_MSG_CHECKING([operating system]) + AC_MSG_RESULT($host) + case $host in +@@ -57,14 +59,16 @@ case $host in + AC_MSG_RESULT([ (Linux back-end)]) + AC_DEFINE(OS_LINUX, 1, [Linux implementations]) + AC_SUBST(OS_LINUX) +- backend="linux" + os="linux" + threads="pthreads" + + # HIDAPI/hidraw libs +- PKG_CHECK_MODULES([libudev], [libudev], true, [hidapi_lib_error libudev]) ++ BUILD_HIDRAW=0 ++ AS_IF([test "x$with_udev" != "xno"], ++ [PKG_CHECK_MODULES([libudev], [libudev], [BUILD_HIDRAW=1], [hidapi_lib_error libudev]) + LIBS_HIDRAW_PR+=" $libudev_LIBS" +- CFLAGS_HIDRAW+=" $libudev_CFLAGS" ++ CFLAGS_HIDRAW+=" $libudev_CFLAGS"]) ++ AC_SUBST(BUILD_HIDRAW) + + # HIDAPI/libusb libs + AC_CHECK_LIB([rt], [clock_gettime], [LIBS_LIBUSB_PRIVATE+=" -lrt"], [hidapi_lib_error librt]) +@@ -210,6 +214,7 @@ AC_SUBST([backend]) + + # OS info for Automake + AM_CONDITIONAL(OS_LINUX, test "x$os" = xlinux) ++AM_CONDITIONAL(BUILD_HIDRAW, test "x$BUILD_HIDRAW" = 1) + AM_CONDITIONAL(OS_DARWIN, test "x$os" = xdarwin) + AM_CONDITIONAL(OS_FREEBSD, test "x$os" = xfreebsd) + AM_CONDITIONAL(OS_KFREEBSD, test "x$os" = xkfreebsd) +diff --git a/hidtest/Makefile.am b/hidtest/Makefile.am +index d2786445..5d7e440b 100644 +--- a/hidtest/Makefile.am ++++ b/hidtest/Makefile.am +@@ -2,10 +2,14 @@ AM_CPPFLAGS = -I$(top_srcdir)/hidapi/ + + ## Linux + if OS_LINUX ++if BUILD_HIDRAW + noinst_PROGRAMS = hidtest-libusb hidtest-hidraw + + hidtest_hidraw_SOURCES = hidtest.cpp + hidtest_hidraw_LDADD = $(top_builddir)/linux/libhidapi-hidraw.la ++else ++noinst_PROGRAMS = hidtest-libusb ++endif + + hidtest_libusb_SOURCES = hidtest.cpp + hidtest_libusb_LDADD = $(top_builddir)/libusb/libhidapi-libusb.la diff --git a/dev-libs/hidapi/hidapi-0.8.0_rc1_p20140719.ebuild b/dev-libs/hidapi/hidapi-0.8.0_rc1_p20140719.ebuild new file mode 100644 index 0000000..569d125 --- /dev/null +++ b/dev-libs/hidapi/hidapi-0.8.0_rc1_p20140719.ebuild @@ -0,0 +1,78 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +AUTOTOOLS_AUTORECONF=yes + +inherit epatch eutils versionator autotools-multilib #git-2 + +# If github is desired, the following may be used. +#EGIT_REPO_URI="https://github.com/signal11/hidapi.git" +#EGIT_BRANCH="master" +EGIT_COMMIT="d17db57b9d4354752e0af42f5f33007a42ef2906" + +# S is only needed for the debian_package +S=${WORKDIR}/${PN}-${DEBIAN_PV} + +DESCRIPTION="A multi-platform library for USB and Bluetooth HID-Class devices" +HOMEPAGE="http://www.signal11.us/oss/hidapi/" +SRC_URI="https://github.com/signal11/${PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tgz" +# When 0.8.0 is officially available the following link should be used. +#SRC_URI="https://github.com/downloads/signal11/${PN}/${P}.zip" + +LICENSE="|| ( BSD GPL-3 HIDAPI )" +SLOT="0" +KEYWORDS="amd64 ~arm ~arm64 ~ppc ~ppc64 x86" +IUSE="doc fox static-libs udev" + +RDEPEND="virtual/libusb:1[${MULTILIB_USEDEP}] + udev? ( virtual/libudev:0[${MULTILIB_USEDEP}] )" +DEPEND="${RDEPEND} + doc? ( app-doc/doxygen ) + virtual/pkgconfig + fox? ( x11-libs/fox )" + +S="${WORKDIR}/${PN}-${EGIT_COMMIT}" + +src_prepare() { + if ! use fox; then + sed -i -e 's:PKG_CHECK_MODULES(\[fox\], .*):AC_SUBST(fox_CFLAGS,[ ])AC_SUBST(fox_LIBS,[ ]):' configure.ac || die + fi + + epatch "${FILESDIR}/${PN}-0.8.0-hidraw-optional.patch" + + # Fix bashisms in the configure.ac file. + sed -i -e 's:\([A-Z_]\+\)+="\(.*\)":\1="${\1}\2":g' \ + -e 's:\([A-Z_]\+\)+=`\(.*\)`:\1="${\1}\2":g' configure.ac || die + + # Portage handles license texts itself, no need to install them + sed -i -e 's/LICENSE.*/ # blank/' Makefile.am || die + + autotools-multilib_src_prepare +} + +multilib_src_configure() { + local myeconfargs=( + $(multilib_native_use_enable fox testgui) + $(use_with udev) + ) + + autotools-utils_src_configure +} + +src_compile() { + autotools-multilib_src_compile + + if use doc; then + doxygen doxygen/Doxyfile || die + fi +} + +src_install() { + autotools-multilib_src_install + + if use doc; then + dohtml -r html/. + fi +} diff --git a/dev-libs/hidapi/metadata.xml b/dev-libs/hidapi/metadata.xml new file mode 100644 index 0000000..72a75f0 --- /dev/null +++ b/dev-libs/hidapi/metadata.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>gtw@gnu.org</email> + </maintainer> + <use> + <flag name="fox">Build a x11-libs/fox GUI</flag> + <flag name="udev">Use libudev to build the hidraw backend</flag> + </use> + <upstream> + <remote-id type="github">signal11/hidapi</remote-id> + </upstream> +</pkgmetadata> |