aboutsummaryrefslogtreecommitdiff
path: root/libs/hidapi/Makefile
blob: e8ef7335941a5236417ff8706aad0a72826c6fab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=hidapi
PKG_VERSION:=0.8.0-rc1
PKG_RELEASE:=2

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/signal11/hidapi.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=hidapi-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_SOURCE_VERSION).tar.gz
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE-bsd.txt

PKG_MAINTAINER:=Paul Fertser <fercerpav@gmail.com>

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk

define Package/hidapi
  SECTION:=libs
  CATEGORY:=Libraries
  DEPENDS:=+libusb-1.0 +librt $(ICONV_DEPENDS)
  TITLE:=Library to talk to HID devices
  URL:=http://www.signal11.us/oss/hidapi/
endef

define Package/hidapi/description
HIDAPI is a multi-platform library which allows an application to interface
with USB and Bluetooth HID-Class devices on Windows, Linux, FreeBSD, and Mac
OS X.  HIDAPI can be either built as a shared library (.so or .dll) or
can be embedded directly into a target application by adding a single source
file (per platform) and a single header.
endef

define Build/Configure
endef

MAKE_PATH=libusb
MAKE_FLAGS+=-f Makefile.linux
TARGET_CFLAGS+=$(FPIC)

define Build/Compile
	$(call Build/Compile/Default, libhidapi-libusb.so)
	mv $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so \
		$(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so.0
	ln -s libhidapi-libusb.so.0 $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so
	sed    's^@prefix@^/usr^; \
		s^@exec_prefix@^/usr^; \
		s^@libdir@^$$$${exec_prefix}/lib^; \
		s^@includedir@^$$$${prefix}/include^' \
		< $(PKG_BUILD_DIR)/pc/hidapi-libusb.pc.in \
		> $(PKG_BUILD_DIR)/pc/hidapi-libusb.pc
endef

define Build/InstallDev
	$(INSTALL_DIR) $(1)/usr/include/hidapi
	$(CP) $(PKG_BUILD_DIR)/hidapi/hidapi.h $(1)/usr/include/hidapi/
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so* $(1)/usr/lib/
	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
	$(CP) $(PKG_BUILD_DIR)/pc/hidapi-libusb.pc $(1)/usr/lib/pkgconfig/
endef

define Package/hidapi/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so* $(1)/usr/lib/
endef

$(eval $(call BuildPackage,hidapi))