[Asterisk-code-review] Build: Fix OSX build issues. (asterisk[13])

Corey Farrell asteriskteam at digium.com
Sun Nov 19 14:32:41 CST 2017


Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/7297


Change subject: Build: Fix OSX build issues.
......................................................................

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
---
M build_tools/list_valid_installed_externals
M configure
M configure.ac
M makeopts.in
M third-party/Makefile.rules
M third-party/pjproject/Makefile
M third-party/pjproject/apply_patches
M third-party/pjproject/configure.m4
8 files changed, 68 insertions(+), 12 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/97/7297/1

diff --git a/build_tools/list_valid_installed_externals b/build_tools/list_valid_installed_externals
index ed36274..c371022 100755
--- a/build_tools/list_valid_installed_externals
+++ b/build_tools/list_valid_installed_externals
@@ -6,7 +6,7 @@
 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
diff --git a/configure b/configure
index f64883b..8c13476 100755
--- a/configure
+++ b/configure
@@ -1249,6 +1249,7 @@
 FIND
 PYTHON
 FLEX
+CUT
 CAT
 CMP
 BISON
@@ -6826,6 +6827,47 @@
 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
@@ -9304,6 +9346,12 @@
 	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))
@@ -9314,7 +9362,7 @@
 		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" \
diff --git a/configure.ac b/configure.ac
index 30ff4ac..8f164a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -265,6 +265,7 @@
 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], :)
diff --git a/makeopts.in b/makeopts.in
index b79df04..45eada2 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -49,6 +49,7 @@
 SED=@SED@
 NM=@NM@
 CAT=@CAT@
+CUT=@CUT@
 
 BUILD_PLATFORM=@BUILD_PLATFORM@
 BUILD_CPU=@BUILD_CPU@
diff --git a/third-party/Makefile.rules b/third-party/Makefile.rules
index f8b72ba..8306869 100644
--- a/third-party/Makefile.rules
+++ b/third-party/Makefile.rules
@@ -28,6 +28,8 @@
 export NM
 export MD5
 export CAT
+export CUT
+export GREP
 export DOWNLOAD
 export DOWNLOAD_TO_STDOUT
 export DOWNLOAD_TIMEOUT
diff --git a/third-party/pjproject/Makefile b/third-party/pjproject/Makefile
index 7a42edc..6ebd685 100644
--- a/third-party/pjproject/Makefile
+++ b/third-party/pjproject/Makefile
@@ -93,9 +93,9 @@
 
 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 @@
 	- at 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"
 	- at touch source/.unpacked
 
 source/version.mak: source/.unpacked
@@ -150,7 +150,8 @@
 	$(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
 
diff --git a/third-party/pjproject/apply_patches b/third-party/pjproject/apply_patches
index 5f9fde2..134bd30 100755
--- a/third-party/pjproject/apply_patches
+++ b/third-party/pjproject/apply_patches
@@ -10,9 +10,6 @@
 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
diff --git a/third-party/pjproject/configure.m4 b/third-party/pjproject/configure.m4
index 2d33534..7388704 100644
--- a/third-party/pjproject/configure.m4
+++ b/third-party/pjproject/configure.m4
@@ -39,6 +39,12 @@
 	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 @@
 		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" \

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5d34ecca905384decb22ead45c913ae5e8aff748
Gerrit-Change-Number: 7297
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171119/65a59313/attachment-0001.html>


More information about the asterisk-code-review mailing list