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 4181b6f377
commit b4f7f8250f
8 changed files with 68 additions and 12 deletions

View File

@ -6,7 +6,7 @@ fi
set -e
ASTTOPDIR=${ASTTOPDIR:-.}
export make=`sed -n -r -e "s/^MAKE\s*=\s*//gp" ${ASTTOPDIR}/makeopts`
export make=`sed -n -e "s/^MAKE\s*=\s*//gp" ${ASTTOPDIR}/makeopts`
getvar() {
$make --quiet --no-print-directory -f- <<EOF

50
configure vendored
View File

@ -1281,6 +1281,7 @@ COMPRESS
FIND
PYTHON
FLEX
CUT
CAT
CMP
BISON
@ -6871,6 +6872,47 @@ $as_echo "no" >&6; }
fi
# Extract the first word of "cut", so it can be a program name with args.
set dummy cut; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_CUT+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CUT in
[\\/]* | ?:[\\/]*)
ac_cv_path_CUT="$CUT" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_CUT="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_CUT" && ac_cv_path_CUT=":"
;;
esac
fi
CUT=$ac_cv_path_CUT
if test -n "$CUT"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUT" >&5
$as_echo "$CUT" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
# Extract the first word of "flex", so it can be a program name with args.
set dummy flex; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@ -9349,6 +9391,12 @@ $as_echo "configuring" >&6; }
if test "${CAT}" = ":" ; then
as_fn_error $? "cat is required to build bundled pjproject" "$LINENO" 5
fi
if test "${CUT}" = ":" ; then
as_fn_error $? "cut is required to build bundled pjproject" "$LINENO" 5
fi
if test "${GREP}" = ":" ; then
as_fn_error $? "grep is required to build bundled pjproject" "$LINENO" 5
fi
this_host=$(./config.sub $(./config.guess))
@ -9359,7 +9407,7 @@ $as_echo "configuring" >&6; }
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" \

View File

@ -264,6 +264,7 @@ AC_SUBST(GNU_LD)
AC_PATH_PROG([BISON], [bison], :)
AC_PATH_PROG([CMP], [cmp], :)
AC_PATH_PROG([CAT], [cat], :)
AC_PATH_PROG([CUT], [cut], :)
AC_PATH_PROG([FLEX], [flex], :)
AC_PATH_PROG([GREP], [grep], :)
AC_PATH_PROG([PYTHON], [python], :)

View File

@ -49,6 +49,7 @@ PATCH=@PATCH@
SED=@SED@
NM=@NM@
CAT=@CAT@
CUT=@CUT@
BUILD_PLATFORM=@BUILD_PLATFORM@
BUILD_CPU=@BUILD_CPU@

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

@ -96,9 +96,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
@ -130,8 +130,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
@ -153,7 +153,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" \