Makefile 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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:=perl-device-usb
  9. PKG_VERSION:=0.36
  10. PKG_RELEASE:=1
  11. PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GW/GWADEJ/
  12. PKG_SOURCE:=Device-USB-$(PKG_VERSION).tar.gz
  13. PKG_MD5SUM:=aa91bee777f7ed7a18225a84f8795344
  14. PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
  15. PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
  16. PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Device-USB-$(PKG_VERSION)
  17. PKG_BUILD_DEPENDS:=perl-inline-c/host
  18. include $(INCLUDE_DIR)/package.mk
  19. include ../perl/perlmod.mk
  20. define Package/perl-device-usb
  21. SUBMENU:=Perl
  22. SECTION:=lang
  23. CATEGORY:=Languages
  24. TITLE:=libusb library wrapper
  25. URL:=http://search.cpan.org/dist/Device-USB/
  26. DEPENDS:=perl +libusb-compat +perl-inline +perl-inline-c +perlbase-essential +perlbase-test
  27. endef
  28. # Device::USB will generate a second Makefile.PL to build it's native code
  29. # using Inline::C under _Inline/. The goal here is to prevent Inline::C from
  30. # running that one automatically, as we need to supply a bunch of overrides via
  31. # perlmod/Configure.
  32. # _INLINE_C_NO_COMPILE_ is an OpenWRT-specific environment variable to Inline::C
  33. # that does just that.
  34. define Build/Configure
  35. $(call perlmod/Configure,,)
  36. # Prepare a library directory where we can link againt lusb-0.1(as
  37. # opposed to -lusb) to avoid confusion at runtime
  38. mkdir $(PKG_BUILD_DIR)/syslib
  39. $(LN) $(STAGING_DIR)/usr/lib/libusb.so $(PKG_BUILD_DIR)/syslib/libusb-0.1.so
  40. # Generate _Inline
  41. $(call perlmod/Compile,config,LIBUSB_LIBDIR=$(PKG_BUILD_DIR)/syslib \
  42. _INLINE_C_NO_COMPILE_=1 \
  43. _INLINE_C_SYSTEM_TYPEMAP_=$(STAGING_DIR)/usr/lib/perl5/$(PERL_VERSION)/ExtUtils/typemap)
  44. $(call perlmod/Compile,dynamic,_INLINE_C_NO_COMPILE_=1)
  45. # Configure _Inline
  46. $(call perlmod/Configure,,,$(PKG_BUILD_DIR)/_Inline/build/Device/USB)
  47. # Prevent re-configuring Inline code
  48. sed 's/^dynamic :: D.*$$$$//' -i $(PKG_BUILD_DIR)/Makefile
  49. endef
  50. define Build/Compile
  51. $(call perlmod/Compile,,,$(PKG_BUILD_DIR)/_Inline/build/Device/USB)
  52. $(call perlmod/Compile,,)
  53. endef
  54. define Package/perl-device-usb/install
  55. $(call perlmod/Install,$(1),Device auto/Device)
  56. endef
  57. $(eval $(call BuildPackage,perl-device-usb))