efa67068afde56026610bd739bf79e599bf70fb0
[feed/telephony.git] / net / baresip / Makefile
1 #
2 # Copyright (C) 2010-2016 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.19
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://www.creytiv.com/pub/
17 PKG_MD5SUM:=18260d41b608dcc9c637a18749c8759c
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 v4l \
38 v4l2
39
40 PKG_CONFIG_DEPENDS:= \
41 $(patsubst %,CONFIG_PACKAGE_baresip-mod-%,$(baresip-mods)) \
42
43 include $(INCLUDE_DIR)/package.mk
44
45 define Package/baresip/Default
46 SECTION:=net
47 CATEGORY:=Network
48 SUBMENU:=Telephony
49 URL:=http://www.creytiv.com/
50 endef
51
52 define Package/baresip
53 $(call Package/baresip/Default)
54 TITLE:=Portable and modular SIP User-Agent with A/V support
55 DEPENDS:=+libre +librem +libpthread
56 MENU:=1
57 endef
58
59 baresip-mod-alsa := USE_ALSA
60 baresip-mod-avcodec := USE_AVCODEC
61 baresip-mod-avformat := USE_AVFORMAT
62 baresip-mod-cons := USE_CONS
63 baresip-mod-evdev := USE_EVDEV
64 baresip-mod-g711 := USE_G711
65 baresip-mod-g722 := USE_G722
66 baresip-mod-g726 := USE_G726
67 baresip-mod-oss := USE_OSS
68 baresip-mod-speex := USE_SPEEX
69 baresip-mod-speex-aec := USE_SPEEX_AEC
70 baresip-mod-speex-pp := USE_SPEEX_PP
71 baresip-mod-stdio := USE_STDIO
72 baresip-mod-v4l := USE_V4L
73 baresip-mod-v4l2 := USE_V4L2
74
75 BARESIP_MOD_OPTIONS:= \
76 MOD_AUTODETECT= \
77 EXTRA_MODULES="dtmfio" \
78 $(foreach m,$(baresip-mods),$(baresip-mod-$(m))=$(if $(CONFIG_PACKAGE_baresip-mod-$(m)),1))
79
80 TARGET_CFLAGS += $(FPIC)
81
82 define Build/Compile
83 $(MAKE) -C $(PKG_BUILD_DIR) \
84 LIBRE_MK="$(STAGING_DIR)/usr/share/re/re.mk" \
85 LIBRE_INC="$(STAGING_DIR)/usr/include/re" \
86 LIBRE_SO="$(STAGING_DIR)/usr/lib" \
87 LIBREM_PATH="../rem" \
88 CC="$(TARGET_CC)" \
89 DESTDIR="$(PKG_INSTALL_DIR)" \
90 EXTRA_CFLAGS="$(TARGET_CFLAGS) -DOPENWRT" \
91 SYSROOT="$$$$($(FIND) $(TOOLCHAIN_DIR) -path '*/include/pthread.h' | sed -ne '1s#/include/pthread.h##p')" \
92 SYSROOT_ALT="$(STAGING_DIR)/usr" \
93 RELEASE=1 \
94 CROSS_COMPILE="$(TARGET_CROSS)" \
95 OS="linux" \
96 $(BARESIP_MOD_OPTIONS) \
97 all install
98 endef
99
100 define Package/baresip/install
101 $(INSTALL_DIR) $(1)/usr/bin
102 $(CP) $(PKG_INSTALL_DIR)/usr/bin/baresip $(1)/usr/bin/
103 $(INSTALL_DIR) $(1)/usr/lib/baresip/modules
104 $(CP) \
105 $(PKG_INSTALL_DIR)/usr/lib/baresip/modules/{account,auloop,contact,ice,menu,stun,turn}.so \
106 $(1)/usr/lib/baresip/modules/.
107 $(INSTALL_DIR) $(1)/usr/share/baresip
108 $(CP) $(PKG_INSTALL_DIR)/usr/share/baresip/* $(1)/usr/share/baresip/.
109 $(INSTALL_DIR) $(1)/etc/init.d
110 $(INSTALL_BIN) ./files/baresip.init $(1)/etc/init.d/baresip
111 endef
112
113 ##################
114 # Baresip modules
115 # 1. Name
116 # 2. Title
117 # 3. Files
118 # 4. Dependencies
119 ##################
120
121 define BuildPlugin
122
123 define Package/baresip-mod-$(1)
124 $$(call Package/baresip/Default)
125 TITLE:= baresip $(2) module
126 DEPENDS:= baresip $(4)
127 endef
128
129 define Package/baresip-mod-$(1)/install
130 [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/usr/lib/baresip/modules
131 for f in $(3); do \
132 $(CP) \
133 $(PKG_INSTALL_DIR)/usr/lib/baresip/modules/$$$$$$$${f}.so \
134 $$(1)/usr/lib/baresip/modules/ ; \
135 done
136 endef
137
138 $$(eval $$(call BuildPackage,baresip-mod-$(1)))
139 endef
140
141 $(eval $(call BuildPackage,baresip))
142
143 $(eval $(call BuildPlugin,alsa,ALSA audio driver,alsa,+PACKAGE_baresip-mod-alsa:alsa-lib))
144 $(eval $(call BuildPlugin,avcodec,FFmpeg video codecs,avcodec,+PACKAGE_baresip-mod-avcodec:libffmpeg-full))
145 $(eval $(call BuildPlugin,avformat,FFmpeg video source,avformat,+PACKAGE_baresip-mod-avformat:libffmpeg-full))
146 $(eval $(call BuildPlugin,cons,console UI,cons,))
147 $(eval $(call BuildPlugin,dtmfio,DTMF input/output,dtmfio,))
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,v4l,Video4Linux video source,v4l,+PACKAGE_baresip-mod-v4l:libv4l))
159 $(eval $(call BuildPlugin,v4l2,Video4Linux2 video source,v4l2,+PACKAGE_baresip-mod-v4l2:libv4l))