[Asterisk-code-review] pjproject/Makefile: Updates for Darwin compatible builds (...asterisk[master])

Friendly Automation asteriskteam at digium.com
Tue May 21 10:56:53 CDT 2019


Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/11338 )

Change subject: pjproject/Makefile: Updates for Darwin compatible builds
......................................................................

pjproject/Makefile: Updates for Darwin compatible builds

This patch fixes three compatibility issues for Darwin compatible builds:

(1) Use BSD compatible command line option for sed

For some versions of BSD sed, the -r command line option is unknown.
Both GNU and BSD sed support the -E command line option for enabling
extended regular expressions; as such, this patch replaces the -r
option with -E.

(2) Look for '_' in pjproject generated symbols

In Darwin comaptible systems, the symbols generated for pjproject may be
prefixed with an '_'. When exporting these to a symbol file, the invocation
to sed has to optionally look for a prefix of said '_' character.

(3) Use -all_load/-noall_load when linking

The flags -whole-archive/-no-whole-archive are not supported by the
linker, and must instead be replaced with -all_load/-noall_load.

Change-Id: I58121756de6a0560a6e49ca9d6bf9566a333cde3
---
M third-party/pjproject/Makefile
1 file changed, 12 insertions(+), 2 deletions(-)

Approvals:
  Matt Jordan: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/third-party/pjproject/Makefile b/third-party/pjproject/Makefile
index af0e9f8..86eb968 100644
--- a/third-party/pjproject/Makefile
+++ b/third-party/pjproject/Makefile
@@ -66,7 +66,17 @@
             CF += -DPJPROJECT_BUNDLED_ASSERTIONS=yes
         endif
         MALLOC_DEBUG_LIBS = source/pjsip-apps/lib/libasterisk_malloc_debug.a
-        MALLOC_DEBUG_LDFLAGS = -L$(PJDIR)/pjsip-apps/lib -Wl,-whole-archive -lasterisk_malloc_debug -Wl,-no-whole-archive
+        ifneq ($(findstring darwin,$(OSARCH)),)
+            MALLOC_DEBUG_LDFLAGS = -L$(PJDIR)/pjsip-apps/lib -Wl,-all_load -lasterisk_malloc_debug -Wl,-noall_load
+        else
+             # These are used for all but Darwin
+            MALLOC_DEBUG_LDFLAGS = -L$(PJDIR)/pjsip-apps/lib -Wl,-whole-archive -lasterisk_malloc_debug -Wl,-no-whole-archive
+        endif
+        ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS)),)
+            CF += -O3
+        endif
+        export CFLAGS += $(CF) -g3
+        export LDFLAGS += $(CC_LDFLAGS)
         TARGETS += pjproject.symbols
     else
         all install:
@@ -155,7 +165,7 @@
 
 pjproject.symbols: $(ALL_LIB_FILES)
 	$(ECHO_PREFIX) Generating symbols
-	$(CMD_PREFIX) $(NM) -Pog $(ALL_LIB_FILES) | $(SED) -n -r -e "s/.+: ([pP][jJ][^ ]+) .+/\1/gp" | sort -u > pjproject.symbols
+	$(CMD_PREFIX) $(NM) -Pog $(ALL_LIB_FILES) | $(SED) -n -E -e "s/.+: ([_]?[pP][jJ][^ ]+) .+/\1/gp" | sort -u > pjproject.symbols
 
 source/pjsip-apps/src/asterisk_malloc_debug.c: patches/asterisk_malloc_debug.c
 	$(ECHO_PREFIX) Copying $< to $@

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11338
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I58121756de6a0560a6e49ca9d6bf9566a333cde3
Gerrit-Change-Number: 11338
Gerrit-PatchSet: 8
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190521/294e9ae4/attachment-0001.html>


More information about the asterisk-code-review mailing list