cdf85e32814f76820d218e810a53c861184b0690
[packages.git] / utils / firmwarehotplug / Makefile
1
2 # Copyright (C) 2006 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:=firmwarehotplug
11 PKG_VERSION:=0.1
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=@SF/linux-hotplug
16 PKG_MD5SUM:=e5cf352b172f498e27b160167b981f24
17
18 include $(INCLUDE_DIR)/package.mk
19
20 # workaround for fedora sdcc naming changes
21 ifneq ($(wildcard /usr/libexec/sdcc),)
22   export PATH:=$(PATH):/usr/libexec
23 endif
24
25 define Package/firmwarehotplug
26   SECTION:=utils
27   CATEGORY:=Utilities
28   DEPENDS:=@USB_SUPPORT +fxload
29   TITLE:=Hotplug firmware for EZ-USB microcontrollers
30   URL:=http://linux-hotplug.sourceforge.net/
31 endef
32
33 define Build/Compile
34         $(call Build/Compile/Default, \
35                 OPT="$(TARGET_CFLAGS)" \
36                 -C $(PKG_BUILD_DIR)/ezusb/midi/original \
37                 DESTDIR="$(PKG_INSTALL_DIR)" \
38                 all install \
39         )
40 endef
41
42 define Package/firmwarehotplug/install
43         $(INSTALL_DIR) $(1)/etc/hotplug.d/usb
44         install -m755 $(PKG_BUILD_DIR)/ezusb/midi/original/Hotplug/ezusbmidi $(1)/etc/hotplug.d/usb
45         install -m644 $(PKG_BUILD_DIR)/ezusb/midi/original/Hotplug/ezusbmidi.usermap $(1)/etc/hotplug.d
46         $(INSTALL_DIR) $(1)/usr/share/usb/ezusbmidi
47         install -m644 $(PKG_BUILD_DIR)/ezusb/midi/original/ezusbmidi1x1.ihx $(1)/usr/share/usb/ezusbmidi
48         install -m644 $(PKG_BUILD_DIR)/ezusb/midi/original/ezusbmidi2x2.ihx $(1)/usr/share/usb/ezusbmidi
49 endef
50
51 $(eval $(call BuildPackage,firmwarehotplug))
52
53 define Require/working-sdcc
54         sdcc -v 2>&1 | awk '($$$$1 == "SDCC") && ($$$$3 == "mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08") { print "ok" }' | grep ok > /dev/null
55 endef
56
57 $(eval $(call RequireCommand,sdcc, \
58         $(PKG_NAME) requires the SDCC Cross Compiler (sdcc). \
59 ))
60
61 $(eval $(call Require,working-sdcc, \
62         $(PKG_NAME) requires a SDCC Cross Compiler (sdcc) that supports the following targets : \
63         mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08. You might consider \
64         installing the non-free version. \
65 ))