[Asterisk-code-review] pjproject: Pass (dont )optimize flags to pjproject and fix ... (asterisk[master])

Anonymous Coward asteriskteam at digium.com
Tue Mar 15 17:40:02 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: pjproject:  Pass (dont_)optimize flags to pjproject and fix pjsua
......................................................................


pjproject:  Pass (dont_)optimize flags to pjproject and fix pjsua

The pjproject Makefile now uses the Asterisk optimization flags which
are determined by the setting of the DONT_OPTMIZE menuselect flag.
The Makefile was also restructured so a change to the top level
menuselect.makeopts will result in a rebuild of pjproject.

Also, "--disable-resample" was removed from the pjproject configure
options.  Without resample, pjsua (which is used by the testsuite)
can't make audio calls.  When it can't, it segfaults.

Change-Id: I24b0a4d0872acef00ed89b3c527a713ee4c2ccd4
---
M third-party/pjproject/Makefile
M third-party/pjproject/Makefile.rules
2 files changed, 71 insertions(+), 36 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, approved
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/third-party/pjproject/Makefile b/third-party/pjproject/Makefile
index 3100951..5810a65 100644
--- a/third-party/pjproject/Makefile
+++ b/third-party/pjproject/Makefile
@@ -1,59 +1,87 @@
 .SUFFIXES:
 .PHONY: _all all _install install clean distclean echo_cflags configure
 
-ifeq ($(MAKECMDGOALS),install)
-include ../../makeopts
-else
--include ../../makeopts
+include ../versions.mak
+
+SPECIAL_TARGETS :=
+
+ifneq ($(findstring configure,$(MAKECMDGOALS))$(findstring echo_cflags,$(MAKECMDGOALS)),)
+# Run from $(ASTTOPDIR)/configure
+    SPECIAL_TARGETS += configure
+    include ../Makefile.rules
+    include Makefile.rules
 endif
 
-include ../versions.mak
-include ../Makefile.rules
-include Makefile.rules
+ifeq ($(findstring echo_cflags,$(MAKECMDGOALS)),echo_cflags)
+    -include build.mak
+    ECHO_PREFIX=@\#
+endif
+
+ifeq ($(findstring clean,$(MAKECMDGOALS)),clean)
+# clean or distclean
+    SPECIAL_TARGETS += clean
+    include ../Makefile.rules
+    include Makefile.rules
+endif
+
+ifeq ($(SPECIAL_TARGETS),)
+# Run locally or from $(ASTTOPDIR)/Makefile.  All include files should be present
+    ifeq ($(wildcard ../../makeopts),)
+        $(error ASTTOPDIR/configure hasn't been run)
+    endif
+    include ../../makeopts
+
+    ifeq ($(PJPROJECT_BUNDLED),yes)
+        -include ../../menuselect.makeopts
+        include ../Makefile.rules
+
+        all: _all
+        install: _install
+
+        include ../../Makefile.rules
+        include Makefile.rules
+        include build.mak
+        CF := $(filter-out -W%,$(CC_CFLAGS))
+        CF := $(filter-out -I%,$(CF))
+        export CFLAGS += $(CF)
+        export LDFLAGS += $(CC_LDFLAGS)
+    else
+        all install:
+    endif
+endif
 
 ECHO_PREFIX := $(ECHO_PREFIX) echo '[pjproject] '
 
-ifeq ($(MAKECMDGOALS),echo_cflags)
--include build.mak
-ECHO_PREFIX=@\#
-endif
-
-ifneq ($(PJPROJECT_BUNDLED),yes)
-all install:
-	@echo '[pjproject] Not enabled'
-else
-
-ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
-include build.mak
-endif
-
-all: _all
-install: _install
-endif
-
 ifndef $(TMPDIR)
-ifneq ($(wildcard /tmp),)
-TMPDIR=/tmp
-else
-TMPDIR=.
-endif
+    ifneq ($(wildcard /tmp),)
+        TMPDIR=/tmp
+    else
+        TMPDIR=.
+    endif
 endif
 
 $(TMPDIR)/pjproject-$(PJPROJECT_VERSION).tar.bz2 : ../versions.mak
 	$(ECHO_PREFIX) Downloading $@ with $(DOWNLOAD)
 	$(CMD_PREFIX) $(DOWNLOAD) $(PJPROJECT_URL)/$(@F) > $@
 
-source/user.mak source/pjlib/include/pj/config_site.h: $(TMPDIR)/pjproject-$(PJPROJECT_VERSION).tar.bz2 patches/config_site.h patches/user.mak 
+source/.unpacked: $(TMPDIR)/pjproject-$(PJPROJECT_VERSION).tar.bz2
 	$(ECHO_PREFIX) Unpacking $<
 	- at rm -rf source &>/dev/null
 	- at mkdir source &>/dev/null
 	$(CMD_PREFIX) tar --strip-components=1 -C source -xjf $<
-	$(ECHO_PREFIX) Applying patches and custom files
+	$(ECHO_PREFIX) Applying patches
 	$(CMD_PREFIX) ./apply_patches $(QUIET_CONFIGURE) ./patches ./source
-	$(CMD_PREFIX) cp -f ./patches/config_site.h ./source/pjlib/include/pj/
+	- at touch source/.unpacked
+
+source/user.mak: source/.unpacked ./patches/user.mak
+	$(ECHO_PREFIX) Applying user.mak
 	$(CMD_PREFIX) cp -f ./patches/user.mak ./source/
 
-build.mak: source/pjlib/include/pj/config_site.h source/user.mak Makefile.rules
+source/pjlib/include/pj/config_site.h: source/.unpacked ./patches/config_site.h
+	$(ECHO_PREFIX) Applying config_site.h
+	$(CMD_PREFIX) cp -f ./patches/config_site.h ./source/pjlib/include/pj/
+
+build.mak: source/.unpacked source/pjlib/include/pj/config_site.h source/user.mak Makefile.rules
 	$(ECHO_PREFIX) Configuring with $(PJPROJECT_CONFIG_OPTS)
 	$(CMD_PREFIX) (cd source ; autoconf aconfigure.ac > aconfigure && ./aconfigure $(QUIET_CONFIGURE) $(PJPROJECT_CONFIG_OPTS))
 	@sed -r -e "/prefix|export PJ_SHARED_LIBRARIES|MACHINE_NAME|OS_NAME|HOST_NAME|CC_NAME|CROSS_COMPILE|LINUX_POLL/d" source/build.mak > build.mak
@@ -67,7 +95,13 @@
 	$(ECHO_PREFIX) "Making dependencies"
 	+$(CMD_PREFIX) $(SUBMAKE) -C source dep
 
-source/pjlib/lib/libpj-$(TARGET_NAME).a: source/pjlib/build/.pjlib-$(TARGET_NAME).depend
+
+menuselect: ../../menuselect.makeopts ../../makeopts
+	-$(CMD_PREFIX) test -d source && ($(SUBMAKE) -C source clean ; find source -name *.a -delete ; rm -rf source/pjsip-apps/src/python/build) || :
+	-$(CMD_PREFIX) rm -rf pjproject.symbols
+
+
+source/pjlib/lib/libpj-$(TARGET_NAME).a: menuselect source/pjlib/build/.pjlib-$(TARGET_NAME).depend
 	$(ECHO_PREFIX) Compiling libs
 	+$(CMD_PREFIX) $(SUBMAKE) -C source lib $(REALLY_QUIET)
 
@@ -83,6 +117,7 @@
 	$(ECHO_PREFIX) Compiling python bindings
 	$(CMD_PREFIX) (cd source/pjsip-apps/src/python ; python setup.py build --build-platlib=./build $(REALLY_QUIET))
 
+
 _all: pjproject.symbols source/pjsip-apps/bin/pjsua-$(TARGET_NAME) source/pjsip-apps/src/python/build/_pjsua.so
 
 _install: _all
diff --git a/third-party/pjproject/Makefile.rules b/third-party/pjproject/Makefile.rules
index 6319ed5..f39629b 100644
--- a/third-party/pjproject/Makefile.rules
+++ b/third-party/pjproject/Makefile.rules
@@ -2,6 +2,6 @@
 
 # Even though we're not installing pjproject, we're setting prefix to /opt/pjproject to be safe
 PJPROJECT_CONFIG_OPTS = --prefix=/opt/pjproject --with-external-speex --with-external-gsm --with-external-srtp \
-	--disable-video --disable-v4l2 --disable-sound --disable-resample \
+	--with-external-pa --disable-video --disable-v4l2 --disable-sound \
 	--disable-opencore-amr --disable-ilbc-codec --without-libyuv --disable-g7221-codec \
 	--enable-epoll

-- 
To view, visit https://gerrit.asterisk.org/2379
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I24b0a4d0872acef00ed89b3c527a713ee4c2ccd4
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list