Makefile 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=hidapi
  9. PKG_VERSION:=0.8.0-rc1
  10. PKG_RELEASE:=2
  11. PKG_SOURCE_PROTO:=git
  12. PKG_SOURCE_URL:=https://github.com/signal11/hidapi.git
  13. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  14. PKG_SOURCE_VERSION:=hidapi-$(PKG_VERSION)
  15. PKG_SOURCE:=$(PKG_SOURCE_VERSION).tar.gz
  16. PKG_LICENSE:=BSD-3-Clause
  17. PKG_LICENSE_FILES:=LICENSE-bsd.txt
  18. PKG_MAINTAINER:=Paul Fertser <fercerpav@gmail.com>
  19. include $(INCLUDE_DIR)/package.mk
  20. include $(INCLUDE_DIR)/nls.mk
  21. define Package/hidapi
  22. SECTION:=libs
  23. CATEGORY:=Libraries
  24. DEPENDS:=+libusb-1.0 +librt $(ICONV_DEPENDS)
  25. TITLE:=Library to talk to HID devices
  26. URL:=http://www.signal11.us/oss/hidapi/
  27. endef
  28. define Package/hidapi/description
  29. HIDAPI is a multi-platform library which allows an application to interface
  30. with USB and Bluetooth HID-Class devices on Windows, Linux, FreeBSD, and Mac
  31. OS X. HIDAPI can be either built as a shared library (.so or .dll) or
  32. can be embedded directly into a target application by adding a single source
  33. file (per platform) and a single header.
  34. endef
  35. define Build/Configure
  36. endef
  37. MAKE_PATH=libusb
  38. MAKE_FLAGS+=-f Makefile.linux
  39. TARGET_CFLAGS+=$(FPIC)
  40. define Build/Compile
  41. $(call Build/Compile/Default, libhidapi-libusb.so)
  42. mv $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so \
  43. $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so.0
  44. ln -s libhidapi-libusb.so.0 $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so
  45. sed 's^@prefix@^/usr^; \
  46. s^@exec_prefix@^/usr^; \
  47. s^@libdir@^$$$${exec_prefix}/lib^; \
  48. s^@includedir@^$$$${prefix}/include^' \
  49. < $(PKG_BUILD_DIR)/pc/hidapi-libusb.pc.in \
  50. > $(PKG_BUILD_DIR)/pc/hidapi-libusb.pc
  51. endef
  52. define Build/InstallDev
  53. $(INSTALL_DIR) $(1)/usr/include/hidapi
  54. $(CP) $(PKG_BUILD_DIR)/hidapi/hidapi.h $(1)/usr/include/hidapi/
  55. $(INSTALL_DIR) $(1)/usr/lib
  56. $(CP) $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so* $(1)/usr/lib/
  57. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
  58. $(CP) $(PKG_BUILD_DIR)/pc/hidapi-libusb.pc $(1)/usr/lib/pkgconfig/
  59. endef
  60. define Package/hidapi/install
  61. $(INSTALL_DIR) $(1)/usr/lib
  62. $(CP) $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so* $(1)/usr/lib/
  63. endef
  64. $(eval $(call BuildPackage,hidapi))