baresip: closing #56, added modules speex-aec, speex-pp, httpd.
[feed/telephony.git] / net / baresip / Makefile
1 #
2 # Copyright (C) 2010-2014 OpenWrt.org
3 # Copyright (C) 2010 Alfred E. Heggestad
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=baresip
12 PKG_VERSION:=0.4.12
13 PKG_RELEASE:=3
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://www.creytiv.com/pub/
17 PKG_MD5SUM:=93c0ea33ec0e96b89b1c3e0f78b72c5b
18
19 PKG_LICENSE:=BSD-3-Clause
20 PKG_LICENSE_FILES:=docs/COPYING
21 PKG_MAINTAINER:=Jiri Slachta <slachta@cesnet.cz>
22
23 baresip-mods:= \
24 alsa \
25 avcodec \
26 avformat \
27 cons \
28 evdev \
29 g711 \
30 g722 \
31 g726 \
32 oss \
33 speex \
34 speex-aec \
35 speex-pp \
36 stdio \
37 uuid \
38 v4l \
39 v4l2 \
40
41 PKG_CONFIG_DEPENDS:= \
42 $(patsubst %,CONFIG_PACKAGE_baresip-mod-%,$(baresip-mods)) \
43
44 include $(INCLUDE_DIR)/package.mk
45
46 define Package/baresip/Default
47 SECTION:=net
48 CATEGORY:=Network
49 SUBMENU:=Telephony
50 URL:=http://www.creytiv.com/
51 endef
52
53 define Package/baresip
54 $(call Package/baresip/Default)
55 TITLE:=Portable and modular SIP User-Agent with A/V support
56 DEPENDS:=+libre +librem +libpthread
57 MENU:=1
58 endef
59
60 baresip-mod-alsa := USE_ALSA
61 baresip-mod-avcodec := USE_AVCODEC
62 baresip-mod-avformat := USE_AVFORMAT
63 baresip-mod-cons := USE_CONS
64 baresip-mod-evdev := USE_EVDEV
65 baresip-mod-g711 := USE_G711
66 baresip-mod-g722 := USE_G722
67 baresip-mod-g726 := USE_G726
68 baresip-mod-oss := USE_OSS
69 baresip-mod-speex := USE_SPEEX
70 baresip-mod-speex-aec := USE_SPEEX_AEC
71 baresip-mod-speex-pp := USE_SPEEX_PP
72 baresip-mod-stdio := USE_STDIO
73 baresip-mod-uuid := USE_UUID
74 baresip-mod-v4l := USE_V4L
75 baresip-mod-v4l2 := USE_V4L2
76
77 BARESIP_MOD_OPTIONS:= \
78 MOD_AUTODETECT= \
79 $(foreach m,$(baresip-mods),$(baresip-mod-$(m))=$(if $(CONFIG_PACKAGE_baresip-mod-$(m)),1))
80
81 TARGET_CFLAGS += $(FPIC)
82
83 define Build/Compile
84 $(MAKE) -C $(PKG_BUILD_DIR) \
85 LIBRE_MK="$(STAGING_DIR)/usr/share/re/re.mk" \
86 LIBRE_INC="$(STAGING_DIR)/usr/include/re" \
87 LIBRE_SO="$(STAGING_DIR)/usr/lib" \
88 LIBREM_PATH="../rem" \
89 CC="$(TARGET_CC)" \
90 DESTDIR="$(PKG_INSTALL_DIR)" \
91 EXTRA_CFLAGS="$(TARGET_CFLAGS) -DOPENWRT" \
92 SYSROOT="$$$$($(FIND) $(TOOLCHAIN_DIR) -path '*/include/pthread.h' | sed -ne '1s#/include/pthread.h##p')" \
93 SYSROOT_ALT="$(STAGING_DIR)/usr" \
94 RELEASE=1 \
95 CROSS_COMPILE="$(TARGET_CROSS)" \
96 OS="linux" \
97 $(BARESIP_MOD_OPTIONS) \
98 all install
99 endef
100
101 define Package/baresip/install
102 $(INSTALL_DIR) $(1)/usr/bin
103 $(CP) $(PKG_INSTALL_DIR)/usr/bin/baresip $(1)/usr/bin/
104 $(INSTALL_DIR) $(1)/usr/lib/baresip/modules
105 $(CP) \
106 $(PKG_INSTALL_DIR)/usr/lib/baresip/modules/{account,auloop,contact,ice,menu,stun,turn}.so \
107 $(1)/usr/lib/baresip/modules/.
108 $(INSTALL_DIR) $(1)/usr/share/baresip
109 $(CP) $(PKG_INSTALL_DIR)/usr/share/baresip/* $(1)/usr/share/baresip/.
110 $(INSTALL_DIR) $(1)/etc/init.d
111 $(INSTALL_BIN) ./files/baresip.init $(1)/etc/init.d/baresip
112 endef
113
114 ##################
115 # Baresip modules
116 # 1. Name
117 # 2. Title
118 # 3. Files
119 # 4. Dependencies
120 ##################
121
122 define BuildPlugin
123
124 define Package/baresip-mod-$(1)
125 $$(call Package/baresip/Default)
126 TITLE:= baresip $(2) module
127 DEPENDS:= baresip $(4)
128 endef
129
130 define Package/baresip-mod-$(1)/install
131 [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/usr/lib/baresip/modules
132 for f in $(3); do \
133 $(CP) \
134 $(PKG_INSTALL_DIR)/usr/lib/baresip/modules/$$$$$$$${f}.so \
135 $$(1)/usr/lib/baresip/modules/ ; \
136 done
137 endef
138
139 $$(eval $$(call BuildPackage,baresip-mod-$(1)))
140 endef
141
142 $(eval $(call BuildPackage,baresip))
143
144 $(eval $(call BuildPlugin,alsa,ALSA audio driver,alsa,+PACKAGE_baresip-mod-alsa:alsa-lib))
145 $(eval $(call BuildPlugin,avcodec,FFmpeg video codecs,avcodec,+PACKAGE_baresip-mod-avcodec:libffmpeg-full))
146 $(eval $(call BuildPlugin,avformat,FFmpeg video source,avformat,+PACKAGE_baresip-mod-avformat:libffmpeg-full))
147 $(eval $(call BuildPlugin,cons,console UI,cons,))
148 $(eval $(call BuildPlugin,evdev,input event device UI,evdev,))
149 $(eval $(call BuildPlugin,g711,G.711 audio codec,g711,))
150 $(eval $(call BuildPlugin,g722,G.722 audio codec,g722,+PACKAGE_baresip-mod-g722:libspandsp))
151 $(eval $(call BuildPlugin,g726,G.726 audio codec,g726,+PACKAGE_baresip-mod-g726:libspandsp))
152 $(eval $(call BuildPlugin,httpd,Webserver UI module,httpd,))
153 $(eval $(call BuildPlugin,oss,OSS audio driver,oss,))
154 $(eval $(call BuildPlugin,speex,Speex audio codec,speex,+PACKAGE_baresip-mod-speex:libspeex))
155 $(eval $(call BuildPlugin,speex-aec,Speex Acoustic Echo Cancellation,speex_aec,+PACKAGE_baresip-mod-speex-aec:libspeex))
156 $(eval $(call BuildPlugin,speex-pp,Speex Pre-processor,speex_pp,+PACKAGE_baresip-mod-speex-pp:libspeex))
157 $(eval $(call BuildPlugin,stdio,standard I/O UI,stdio,))
158 $(eval $(call BuildPlugin,uuid,UUID,uuid,+libuuid))
159 $(eval $(call BuildPlugin,v4l,Video4Linux video source,v4l,+PACKAGE_baresip-mod-v4l:libv4l))
160 $(eval $(call BuildPlugin,v4l2,Video4Linux2 video source,v4l2,+PACKAGE_baresip-mod-v4l2:libv4l))