baresip: update to 0.5.5
[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.5.5
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:=6418215c95bf4f983cf0a709557eacc8f3b38c0735be444aafc1d91653acfe5b
18
19 PKG_LICENSE:=BSD-3-Clause
20 PKG_LICENSE_FILES:=docs/COPYING
21 PKG_MAINTAINER:=Jiri Slachta <jiri@slachta.eu>
22
23 baresip-mods:= \
24 alsa \
25 avcodec \
26 avformat \
27 cons \
28 evdev \
29 g711 \
30 g722 \
31 g726 \
32 opus \
33 oss \
34 stdio \
35 v4l \
36 v4l2
37
38 PKG_CONFIG_DEPENDS:= \
39 $(patsubst %,CONFIG_PACKAGE_baresip-mod-%,$(baresip-mods)) \
40
41 include $(INCLUDE_DIR)/package.mk
42
43 define Package/baresip/Default
44 SECTION:=net
45 CATEGORY:=Network
46 SUBMENU:=Telephony
47 URL:=http://www.creytiv.com/
48 endef
49
50 define Package/baresip
51 $(call Package/baresip/Default)
52 TITLE:=Portable and modular SIP User-Agent with A/V support
53 DEPENDS:=+libre +librem +libpthread
54 MENU:=1
55 endef
56
57 baresip-mod-alsa := USE_ALSA
58 baresip-mod-avcodec := USE_AVCODEC
59 baresip-mod-avformat := USE_AVFORMAT
60 baresip-mod-cons := USE_CONS
61 baresip-mod-evdev := USE_EVDEV
62 baresip-mod-g711 := USE_G711
63 baresip-mod-g722 := USE_G722
64 baresip-mod-g726 := USE_G726
65 baresip-mod-opus := USE_OPUS
66 baresip-mod-oss := USE_OSS
67 baresip-mod-stdio := USE_STDIO
68 baresip-mod-v4l := USE_V4L
69 baresip-mod-v4l2 := USE_V4L2
70
71 BARESIP_MOD_OPTIONS:= \
72 MOD_AUTODETECT= \
73 EXTRA_MODULES="dtmfio" \
74 $(foreach m,$(baresip-mods),$(baresip-mod-$(m))=$(if $(CONFIG_PACKAGE_baresip-mod-$(m)),1))
75
76 TARGET_CFLAGS += $(FPIC) -D_GNU_SOURCE
77
78 define Build/Compile
79 $(MAKE) -C $(PKG_BUILD_DIR) \
80 LIBRE_MK="$(STAGING_DIR)/usr/share/re/re.mk" \
81 LIBRE_INC="$(STAGING_DIR)/usr/include/re" \
82 LIBRE_SO="$(STAGING_DIR)/usr/lib" \
83 LIBREM_PATH="../rem" \
84 CC="$(TARGET_CC)" \
85 DESTDIR="$(PKG_INSTALL_DIR)" \
86 EXTRA_CFLAGS="$(TARGET_CFLAGS) -DOPENWRT" \
87 SYSROOT="$$$$($(FIND) $(TOOLCHAIN_DIR) -path '*/include/pthread.h' | sed -ne '1s#/include/pthread.h##p')" \
88 SYSROOT_ALT="$(STAGING_DIR)/usr" \
89 RELEASE=1 \
90 CROSS_COMPILE="$(TARGET_CROSS)" \
91 OS="linux" \
92 $(BARESIP_MOD_OPTIONS) \
93 all install
94 endef
95
96 define Package/baresip/install
97 $(INSTALL_DIR) $(1)/usr/bin
98 $(CP) $(PKG_INSTALL_DIR)/usr/bin/baresip $(1)/usr/bin/
99 $(INSTALL_DIR) $(1)/usr/lib/baresip/modules
100 $(CP) \
101 $(PKG_INSTALL_DIR)/usr/lib/baresip/modules/{account,auloop,contact,ice,menu,stun,turn}.so \
102 $(1)/usr/lib/baresip/modules/.
103 $(INSTALL_DIR) $(1)/usr/share/baresip
104 $(CP) $(PKG_INSTALL_DIR)/usr/share/baresip/* $(1)/usr/share/baresip/.
105 $(INSTALL_DIR) $(1)/etc/init.d
106 $(INSTALL_BIN) ./files/baresip.init $(1)/etc/init.d/baresip
107 endef
108
109 ##################
110 # Baresip modules
111 # 1. Name
112 # 2. Title
113 # 3. Files
114 # 4. Dependencies
115 ##################
116
117 define BuildPlugin
118
119 define Package/baresip-mod-$(1)
120 $$(call Package/baresip/Default)
121 TITLE:= baresip $(2) module
122 DEPENDS:= baresip $(4)
123 endef
124
125 define Package/baresip-mod-$(1)/install
126 [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/usr/lib/baresip/modules
127 for f in $(3); do \
128 $(CP) \
129 $(PKG_INSTALL_DIR)/usr/lib/baresip/modules/$$$$$$$${f}.so \
130 $$(1)/usr/lib/baresip/modules/ ; \
131 done
132 endef
133
134 $$(eval $$(call BuildPackage,baresip-mod-$(1)))
135 endef
136
137 $(eval $(call BuildPackage,baresip))
138
139 $(eval $(call BuildPlugin,alsa,ALSA audio driver,alsa,+PACKAGE_baresip-mod-alsa:alsa-lib))
140 $(eval $(call BuildPlugin,avcodec,FFmpeg video codecs,avcodec,+PACKAGE_baresip-mod-avcodec:libffmpeg-full))
141 $(eval $(call BuildPlugin,avformat,FFmpeg video source,avformat,+PACKAGE_baresip-mod-avformat:libffmpeg-full))
142 $(eval $(call BuildPlugin,cons,console UI,cons,))
143 $(eval $(call BuildPlugin,dtmfio,DTMF input/output,dtmfio,))
144 $(eval $(call BuildPlugin,evdev,input event device UI,evdev,))
145 $(eval $(call BuildPlugin,g711,G.711 audio codec,g711,))
146 $(eval $(call BuildPlugin,g722,G.722 audio codec,g722,+PACKAGE_baresip-mod-g722:libspandsp))
147 $(eval $(call BuildPlugin,g726,G.726 audio codec,g726,+PACKAGE_baresip-mod-g726:libspandsp))
148 $(eval $(call BuildPlugin,httpd,Webserver UI module,httpd,))
149 $(eval $(call BuildPlugin,opus,Opus audio codec,opus,+PACKAGE_baresip-mod-opus:libopus))
150 $(eval $(call BuildPlugin,oss,OSS audio driver,oss,))
151 $(eval $(call BuildPlugin,stdio,standard I/O UI,stdio,))
152 $(eval $(call BuildPlugin,v4l,Video4Linux video source,v4l,+PACKAGE_baresip-mod-v4l:libv4l))
153 $(eval $(call BuildPlugin,v4l2,Video4Linux2 video source,v4l2,+PACKAGE_baresip-mod-v4l2:libv4l))