zaptel-1.4.x: unbreak kernel module build, use cross-ar and cross-ranlib to fix furth...
[openwrt/svn-archive/archive.git] / libs / zaptel-1.4.x / Makefile
1 #
2 # Copyright (C) 2006-2009 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 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=zaptel
12 PKG_VERSION:=1.4.12.1
13 PKG_RELEASE:=4
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://downloads.asterisk.org/pub/telephony/zaptel/releases/ \
17 http://ftp.digium.com/pub/zaptel/releases/
18 PKG_MD5SUM:=71e83a020b020fa60905edecf70e95a3
19
20 include $(INCLUDE_DIR)/package.mk
21
22 define Package/zaptel14/Default
23 TITLE:=Zaptel
24 URL:=http://ftp.digium.com/pub/zaptel/releases
25 DEPENDS:=
26 endef
27
28 define KernelPackage/zaptel14/Default
29 TITLE:=Zaptel (kernel module)
30 SUBMENU:=Other modules
31 DEPENDS:=
32 endef
33
34 define KernelPackage/zaptel14
35 $(call KernelPackage/zaptel14/Default)
36 TITLE:=Zaptel (kernel module)
37 FILES:=$(PKG_BUILD_DIR)/kernel/zaptel.$(LINUX_KMOD_SUFFIX)
38 AUTOLOAD:=$(call AutoLoad,70,zaptel)
39 endef
40
41 define KernelPackage/zaptel14/description
42 This package contains the Zaptel core module. No longer includes ztdummy
43 because it is not needed in all cases (and is in fact broken on x86).
44 endef
45
46
47 define KernelPackage/zaptel14-dummy
48 $(call KernelPackage/zaptel14/Default)
49 TITLE:=Zaptel Dummy (timer; kernel module)
50 DEPENDS += +kmod-zaptel14
51 FILES:=$(PKG_BUILD_DIR)/kernel/ztdummy.$(LINUX_KMOD_SUFFIX)
52 AUTOLOAD:=$(call AutoLoad,71,ztdummy)
53 endef
54
55 define KernelPackage/zaptel14/description
56 This package contains the Zaptel ztdummy driver. Broken on x86 due to lack
57 of RTC on some hardware.
58 endef
59
60 define KernelPackage/zaptel14-wcusb
61 $(call KernelPackage/zaptel14/Default)
62 DEPENDS += +kmod-zaptel14
63 FILES:=$(PKG_BUILD_DIR)/kernel/wcusb.$(LINUX_KMOD_SUFFIX)
64 AUTOLOAD:=$(call AutoLoad,72,wcusb)
65 endef
66
67 define KernelPackage/zaptel14-wcusb/description
68 This package contains the Zaptel S100U usb driver.
69 endef
70
71 define KernelPackage/zaptel14-wctdm
72 $(call KernelPackage/zaptel14/Default)
73 DEPENDS += +kmod-zaptel14
74 FILES:=$(PKG_BUILD_DIR)/kernel/wctdm.$(LINUX_KMOD_SUFFIX)
75 AUTOLOAD:=$(call AutoLoad,72,wctdm)
76 endef
77
78 define KernelPackage/zaptel14-wctdm/description
79 This package contains the Zaptel wctdm driver.
80 endef
81
82 define Package/zaptel14-util
83 $(call Package/zaptel14/Default)
84 SECTION:=utils
85 CATEGORY:=Utilities
86 TITLE+= utils
87 DEPENDS += +kmod-zaptel14 +zaptel14-libtonezone +libnewt
88 endef
89
90 define Package/zaptel14-util/description
91 This package contains the zaptel utils.
92 endef
93
94 define Package/zaptel14-libtonezone
95 $(call Package/zaptel14/Default)
96 SECTION:=libs
97 CATEGORY:=Libraries
98 TITLE+= libtonezone (library)
99 DEPENDS += +kmod-zaptel14
100 endef
101
102 define Package/zaptel14-libtonezone/description
103 This package contains the libraries for accessing zaptel/dummy drivers.
104 endef
105
106 CONFIGURE_VARS += \
107 LDFLAGS="$$$$LDFLAGS -Wl,-rpath-link $(STAGING_DIR)/usr/lib"
108
109 CONFIGURE_ARGS += \
110 --with-newt="$(STAGING_DIR)/usr" \
111 --without-curses \
112 --without-ncurses
113
114 MAKE_FLAGS:= \
115 ARCH="$(LINUX_KARCH)" \
116 CC="$(TARGET_CC) $(TARGET_CFLAGS)" \
117 LD="$(TARGET_CROSS)ld" \
118 CROSS_COMPILE="$(TARGET_CROSS)" \
119 KVERS="$(LINUX_VERSION)" \
120 KSRC="$(LINUX_DIR)" \
121 TOPDIR_MODULES="zaptel ztdummy wcusb wctdm" \
122 SUBDIR_MODULES=""
123
124 define Build/Compile/kmod
125 $(MAKE) -C $(PKG_BUILD_DIR) \
126 $(MAKE_FLAGS) \
127 modules
128 endef
129
130 define Build/Compile/user
131 $(MAKE) -C $(PKG_BUILD_DIR) \
132 ARCH="$(LINUX_KARCH)" \
133 DESTDIR="$(PKG_INSTALL_DIR)" \
134 AR="$(TARGET_CROSS)ar" \
135 RANLIB="$(TARGET_CROSS)ranlib" \
136 install-libs install-include zttest ztcfg zttool ztdiag fxotune ztmonitor ztscan ztspeed fxstest
137 endef
138
139 define Build/Compile
140 $(call Build/Compile/kmod)
141 $(call Build/Compile/user)
142 endef
143
144 define Build/InstallDev
145 $(INSTALL_DIR) $(STAGING_DIR)/usr/include
146 $(CP) $(PKG_INSTALL_DIR)/usr/include/zaptel $(STAGING_DIR)/usr/include/
147 $(INSTALL_DIR) $(STAGING_DIR)/usr/lib
148 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtonezone.* $(STAGING_DIR)/usr/lib/
149 endef
150
151 define Package/zaptel14-util/install
152 $(INSTALL_DIR) $(1)/usr/bin
153 $(INSTALL_BIN) $(PKG_BUILD_DIR)/zttest $(1)/usr/bin/
154 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ztcfg $(1)/usr/bin/
155 $(INSTALL_BIN) $(PKG_BUILD_DIR)/zttool $(1)/usr/bin/
156 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ztdiag $(1)/usr/bin/
157 $(INSTALL_BIN) $(PKG_BUILD_DIR)/fxotune $(1)/usr/bin/
158 $(INSTALL_BIN) $(PKG_BUILD_DIR)/fxstest $(1)/usr/bin/
159 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ztmonitor $(1)/usr/bin/
160 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ztscan $(1)/usr/bin/
161 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ztspeed $(1)/usr/bin/
162 $(INSTALL_DIR) $(1)/etc/hotplug.d/zaptel
163 $(INSTALL_DATA) ./files/10-create-device-node $(1)/etc/hotplug.d/zaptel/
164 endef
165
166 define Package/zaptel14-libtonezone/install
167 $(INSTALL_DIR) $(1)/usr/lib
168 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtonezone.so.* $(1)/usr/lib/
169 endef
170
171 $(eval $(call KernelPackage,zaptel14))
172 $(eval $(call KernelPackage,zaptel14-dummy))
173 $(eval $(call KernelPackage,zaptel14-wcusb))
174 $(eval $(call KernelPackage,zaptel14-wctdm))
175 $(eval $(call BuildPackage,zaptel14-util))
176 $(eval $(call BuildPackage,zaptel14-libtonezone))