replace lots of manual install commands with INSTALL_* variables
[packages.git] / net / openser / 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 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=openser
12 PKG_VERSION:=1.0.1
13 PKG_RELEASE:=1
14 PKG_MD5SUM:=eebc16665003ee92daf96b216d6f9563
15 # PKG_VARIANT:=-tls # for tls version
16 PKG_VARIANT:=
17
18 PKG_SOURCE_URL:=http://openser.org/pub/openser/$(PKG_VERSION)/src
19 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)$(PKG_VARIANT)_src.tar.gz
20 PKG_CAT:=zcat
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
23 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
24
25 include $(INCLUDE_DIR)/package.mk
26
27 define Package/openser
28   SECTION:=net
29   CATEGORY:=Network
30   TITLE:=Configurable, free SIP server
31   URL:=http://www.openser.org
32   MENU:=1
33 endef
34
35 define Package/openser/conffiles
36 /etc/openser/openser.cfg
37 endef
38
39 define Package/openser-mod-acc
40   SECTION:=net
41   CATEGORY:=Network
42   DEPENDS:=openser
43   TITLE:=Accounting support
44   MENU:=0
45 endef
46
47 define Package/openser-mod-auth
48   SECTION:=net
49   CATEGORY:=Network
50   DEPENDS:=openser
51   TITLE:=Authentication support
52 endef
53
54 define Package/openser-mod-auth-db
55   SECTION:=net
56   CATEGORY:=Network
57   DEPENDS:=openser
58   TITLE:=Authentication with database support
59 endef
60
61 define Package/openser-mod-auth-radius
62   SECTION:=net
63   CATEGORY:=Network
64   DEPENDS:=openser +libradiusclient-ng
65   TITLE:=Authentication with RADIUS support
66 endef
67
68 define Package/openser-mod-avp-radius
69   SECTION:=net
70   CATEGORY:=Network
71   DEPENDS:=openser +libradiusclient-ng
72   TITLE:=AVP with RADIUS support
73 endef
74
75 define Package/openser-mod-avpops
76   SECTION:=net
77   CATEGORY:=Network
78   DEPENDS:=openser
79   TITLE:=AVP options support
80 endef
81
82 define Package/openser-mod-dispatcher
83   SECTION:=net
84   CATEGORY:=Network
85   DEPENDS:=openser
86   TITLE:=Dispatcher support
87 endef
88
89 define Package/openser-mod-diversion
90   SECTION:=net
91   CATEGORY:=Network
92   DEPENDS:=openser
93   TITLE:=Diversion support
94 endef
95
96 define Package/openser-mod-flatstore
97   SECTION:=net
98   CATEGORY:=Network
99   DEPENDS:=openser
100   TITLE:=Flatstore support
101 endef
102
103 define Package/openser-mod-gflags
104   SECTION:=net
105   CATEGORY:=Network
106   DEPENDS:=openser
107   TITLE:=Gflags support
108 endef
109
110 define Package/openser-mod-group
111   SECTION:=net
112   CATEGORY:=Network
113   DEPENDS:=openser
114   TITLE:=Group support
115 endef
116
117 define Package/openser-mod-group-radius
118   SECTION:=net
119   CATEGORY:=Network
120   DEPENDS:=openser +libradiusclient-ng
121   TITLE:=Group with RADIUS support
122 endef
123
124 define Package/openser-mod-lcr
125   SECTION:=net
126   CATEGORY:=Network
127   DEPENDS:=openser openser-mod-mysql
128   TITLE:=Least Cost Routing support
129 endef
130
131 define Package/openser-mod-mediaproxy
132   SECTION:=net
133   CATEGORY:=Network
134   DEPENDS:=openser
135   TITLE:=Mediaproxy support
136 endef
137
138 define Package/openser-mod-msilo
139   SECTION:=net
140   CATEGORY:=Network
141   DEPENDS:=openser
142   TITLE:=MSilo support
143 endef
144
145 define Package/openser-mod-mysql
146   SECTION:=net
147   CATEGORY:=Network
148   DEPENDS:=openser +libmysqlclient
149   TITLE:=MySQL support
150 endef
151
152 define Package/openser-mod-nathelper
153   SECTION:=net
154   CATEGORY:=Network
155   DEPENDS:=openser
156   TITLE:=NAT helper support
157 endef
158
159 define Package/openser-mod-options
160   SECTION:=net
161   CATEGORY:=Network
162   DEPENDS:=openser
163   TITLE:=Options support
164 endef
165
166 define Package/openser-mod-pdt
167   SECTION:=net
168   CATEGORY:=Network
169   DEPENDS:=openser
170   TITLE:=PDT support
171 endef
172
173 define Package/openser-mod-permissions
174   SECTION:=net
175   CATEGORY:=Network
176   DEPENDS:=openser
177   TITLE:=Permissions support
178 endef
179
180 define Package/openser-mod-pike
181   SECTION:=net
182   CATEGORY:=Network
183   DEPENDS:=openser
184   TITLE:=PIKE support
185 endef
186
187 define Package/openser-mod-sms
188   SECTION:=net
189   CATEGORY:=Network
190   DEPENDS:=openser
191   TITLE:=SMS support
192 endef
193
194 define Package/openser-mod-speeddial
195   SECTION:=net
196   CATEGORY:=Network
197   DEPENDS:=openser
198   TITLE:=Speeddial supporte
199 endef
200
201 define Package/openser-mod-uac
202   SECTION:=net
203   CATEGORY:=Network
204   DEPENDS:=openser
205   TITLE:=UAC support
206 endef
207
208 define Package/openser-mod-uac-redirect
209   SECTION:=net
210   CATEGORY:=Network
211   DEPENDS:=openser
212   TITLE:=UAC with redirect support
213 endef
214
215 define Package/openser-mod-uri
216   SECTION:=net
217   CATEGORY:=Network
218   DEPENDS:=openser
219   TITLE:=URI support
220 endef
221
222 define Package/openser-mod-uri-db
223   SECTION:=net
224   CATEGORY:=Network
225   DEPENDS:=openser +openser-mod-mysql
226   TITLE:=URI with database support
227 endef
228
229 define Package/openser-mod-uri-radius
230   SECTION:=net
231   CATEGORY:=Network
232   DEPENDS:=openser +libradiusclient-ng
233   TITLE:=URI with RADIUS support
234 endef
235
236 define Package/openser-mod-xlog
237   SECTION:=net
238   CATEGORY:=Network
239   DEPENDS:=openser
240   TITLE:=Advanced logging support
241 endef
242
243 # Select here the modules for the ipk package
244 OPENSER_MODULES := sl tm rr maxfwd usrloc registrar dbtext textops exec
245
246 OPENSER_MODULE_FILES := $(foreach module,$(OPENSER_MODULES),modules/$(module)/$(module).so)
247 OPENSER_MODULES := $(patsubst %,modules/%,$(OPENSER_MODULES))
248
249 define Build/Compile    
250         $(MAKE) -C $(PKG_BUILD_DIR) \
251                 prefix=/ \
252                 extra_defs="-DUSE_PTHREAD_MUTEX "  \
253                 CC="$(TARGET_CC)" \
254                 ARCH="$(ARCH)"  \
255                 CFLAGS="$(TARGET_CFLAGS)" \
256                 LOCALBASE="$(STAGING_DIR)/usr" \
257                 all utils/gen_ha1/gen_ha1
258 endef
259
260 define Package/openser/install  
261         mkdir -p $(1)/usr/sbin
262         $(CP) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
263         $(CP) $(PKG_BUILD_DIR)/utils/gen_ha1/gen_ha1 $(1)/usr/sbin/openser_gen_ha1
264         $(CP) $(PKG_BUILD_DIR)/scripts/sc $(1)/usr/sbin/openserctl
265         chmod 744 $(1)/usr/sbin/openserctl
266         $(CP) $(PKG_BUILD_DIR)/scripts/sc.dbtext $(1)/usr/sbin/dbtextctl
267         chmod 744 $(1)/usr/sbin/dbtextctl
268         mkdir -p $(1)/usr/lib/openser/modules
269         (cd $(PKG_BUILD_DIR);\
270                 $(CP) $(OPENSER_MODULE_FILES) $(1)/usr/lib/openser/modules/; \
271         )
272         mkdir -p $(1)/etc/openser
273         $(CP) $(PKG_BUILD_DIR)/etc/openser.cfg $(1)/etc/openser/
274 endef
275
276 define BuildPlugin
277   define Package/$(1)/install
278         [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/openser/modules/
279         $(CP) $(PKG_BUILD_DIR)/modules/$(2)/$(2).so \
280                         $$(1)/usr/lib/openser/modules/ ;
281   endef
282
283   $$(eval $$(call BuildPackage,$(1)))
284 endef
285
286 $(eval $(call BuildPackage,openser))
287 $(eval $(call BuildPlugin,openser-mod-acc,acc))
288 $(eval $(call BuildPlugin,openser-mod-auth,auth))
289 $(eval $(call BuildPlugin,openser-mod-auth-db,auth_db))
290 $(eval $(call BuildPlugin,openser-mod-auth-radius,auth_radius))
291 $(eval $(call BuildPlugin,openser-mod-avp-radius,avp_radius))
292 $(eval $(call BuildPlugin,openser-mod-avpops,avpops))
293 $(eval $(call BuildPlugin,openser-mod-dispatcher,dispatcher))
294 $(eval $(call BuildPlugin,openser-mod-diversion,diversion))
295 $(eval $(call BuildPlugin,openser-mod-flatstore,flatstore))
296 $(eval $(call BuildPlugin,openser-mod-gflags,gflags))
297 $(eval $(call BuildPlugin,openser-mod-group,group))
298 $(eval $(call BuildPlugin,openser-mod-group-radius,group_radius))
299 $(eval $(call BuildPlugin,openser-mod-lcr,lcr))
300 $(eval $(call BuildPlugin,openser-mod-mediaproxy,mediaproxy))
301 $(eval $(call BuildPlugin,openser-mod-msilo,msilo))
302 $(eval $(call BuildPlugin,openser-mod-mysql,mysql))
303 $(eval $(call BuildPlugin,openser-mod-nathelper,nathelper))
304 $(eval $(call BuildPlugin,openser-mod-options,options))
305 $(eval $(call BuildPlugin,openser-mod-pdt,pdt))
306 $(eval $(call BuildPlugin,openser-mod-permissions,permissions))
307 $(eval $(call BuildPlugin,openser-mod-pike,pike))
308 $(eval $(call BuildPlugin,openser-mod-sms,sms))
309 $(eval $(call BuildPlugin,openser-mod-speeddial,speeddial))
310 $(eval $(call BuildPlugin,openser-mod-uac,uac))
311 $(eval $(call BuildPlugin,openser-mod-uac-redirect,uac_redirect))
312 $(eval $(call BuildPlugin,openser-mod-uri,uri))
313 $(eval $(call BuildPlugin,openser-mod-uri-db,uri_db))
314 $(eval $(call BuildPlugin,openser-mod-uri-radius,uri_radius))
315 $(eval $(call BuildPlugin,openser-mod-xlog,xlog))