From d47f4ac4271179db4cb6ed7d39d57432abfb0e04 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 29 Jan 2021 09:46:39 -0500 Subject: [PATCH] TT#14008 make bcg729 inclusion conditional on dpkg profile closes #1174 Change-Id: I277986ea30b25633c281291aa956fb2159c386ed --- daemon/Makefile | 58 +++------------------------------------ lib/g729.Makefile | 57 ++++++++++++++++++++++++++++++++++++++ recording-daemon/Makefile | 2 ++ 3 files changed, 63 insertions(+), 54 deletions(-) create mode 100644 lib/g729.Makefile diff --git a/daemon/Makefile b/daemon/Makefile index 9fbef419f..62ccb353d 100644 --- a/daemon/Makefile +++ b/daemon/Makefile @@ -3,53 +3,6 @@ TARGET= rtpengine with_iptables_option ?= yes with_transcoding ?= yes -# look for bcg729 -# system pkg-config -ifeq ($(shell pkg-config --exists libbcg729 && echo yes),yes) -have_bcg729 := yes -bcg729_inc := $(shell pkg-config --cflags libbcg729) -bcg729_lib := $(shell pkg-config --libs libbcg729) -else -# system generic -ifneq (,$(wildcard /usr/include/bcg729/decoder.h)) -have_bcg729 := yes -else -# /usr/src -ifneq (,$(wildcard /usr/src/bcg729/include/bcg729/decoder.h)) -have_bcg729 := yes -bcg729_inc := -I/usr/src/bcg729/include/ -bcg729_lib := -L/usr/src/bcg729/src/ -lbcg729 -else -# rfuchs dev -ifneq (,$(wildcard $(HOME)/src/bcg729/include/bcg729/decoder.h)) -have_bcg729 := yes -bcg729_inc := -I$(HOME)/src/bcg729/include/ -bcg729_lib := -L$(HOME)/src/bcg729/src/ -lbcg729 -else -# home directory -ifneq (,$(wildcard $(HOME)/bcg729/include/bcg729/decoder.h)) -have_bcg729 := yes -bcg729_inc := -I$(HOME)/bcg729/include/ -bcg729_lib := -L$(HOME)/bcg729/src/ -lbcg729 -else -# included toplevel -ifneq (,$(wildcard ../bcg729/include/bcg729/decoder.h)) -have_bcg729 := yes -bcg729_inc := -I../bcg729/include/ -bcg729_lib := -L../bcg729/src/ -lbcg729 -else -# /usr/local/include when installing from git -ifneq (,$(wildcard /usr/local/include/bcg729/decoder.h)) -have_bcg729 := yes -bcg729_inc := -I/usr/local/include/ -bcg729_lib := -L/usr/local/lib64/ -lbcg729 -endif -endif -endif -endif -endif -endif -endif CFLAGS+= -g -Wall -Wstrict-prototypes -pthread -fno-strict-aliasing CFLAGS+= -std=c99 @@ -78,10 +31,6 @@ CFLAGS+= $(shell pkg-config --cflags libswresample) CFLAGS+= $(shell pkg-config --cflags libavfilter) CFLAGS+= $(shell pkg-config --cflags spandsp) CFLAGS+= -DWITH_TRANSCODING -ifeq ($(have_bcg729),yes) -CFLAGS+= -DHAVE_BCG729 -CFLAGS+= $(bcg729_inc) -endif CFLAGS+= $(shell mysql_config --cflags) else CFLAGS+= -DWITHOUT_CODECLIB @@ -119,12 +68,13 @@ LDLIBS+= $(shell pkg-config --libs libavutil) LDLIBS+= $(shell pkg-config --libs libswresample) LDLIBS+= $(shell pkg-config --libs libavfilter) LDLIBS+= $(shell pkg-config --libs spandsp) -ifeq ($(have_bcg729),yes) -LDLIBS+= $(bcg729_lib) -endif LDLIBS+= $(shell mysql_config --libs) endif +ifeq ($(with_transcoding),yes) +include ../lib/g729.Makefile +endif + SRCS= main.c kernel.c poller.c aux.c control_tcp.c call.c control_udp.c redis.c \ bencode.c cookie_cache.c udp_listener.c control_ng.strhash.c sdp.strhash.c stun.c rtcp.c \ crypto.c rtp.c call_interfaces.strhash.c dtls.c log.c cli.c graphite.c ice.c \ diff --git a/lib/g729.Makefile b/lib/g729.Makefile new file mode 100644 index 000000000..1b0e32370 --- /dev/null +++ b/lib/g729.Makefile @@ -0,0 +1,57 @@ +ifeq (,$(filter pkg.ngcp-rtpengine.nobcg729,${DEB_BUILD_PROFILES})) +# look for bcg729 +# system pkg-config +ifeq ($(shell pkg-config --exists libbcg729 && echo yes),yes) +have_bcg729 := yes +bcg729_inc := $(shell pkg-config --cflags libbcg729) +bcg729_lib := $(shell pkg-config --libs libbcg729) +else +# system generic +ifneq (,$(wildcard /usr/include/bcg729/decoder.h)) +have_bcg729 := yes +else +# /usr/src +ifneq (,$(wildcard /usr/src/bcg729/include/bcg729/decoder.h)) +have_bcg729 := yes +bcg729_inc := -I/usr/src/bcg729/include/ +bcg729_lib := -L/usr/src/bcg729/src/ -lbcg729 +else +# rfuchs dev +ifneq (,$(wildcard $(HOME)/src/bcg729/include/bcg729/decoder.h)) +have_bcg729 := yes +bcg729_inc := -I$(HOME)/src/bcg729/include/ +bcg729_lib := -L$(HOME)/src/bcg729/src/ -lbcg729 +else +# home directory +ifneq (,$(wildcard $(HOME)/bcg729/include/bcg729/decoder.h)) +have_bcg729 := yes +bcg729_inc := -I$(HOME)/bcg729/include/ +bcg729_lib := -L$(HOME)/bcg729/src/ -lbcg729 +else +# included toplevel +ifneq (,$(wildcard ../bcg729/include/bcg729/decoder.h)) +have_bcg729 := yes +bcg729_inc := -I../bcg729/include/ +bcg729_lib := -L../bcg729/src/ -lbcg729 +else +# /usr/local/include when installing from git +ifneq (,$(wildcard /usr/local/include/bcg729/decoder.h)) +have_bcg729 := yes +bcg729_inc := -I/usr/local/include/ +bcg729_lib := -L/usr/local/lib64/ -lbcg729 +endif +endif +endif +endif +endif +endif +endif +endif + +ifeq ($(have_bcg729),yes) +CFLAGS+= -DHAVE_BCG729 +CFLAGS+= $(bcg729_inc) +endif +ifeq ($(have_bcg729),yes) +LDLIBS+= $(bcg729_lib) +endif diff --git a/recording-daemon/Makefile b/recording-daemon/Makefile index 49f0999e3..8f934e41c 100644 --- a/recording-daemon/Makefile +++ b/recording-daemon/Makefile @@ -24,6 +24,8 @@ LDLIBS+= $(shell pkg-config --libs libavfilter) LDLIBS+= $(shell mysql_config --libs) LDLIBS+= $(shell pkg-config --libs openssl) +include ../lib/g729.Makefile + SRCS= epoll.c garbage.c inotify.c main.c metafile.c stream.c recaux.c packet.c \ decoder.c output.c mix.c db.c log.c forward.c tag.c poller.c LIBSRCS= loglib.c auxlib.c rtplib.c codeclib.c resample.c str.c socket.c streambuf.c ssllib.c \