Fresh pull from upstream (stable) package feed
[librecmc/package-feed.git] / libs / hidapi / Makefile
1 #
2 # Copyright (C) 2015 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=hidapi
11 PKG_VERSION:=0.8.0-rc1
12 PKG_RELEASE:=2
13
14 PKG_SOURCE_PROTO:=git
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
21
22 PKG_MAINTAINER:=Paul Fertser <fercerpav@gmail.com>
23
24 include $(INCLUDE_DIR)/package.mk
25 include $(INCLUDE_DIR)/nls.mk
26
27 define Package/hidapi
28   SECTION:=libs
29   CATEGORY:=Libraries
30   DEPENDS:=+libusb-1.0 +librt $(ICONV_DEPENDS)
31   TITLE:=Library to talk to HID devices
32   URL:=http://www.signal11.us/oss/hidapi/
33 endef
34
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.
41 endef
42
43 define Build/Configure
44 endef
45
46 MAKE_PATH=libusb
47 MAKE_FLAGS+=-f Makefile.linux
48 TARGET_CFLAGS+=$(FPIC)
49
50 define Build/Compile
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
61 endef
62
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/
70 endef
71
72 define Package/hidapi/install
73         $(INSTALL_DIR) $(1)/usr/lib
74         $(CP) $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so* $(1)/usr/lib/
75 endef
76
77 $(eval $(call BuildPackage,hidapi))