]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Build: Fix OSX build issues.
authorCorey Farrell <git@cfware.com>
Sun, 19 Nov 2017 15:57:28 +0000 (10:57 -0500)
committerCorey Farrell <git@cfware.com>
Sun, 19 Nov 2017 19:27:28 +0000 (14:27 -0500)
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

build_tools/list_valid_installed_externals
configure
configure.ac
makeopts.in
third-party/Makefile.rules
third-party/pjproject/Makefile
third-party/pjproject/apply_patches
third-party/pjproject/configure.m4

index ed362743ca812d3d54034d50f623f7b0dcc3485c..c37102208d8bbaceea798b0a1abf6de7568b88e3 100755 (executable)
@@ -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
index f64883be1270233ed04c0f839cd3bc26ea609bdd..8c13476e56516b896dcee586d529b5aab09c08bb 100755 (executable)
--- a/configure
+++ b/configure
@@ -1249,6 +1249,7 @@ COMPRESS
 FIND
 PYTHON
 FLEX
+CUT
 CAT
 CMP
 BISON
@@ -6826,6 +6827,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
@@ -9304,6 +9346,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))
@@ -9314,7 +9362,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" \
index 30ff4ac3175b8c41cd10d5798aa48838a1781a96..8f164a297bc2e29e09746390b21ab8d6a5486e1c 100644 (file)
@@ -265,6 +265,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], :)
index b79df04c375a6c0b50520c7ee33c0230e6a29d13..45eada26b337bc710bd784dee28f3c31d122c45a 100644 (file)
@@ -49,6 +49,7 @@ PATCH=@PATCH@
 SED=@SED@
 NM=@NM@
 CAT=@CAT@
+CUT=@CUT@
 
 BUILD_PLATFORM=@BUILD_PLATFORM@
 BUILD_CPU=@BUILD_CPU@
index f8b72ba6ddb4704d00697344cc34ed4c0e422a5b..8306869f9fab673eb63af174f8f420c1b4d389a0 100644 (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
index 7a42edcde2cea43d41ad9bd60db74c79a49c7033..6ebd685b252a0ca01f687ecd21a4a06c5be55412 100644 (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
 
index 5f9fde283fc48cb2795219a19a9dfda28f312cc0..134bd306fc0537d33ee9d3a0c2f31ae205e8ca1b 100755 (executable)
@@ -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
index 2d3353476e9e70412cfa531dfdb5e7c6a7465b0d..73887041c49712cbde702d3d2c24910005d62c46 100644 (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" \