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