baresip: amend file permissions
[feed/telephony.git] / net / baresip / Makefile
1 #
2 # Copyright (C) 2010-2017 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.6.0
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_HASH:=ab3dd329599e4df83eeeb5451b42811598e0171a45a90b34006c5628b61d0764
18
19 PKG_LICENSE:=BSD-3-Clause
20 PKG_LICENSE_FILES:=docs/COPYING
21 PKG_MAINTAINER:=Jiri Slachta <jiri@slachta.eu>
22
23 PKG_INSTALL:=1
24
25 baresip-mods:= \
26 alsa \
27 avcodec \
28 avformat \
29 cons \
30 echo \
31 evdev \
32 g711 \
33 g722 \
34 g726 \
35 opus \
36 oss \
37 plc \
38 portaudio \
39 pulse \
40 rtcpsummary \
41 sndfile \
42 srtp \
43 stdio \
44 v4l \
45 v4l2
46
47 PKG_CONFIG_DEPENDS:= \
48 $(patsubst %,CONFIG_PACKAGE_baresip-mod-%,$(subst _,-,$(baresip-mods)))
49
50 include $(INCLUDE_DIR)/package.mk
51
52 define Package/$(PKG_NAME)/config
53 source "$(SOURCE)/Config.in"
54 endef
55
56 define Package/baresip/Default
57 SECTION:=net
58 CATEGORY:=Network
59 SUBMENU:=Telephony
60 URL:=http://www.creytiv.com
61 endef
62
63 define Package/baresip
64 $(call Package/baresip/Default)
65 TITLE:=Portable and modular SIP User-Agent with A/V support
66 DEPENDS:=+libre +librem
67 USERID:=$(PKG_NAME)=374:$(PKG_NAME)=374
68 MENU:=1
69 endef
70
71 baresip-mod-alsa := USE_ALSA
72 baresip-mod-avcodec := USE_AVCODEC
73 baresip-mod-avformat := USE_AVFORMAT
74 baresip-mod-cons := USE_CONS
75 baresip-mod-echo := USE_ECHO
76 baresip-mod-evdev := USE_EVDEV
77 baresip-mod-g711 := USE_G711
78 baresip-mod-g722 := USE_G722
79 baresip-mod-g726 := USE_G726
80 baresip-mod-opus := USE_OPUS
81 baresip-mod-oss := USE_OSS
82 baresip-mod-plc := USE_PLC
83 baresip-mod-portaudio := USE_PORTAUDIO
84 baresip-mod-pulse := USE_PULSE
85 baresip-mod-rtcpsummary := USE_RTCPSUMMARY
86 baresip-mod-sndfile := USE_SNDFILE
87 baresip-mod-srtp := USE_SRTP
88 baresip-mod-stdio := USE_STDIO
89 baresip-mod-v4l := USE_V4L
90 baresip-mod-v4l2 := USE_V4L2
91
92 BARESIP_MOD_OPTIONS:= \
93 MOD_AUTODETECT= \
94 EXTRA_MODULES="dtmfio" \
95 $(foreach m,$(baresip-mods),$(baresip-mod-$(m))=$(if $(CONFIG_PACKAGE_baresip-mod-$(subst _,-,$(m))),1))
96
97 # According to upstream baresip can use x264 directly or through ffmpeg. ffmpeg
98 # is preferred. The possibility to use it directly might even go away in the
99 # future. So prevent baresip from linking directly to x264.
100 MAKE_FLAGS+= \
101 CROSS_COMPILE="$(TARGET_CROSS)" \
102 EXTRA_LFLAGS="$(TARGET_LDFLAGS)" \
103 LD="$(TARGET_CC)" \
104 LIBRE_MK="$(STAGING_DIR)/usr/share/re/re.mk" \
105 LIBRE_INC="$(STAGING_DIR)/usr/include/re" \
106 LIBRE_SO="$(STAGING_DIR)/usr/lib" \
107 LIBREM_PATH="$(STAGING_DIR)/usr" \
108 OS=linux \
109 RELEASE=1 \
110 SYSROOT="$(shell $(FIND) $(TOOLCHAIN_DIR) -path '*/include/pthread.h' | sed -ne '1s|/include/pthread.h||p')" \
111 SYSROOT_ALT="$(STAGING_DIR)/usr" \
112 $(BARESIP_MOD_OPTIONS) \
113 USE_X264=
114
115 TARGET_CFLAGS+=-D_GNU_SOURCE
116
117 define Package/baresip/install
118 $(INSTALL_DIR) $(1)/usr/bin
119 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/baresip $(1)/usr/bin
120 $(INSTALL_DIR) $(1)/usr/lib/baresip/modules
121 $(INSTALL_DATA) \
122 $(PKG_INSTALL_DIR)/usr/lib/baresip/modules/{account,auloop,contact,ice,menu,stun,turn}.so \
123 $(1)/usr/lib/baresip/modules
124 $(INSTALL_DIR) $(1)/usr/share/baresip
125 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/baresip/* $(1)/usr/share/baresip
126 $(INSTALL_DIR) $(1)/etc/baresip
127 $(INSTALL_CONF) $(PKG_BUILD_DIR)/docs/examples/{accounts,config,contacts} $(1)/etc/baresip
128 $(INSTALL_DIR) $(1)/etc/default
129 $(INSTALL_CONF) ./files/baresip.default $(1)/etc/default/baresip
130 $(INSTALL_DIR) $(1)/etc/init.d
131 $(INSTALL_BIN) ./files/baresip.init $(1)/etc/init.d/baresip
132 endef
133
134 define Package/baresip/conffiles
135 /etc/baresip/accounts
136 /etc/baresip/config
137 /etc/baresip/contacts
138 /etc/default/baresip
139 /etc/init.d/baresip
140 endef
141
142 define Package/baresip/postinst
143 #!/bin/sh
144 if [ -z "$${IPKG_INSTROOT}" ]; then
145 chown $(PKG_NAME):$(PKG_NAME) \
146 /etc/baresip/accounts \
147 /etc/baresip/config \
148 /etc/baresip/contacts
149 fi
150 exit 0
151 endef
152
153 ##################
154 # bareSIP modules
155 # 1. Name
156 # 2. Title
157 # 3. Files
158 # 4. Dependencies
159 ##################
160
161 define BuildPlugin
162
163 define Package/baresip-mod-$(subst _,-,$(1))
164 $$(call Package/baresip/Default)
165 TITLE:=$(2)
166 DEPENDS:=baresip $(patsubst +%,+PACKAGE_$(PKG_NAME)-mod-$(subst _,-,$(1)):%,$(4))
167 endef
168
169 define Package/baresip-mod-$(subst _,-,$(1))/install
170 [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/usr/lib/baresip/modules
171 for f in $(3); do \
172 $(INSTALL_DATA) \
173 $(PKG_INSTALL_DIR)/usr/lib/baresip/modules/$$$$$$$${f}.so \
174 $$(1)/usr/lib/baresip/modules; \
175 done
176 endef
177
178 $$(eval $$(call BuildPackage,baresip-mod-$(subst _,-,$(1))))
179 endef
180
181 $(eval $(call BuildPackage,baresip))
182
183 $(eval $(call BuildPlugin,alsa,ALSA audio driver,alsa,+alsa-lib))
184 $(eval $(call BuildPlugin,aubridge,Audio bridge module,aubridge,))
185 $(eval $(call BuildPlugin,aufile,Audio module for using a WAV-file as audio input,aufile,))
186 $(eval $(call BuildPlugin,avcodec,Video codec using FFmpeg,avcodec,@BARESIP_WITH_FFMPEG +libffmpeg-full))
187 $(eval $(call BuildPlugin,avformat,Video source using FFmpeg,avformat,baresip-mod-avcodec))
188 $(eval $(call BuildPlugin,b2bua,Back-to-Back User-Agent module,b2bua,))
189 $(eval $(call BuildPlugin,cons,UDP/TCP console UI driver,cons,))
190 $(eval $(call BuildPlugin,ctrl_tcp,TCP control interface,ctrl_tcp,))
191 $(eval $(call BuildPlugin,debug_cmd,Debug commands,debug_cmd,))
192 $(eval $(call BuildPlugin,dtls_srtp,DTLS-SRTP end-to-end encryption,dtls_srtp,))
193 $(eval $(call BuildPlugin,dtmfio,DTMF input/output,dtmfio,))
194 $(eval $(call BuildPlugin,echo,Echo server module,echo,))
195 $(eval $(call BuildPlugin,evdev,Linux input driver,evdev,))
196 $(eval $(call BuildPlugin,fakevideo,Fake video input/output driver,fakevideo,))
197 $(eval $(call BuildPlugin,g711,G.711 audio codec,g711,))
198 $(eval $(call BuildPlugin,g722,G.722 audio codec,g722,+libspandsp))
199 $(eval $(call BuildPlugin,g726,G.726 audio codec,g726,+libspandsp))
200 $(eval $(call BuildPlugin,httpd,HTTP webserver UI-module,httpd,))
201 $(eval $(call BuildPlugin,mwi,Message Waiting Indication,mwi,))
202 $(eval $(call BuildPlugin,natbd,NAT Behavior Discovery Module,natbd,))
203 $(eval $(call BuildPlugin,natpmp,NAT Port Mapping Protocol module,natpmp,))
204 $(eval $(call BuildPlugin,opus,OPUS Interactive audio codec,opus,+libopus))
205 $(eval $(call BuildPlugin,oss,OSS audio driver,oss,))
206 $(eval $(call BuildPlugin,plc,Packet Loss Concealment,plc,+libspandsp))
207 $(eval $(call BuildPlugin,portaudio,Portaudio audio driver,portaudio,+portaudio))
208 $(eval $(call BuildPlugin,presence,Presence module,presence,))
209 $(eval $(call BuildPlugin,pulse,Pulseaudio audio driver,pulse,+pulseaudio))
210 $(eval $(call BuildPlugin,rtcpsummary,RTCP summary module,rtcpsummary,))
211 $(eval $(call BuildPlugin,selfview,Video selfview module,selfview,))
212 $(eval $(call BuildPlugin,sndfile,Audio dumper using libsndfile,sndfile,+libsndfile))
213 $(eval $(call BuildPlugin,srtp,Secure RTP module using libre,srtp,))
214 $(eval $(call BuildPlugin,stdio,Standard input/output UI driver,stdio,))
215 $(eval $(call BuildPlugin,uuid,UUID generator and loader,uuid,))
216 $(eval $(call BuildPlugin,v4l,Video4Linux video source,v4l,+libv4l))
217 $(eval $(call BuildPlugin,v4l2,Video4Linux2 video source,v4l2,+libv4l))
218 $(eval $(call BuildPlugin,v4l2_codec,Video4Linux2 video codec module,v4l2_codec,))
219 $(eval $(call BuildPlugin,vidbridge,Video bridge module,vidbridge,))
220 $(eval $(call BuildPlugin,vidloop,Video-loop test module,vidloop,))
221 $(eval $(call BuildPlugin,vumeter,Display audio levels in console,vumeter,))