From aa54d6f005ab95e199ebbc48f7a8a4b11ccf3400 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Thu, 21 May 2020 17:34:48 +0200 Subject: [PATCH 1/2] rtpengine: clean up 01-cflags.patch This commit follows upstream, how they include the Debian build system flags, appending them to their own. To that end OpenWrt's flags are now saved at the beginning of the Makefiles, and appended at the bottom of lib/lib.Makefile. This also sorts out the iptables module compile, to use OpenWrt's LDFLAGS. Signed-off-by: Sebastian Kemper --- net/rtpengine/patches/01-cflags.patch | 80 ++++++++++++++++----------- 1 file changed, 47 insertions(+), 33 deletions(-) diff --git a/net/rtpengine/patches/01-cflags.patch b/net/rtpengine/patches/01-cflags.patch index 6be3d78..6fe985a 100644 --- a/net/rtpengine/patches/01-cflags.patch +++ b/net/rtpengine/patches/01-cflags.patch @@ -1,41 +1,55 @@ ---- a/daemon/Makefile -+++ b/daemon/Makefile -@@ -51,7 +51,7 @@ endif - endif - endif - --CFLAGS= -g -Wall -Wstrict-prototypes -pthread -fno-strict-aliasing -+CFLAGS+= -g -Wall -Wstrict-prototypes -pthread -fno-strict-aliasing - CFLAGS+= -std=c99 - CFLAGS+= $(shell pkg-config --cflags glib-2.0) - CFLAGS+= $(shell pkg-config --cflags gthread-2.0) --- a/lib/lib.Makefile +++ b/lib/lib.Makefile -@@ -47,8 +47,6 @@ endif - - ifeq ($(DBG),yes) - CFLAGS+= -D__DEBUG=1 --else --CFLAGS+= -O3 +@@ -62,3 +62,6 @@ ifneq ($(DBG),yes) + LDLIBS+= $(shell dpkg-buildflags --get LDLIBS) + endif endif ++ ++CFLAGS+=$(OpenWrt_CFLAGS) ++LDFLAGS+=$(OpenWrt_LDFLAGS) +--- a/daemon/Makefile ++++ b/daemon/Makefile +@@ -1,3 +1,6 @@ ++OpenWrt_CFLAGS:=$(CFLAGS) ++OpenWrt_LDFLAGS:=$(LDFLAGS) ++ + TARGET= rtpengine - ---- a/iptables-extension/Makefile -+++ b/iptables-extension/Makefile -@@ -1,5 +1,5 @@ - CC?=gcc --CFLAGS = -O2 -Wall -Wstrict-prototypes -shared -fPIC -+CFLAGS += -Wall -Wstrict-prototypes -shared -fPIC - ifneq ($(RTPENGINE_VERSION),) - CFLAGS += -DRTPENGINE_VERSION="\"$(RTPENGINE_VERSION)\"" - else + with_iptables_option ?= yes --- a/recording-daemon/Makefile +++ b/recording-daemon/Makefile -@@ -1,6 +1,6 @@ +@@ -1,3 +1,6 @@ ++OpenWrt_CFLAGS:=$(CFLAGS) ++OpenWrt_LDFLAGS:=$(LDFLAGS) ++ TARGET= rtpengine-recording --CFLAGS= -g -Wall -Wstrict-prototypes -pthread -I. -I../lib/ -I../kernel-module/ -+CFLAGS+= -g -Wall -Wstrict-prototypes -pthread -I. -I../lib/ -I../kernel-module/ - CFLAGS+= -std=c99 -fno-strict-aliasing - CFLAGS+= -D_GNU_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE - CFLAGS+= $(shell pkg-config --cflags glib-2.0) + CFLAGS= -g -Wall -Wstrict-prototypes -pthread -I. -I../lib/ -I../kernel-module/ +--- a/iptables-extension/Makefile ++++ b/iptables-extension/Makefile +@@ -1,3 +1,6 @@ ++OpenWrt_CFLAGS:=$(CFLAGS) ++OpenWrt_LDFLAGS:=$(LDFLAGS) ++ + CC?=gcc + CFLAGS = -O2 -Wall -Wstrict-prototypes -shared -fPIC + ifneq ($(RTPENGINE_VERSION),) +@@ -22,6 +25,9 @@ else + XTABLES = $(shell test -e /usr/include/xtables.h && echo 1) + endif + ++CFLAGS+=$(OpenWrt_CFLAGS) ++LDFLAGS+=$(OpenWrt_LDFLAGS) ++ + IPTABLES = $(shell test -e /usr/include/iptables.h && echo 1) + IP6TABLES = $(shell test -e /usr/include/ip6tables.h && echo 1) + +@@ -37,7 +43,7 @@ WORK=1 + module: libxt_RTPENGINE.so + + libxt_RTPENGINE.so: libxt_RTPENGINE.c +- $(CC) $(CFLAGS) -o libxt_RTPENGINE.so libxt_RTPENGINE.c ++ $(CC) $(LDFLAGS) $(CFLAGS) -o libxt_RTPENGINE.so libxt_RTPENGINE.c + + else + From 7a5e32f4dc1466b1c8bfc83787b8ae40e5b09834 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Thu, 21 May 2020 17:40:43 +0200 Subject: [PATCH 2/2] rtpengine: work around sporadic build failures The rtpengine build system uses the Makefiles to generate source files on the fly. This usually works fine, but when building in parallel, intermittently the generated files contain garbage (like, lines are repeated, causing redefinition errors). As a workaround this commit disables parallel builds. Signed-off-by: Sebastian Kemper --- net/rtpengine/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/rtpengine/Makefile b/net/rtpengine/Makefile index 1875738..e1a807e 100644 --- a/net/rtpengine/Makefile +++ b/net/rtpengine/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=rtpengine PKG_VERSION:=mr8.3.1.4 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/sipwise/rtpengine/tar.gz/$(PKG_VERSION)? @@ -21,7 +21,11 @@ PKG_LICENSE_FILES:=LICENSE PKG_MAINTAINER:=Sebastian Kemper -PKG_BUILD_PARALLEL:=1 +# When building in parallel, some files (like streambuf.c or dtmflib.c) +# are generated multiple times by the rtpengine build system. +# Intermittently they then contain garbage, leading to redefinition +# errors. +PKG_BUILD_PARALLEL:=0 PKG_BUILD_DEPENDS:=gperf/host