Build: Fix OSX build issues.

OSX does not support 'readlink -f' or 'sed -r'.  Replace readlink with
the GNU make macro 'realpath'.  Replace sed with grep in one place, cut
in the other.

ASTERISK-27332

Change-Id: I5d34ecca905384decb22ead45c913ae5e8aff748
This commit is contained in:
Corey Farrell
2017-11-19 10:57:28 -05:00
parent ef8ee3ee69
commit 69113388e9
8 changed files with 68 additions and 12 deletions

View File

@@ -28,6 +28,8 @@ export SED
export NM
export MD5
export CAT
export CUT
export GREP
export DOWNLOAD
export DOWNLOAD_TO_STDOUT
export DOWNLOAD_TIMEOUT

View File

@@ -93,9 +93,9 @@ endef
define verify_tarball
($(SHELL_ECHO_PREFIX) Verifying $(TARBALL) &&\
tarball_sum=$$($(CAT) $(TARBALL) | $(MD5) | $(SED) -n -r -e "s/^([^ ]+)\s+.*/\1/gp") ;\
required_sum=$$($(SED) -n -r -e "s/^([^ ]+)\s+$(TARBALL_FILE)/\1/gp" $(PJMD5SUM)) ;\
if [ "$$tarball_sum" != "$$required_sum" ] ; then $(SHELL_ECHO_PREFIX) Verify failed ; exit 1 ;\
tarball_sum=$$($(CAT) $(TARBALL) | $(MD5) | $(CUT) -d' ' -f1) ;\
required_sum=$$($(GREP) -e $(TARBALL_FILE) $(PJMD5SUM) | $(CUT) -d' ' -f1) ;\
if [ -z "$$required_sum" -o "$$tarball_sum" != "$$required_sum" ] ; then $(SHELL_ECHO_PREFIX) Verify failed ; exit 1 ;\
else $(SHELL_ECHO_PREFIX) Verify successful ; exit 0 ; fi; )
endef
@@ -127,8 +127,8 @@ source/.unpacked: $(DOWNLOAD_DIR)/pjproject-$(PJPROJECT_VERSION).tar.bz2
-@rm -rf source pjproject-* >/dev/null 2>&1
$(CMD_PREFIX) $(TAR) -xjf $<
@mv pjproject-$(PJPROJECT_VERSION) source
$(ECHO_PREFIX) Applying patches
$(CMD_PREFIX) ./apply_patches $(QUIET_CONFIGURE) patches source
$(ECHO_PREFIX) Applying patches "$(realpath patches)" "$(realpath .)/source"
$(CMD_PREFIX) ./apply_patches $(QUIET_CONFIGURE) "$(realpath patches)" "$(realpath .)/source"
-@touch source/.unpacked
source/version.mak: source/.unpacked
@@ -150,7 +150,8 @@ source/build.mak: Makefile.rules source/version.mak source/user.mak $(addprefix
$(CMD_PREFIX) (cd source ; ./aconfigure $(QUIET_CONFIGURE) $(PJPROJECT_CONFIG_OPTS))
build.mak: source/build.mak
$(CMD_PREFIX) $(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
$(CMD_PREFIX) $(GREP) -v -e prefix -e "export PJ_SHARED_LIBRARIES" -e MACHINE_NAME \
-e OS_NAME -e HOST_NAME -e CC_NAME -e CROSS_COMPILE -e LINUX_POLL $< > $@
configure: source/build.mak

View File

@@ -10,9 +10,6 @@ PATCH=${PATCH:-patch}
patchdir=${1:?You must supply a patches directory}
sourcedir=${2?:You must supply a source directory}
patchdir=`readlink -f $patchdir`
sourcedir=`readlink -f $sourcedir`
if [ ! -d "$patchdir" ] ; then
echo "$patchdir is not a directory" >&2
exit 1

View File

@@ -39,6 +39,12 @@ AC_DEFUN([_PJPROJECT_CONFIGURE],
if test "${CAT}" = ":" ; then
AC_MSG_ERROR(cat is required to build bundled pjproject)
fi
if test "${CUT}" = ":" ; then
AC_MSG_ERROR(cut is required to build bundled pjproject)
fi
if test "${GREP}" = ":" ; then
AC_MSG_ERROR(grep is required to build bundled pjproject)
fi
AC_ARG_VAR([PJPROJECT_CONFIGURE_OPTS],[Additional configure options to pass to bundled pjproject])
this_host=$(./config.sub $(./config.guess))
@@ -49,7 +55,7 @@ AC_DEFUN([_PJPROJECT_CONFIGURE],
PJPROJECT_CONFIGURE_OPTS+=" --host=$host"
fi
export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT
export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT CUT GREP
export NOISY_BUILD
${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \
PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \