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