2 # Copyright (C) 2020 Sebastian Kemper <sebastian_ml@gmx.net>
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
9 include $(INCLUDE_DIR
)/kernel.mk
15 PKG_SOURCE
:=$(PKG_NAME
)-mr
$(PKG_VERSION
).
tar.gz
16 PKG_SOURCE_URL
:=https
://codeload.github.com
/sipwise
/rtpengine
/tar.gz
/mr
$(PKG_VERSION
)?
17 PKG_HASH
:=6f6d5cc2ebf27b6361ed2bd2f86a0ca74103503fd1a14af69ed423dba8340bc4
19 PKG_BUILD_DIR
:=$(BUILD_DIR
)/$(PKG_NAME
)-$(BUILD_VARIANT
)/$(PKG_NAME
)-mr
$(PKG_VERSION
)
22 PKG_LICENSE_FILES
:=LICENSE
24 PKG_MAINTAINER
:=Sebastian Kemper
<sebastian_ml@gmx.net
>
26 # When building in parallel, some files (like streambuf.c or dtmflib.c)
27 # are generated multiple times by the rtpengine build system.
28 # Intermittently they then contain garbage, leading to redefinition
32 PKG_BUILD_DEPENDS
:=gperf
/host perl
/host
34 # With below variable set, $(PKG_SYMVERS_DIR)/rtpengine.symvers gets generated
35 # from kernel-module/Module.symvers.
36 PKG_EXTMOD_SUBDIRS
:=kernel-module
38 include $(INCLUDE_DIR
)/package.mk
39 include $(INCLUDE_DIR
)/nls.mk
52 +libwebsockets-openssl \
56 ENGINE_DEPENDS_TRANSCODING
:= \
63 RECORDING_DEPENDS
:= \
71 RTPENGINE_GROUPID
:=$(RTPENGINE_USERID
)
72 RTPENGINE_USER
:=$(PKG_NAME
)=$(RTPENGINE_USERID
):$(PKG_NAME
)=$(RTPENGINE_GROUPID
)
74 define Package
/rtpengine
/Default
75 URL
:=https
://github.com
/sipwise
/rtpengine
78 define Package
/rtpengine
/Template
79 $(call Package
/rtpengine
/Default
)
80 TITLE
:=Sipwise RTP Engine
84 USERID
:=$(RTPENGINE_USER
)
87 define Package
/rtpengine
/description
/Template
88 The Sipwise NGCP rtpengine is a proxy for RTP traffic and other UDP
89 based media traffic. It
's meant to be used with the Kamailio SIP proxy
90 and forms a drop-in replacement for any of the other available RTP and
94 define Package/rtpengine
95 $(call Package/rtpengine/Template)
98 $(patsubst +%,+PACKAGE_rtpengine:%,$(ENGINE_DEPENDS_TRANSCODING)) \
102 define Package/rtpengine/conffiles
103 /etc/config/rtpengine
104 /etc/init.d/rtpengine
105 /etc/rtpengine/rtpengine.conf
108 define Package/rtpengine/description
109 $(call Package/rtpengine/description/Template)
111 Please consider installing kmod-ipt-rtpengine.
115 define Package/rtpengine/install
116 $(INSTALL_DIR) $(1)/usr/bin
117 $(INSTALL_BIN) $(PKG_BUILD_DIR)/daemon/rtpengine $(1)/usr/bin
119 $(INSTALL_DIR) $(1)/etc/init.d
120 $(INSTALL_BIN) ./files/rtpengine.init $(1)/etc/init.d/rtpengine
122 $(INSTALL_DIR) $(1)/etc/config
123 $(INSTALL_CONF) ./files/rtpengine.conf $(1)/etc/config/rtpengine
125 $(INSTALL_DIR) $(1)/etc/rtpengine
126 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/rtpengine.conf \
127 $(1)/etc/rtpengine/rtpengine.conf
129 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
130 $(INSTALL_BIN) ./files/rtpengine.hotplug \
131 $(1)/etc/hotplug.d/iface/90-rtpengine
134 define Package/rtpengine-no-transcode
135 $(call Package/rtpengine/Template)
136 TITLE+= (no transcoding)
137 VARIANT:=no-transcode
140 $(patsubst +%,+PACKAGE_rtpengine-no-transcode:%,$(ENGINE_DEPENDS)) \
144 Package/rtpengine-no-transcode/conffiles=$(Package/rtpengine/conffiles)
146 define Package/rtpengine-no-transcode/description
147 $(call Package/rtpengine/description/Template)
149 This package comes without transcoding support.
151 Please consider installing kmod-ipt-rtpengine.
155 Package/rtpengine-no-transcode/install=$(Package/rtpengine/install)
157 define Package/rtpengine-recording
158 $(call Package/rtpengine/Default)
159 TITLE:=Sipwise RTP Recording Daemon
163 USERID:=$(RTPENGINE_USER)
164 DEPENDS:=$(patsubst +%,+PACKAGE_rtpengine-recording:%,$(RECORDING_DEPENDS))
167 define Package/rtpengine-recording/conffiles
168 /etc/config/rtpengine-recording
169 /etc/rtpengine/rtpengine-recording.conf
172 define Package/rtpengine-recording/install
173 $(INSTALL_DIR) $(1)/usr/bin
175 $(PKG_BUILD_DIR)/recording-daemon/rtpengine-recording \
178 $(INSTALL_DIR) $(1)/etc/init.d
179 $(INSTALL_BIN) ./files/rtpengine-recording.init \
180 $(1)/etc/init.d/rtpengine-recording
182 $(INSTALL_DIR) $(1)/etc/config
183 $(INSTALL_CONF) ./files/rtpengine-recording.conf \
184 $(1)/etc/config/rtpengine-recording
186 $(INSTALL_DIR) $(1)/etc/rtpengine
187 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/rtpengine-recording.conf \
188 $(1)/etc/rtpengine/rtpengine-recording.conf
191 define Package/iptables-mod-rtpengine
192 $(call Package/rtpengine/Default)
193 TITLE:=Sipwise rtpengine iptables extension
197 DEPENDS:=+PACKAGE_iptables-mod-rtpengine:libxtables
200 define Package/iptables-mod-rtpengine/install
201 $(INSTALL_DIR) $(1)/usr/lib/iptables
203 $(PKG_BUILD_DIR)/iptables-extension/libxt_RTPENGINE.so \
204 $(1)/usr/lib/iptables
207 define KernelPackage/ipt-rtpengine
208 $(call Package/rtpengine/Default)
209 TITLE:=Sipwise rtpengine netfilter module
210 SUBMENU:=Netfilter Extensions
211 FILES:=$(PKG_BUILD_DIR)/kernel-module/xt_RTPENGINE.$(LINUX_KMOD_SUFFIX)
212 AUTOLOAD:=$(call AutoProbe,xt_RTPENGINE)
214 +PACKAGE_kmod-ipt-rtpengine:kmod-crypto-aead \
215 +PACKAGE_kmod-ipt-rtpengine:kmod-crypto-hash \
216 +PACKAGE_kmod-ipt-rtpengine:kmod-ipt-core
217 MODPARAMS.xt_RTPENGINE := \
218 proc_uid=$(RTPENGINE_USERID) \
219 proc_gid=$(RTPENGINE_GROUPID)
220 USERID:=$(RTPENGINE_USER)
223 define KernelPackage/ipt-rtpengine/conffiles
224 /etc/modules.d/ipt-rtpengine
227 define KernelPackage/ipt-rtpengine/description
228 Netfilter kernel module for rtpengine
232 MAKE_VARS+=RTPENGINE_VERSION=$(PKG_VERSION)
234 ifeq ($(BUILD_VARIANT),no-transcode)
235 MAKE_VARS+=with_transcoding=no
238 # rtpengine uses Debian's dpkg utility programs if it can find them. But
239 # we don't want build host flags to leak into our cross-compile.
241 $(call Build
/Prepare
/Default
)
243 cd
"$(PKG_BUILD_DIR)" && \
244 $(FIND
) .
-maxdepth
2 -name
"*Makefile" | \
246 '/shell which dpkg-/s/dpkg/OpenWrt-has-no-dpkg/' {} && \
247 $(SED
) 's|#!/usr/bin/perl|#!$(STAGING_DIR_HOSTPKG)/usr/bin/perl|' \
252 define Build
/Configure
257 ifneq ($(CONFIG_PACKAGE_kmod-ipt-rtpengine
),)
258 RTPENGINE_VERSION
=$(PKG_VERSION
) $(MAKE
) \
260 -C
$(PKG_BUILD_DIR
)/kernel-module \
265 ifneq ($(CONFIG_PACKAGE_iptables-mod-rtpengine
),)
266 $(call Build
/Compile
/Default
,-C
$(PKG_BUILD_DIR
)/iptables-extension
)
269 ifneq ($(CONFIG_PACKAGE_rtpengine
)$(CONFIG_PACKAGE_rtpengine-no-transcode
),)
270 $(call Build
/Compile
/Default
,-C
$(PKG_BUILD_DIR
)/daemon
)
273 ifneq ($(CONFIG_PACKAGE_rtpengine-recording
),)
274 $(call Build
/Compile
/Default
,-C
$(PKG_BUILD_DIR
)/recording-daemon
)
279 define Build
/InstallDev
282 # KernelPackage calls need to go first, otherwise hooks like
283 # collect_module_symvers won't get added.
284 $(eval
$(call KernelPackage
,ipt-rtpengine
))
285 $(eval
$(call BuildPackage
,rtpengine-no-transcode
))
286 $(eval
$(call BuildPackage
,iptables-mod-rtpengine
))
287 $(eval
$(call BuildPackage
,rtpengine
))
288 $(eval
$(call BuildPackage
,rtpengine-recording
))