2 # Copyright (C) 2015 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
11 PKG_VERSION:=0.8.0-rc1
15 PKG_SOURCE_URL:=https://github.com/signal11/hidapi.git
16 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
17 PKG_SOURCE_VERSION:=hidapi-$(PKG_VERSION)
18 PKG_SOURCE:=$(PKG_SOURCE_VERSION).tar.gz
19 PKG_LICENSE:=BSD-3-Clause
20 PKG_LICENSE_FILES:=LICENSE-bsd.txt
22 PKG_MAINTAINER:=Paul Fertser <fercerpav@gmail.com>
24 include $(INCLUDE_DIR)/package.mk
25 include $(INCLUDE_DIR)/nls.mk
30 DEPENDS:=+libusb-1.0 +librt $(ICONV_DEPENDS)
31 TITLE:=Library to talk to HID devices
32 URL:=http://www.signal11.us/oss/hidapi/
35 define Package/hidapi/description
36 HIDAPI is a multi-platform library which allows an application to interface
37 with USB and Bluetooth HID-Class devices on Windows, Linux, FreeBSD, and Mac
38 OS X. HIDAPI can be either built as a shared library (.so or .dll) or
39 can be embedded directly into a target application by adding a single source
40 file (per platform) and a single header.
43 define Build/Configure
47 MAKE_FLAGS+=-f Makefile.linux
48 TARGET_CFLAGS+=$(FPIC)
51 $(call Build/Compile/Default, libhidapi-libusb.so)
52 mv $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so \
53 $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so.0
54 ln -s libhidapi-libusb.so.0 $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so
55 sed 's^@prefix@^/usr^; \
56 s^@exec_prefix@^/usr^; \
57 s^@libdir@^$$$${exec_prefix}/lib^; \
58 s^@includedir@^$$$${prefix}/include^' \
59 < $(PKG_BUILD_DIR)/pc/hidapi-libusb.pc.in \
60 > $(PKG_BUILD_DIR)/pc/hidapi-libusb.pc
63 define Build/InstallDev
64 $(INSTALL_DIR) $(1)/usr/include/hidapi
65 $(CP) $(PKG_BUILD_DIR)/hidapi/hidapi.h $(1)/usr/include/hidapi/
66 $(INSTALL_DIR) $(1)/usr/lib
67 $(CP) $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so* $(1)/usr/lib/
68 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
69 $(CP) $(PKG_BUILD_DIR)/pc/hidapi-libusb.pc $(1)/usr/lib/pkgconfig/
72 define Package/hidapi/install
73 $(INSTALL_DIR) $(1)/usr/lib
74 $(CP) $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so* $(1)/usr/lib/
77 $(eval $(call BuildPackage,hidapi))