libaom: use chromium config script

Modify chromium/src/third_party/libaom/cmake_update.sh and use the file
list it generates.

Keep update_libaom.sh as close to update_libvpx.sh as possible.

Use config options from chromium for security and performance.

Rename files to avoid object file collision. Will be upstreamed.

Disable RTCD because Android mandates NEON and SSSE3. Enables stripping
unused functions. If SSE4 or higher is desired, this will need to be
revisited.

Test: none

BUG=122391143

Change-Id: Ia397022c0ef6f93901daa95da84de6a6f4702c7e
diff --git a/update_libaom.sh b/update_libaom.sh
index 69fa6db..43da8c5 100755
--- a/update_libaom.sh
+++ b/update_libaom.sh
@@ -5,7 +5,7 @@
 # found in the LICENSE file.
 
 # This tool is used to update libaom source code to a revision of the upstream
-# repository.
+# repository. Modified from Chromium src/third_party/libvpx/update_libvpx.sh
 
 # Usage:
 #
@@ -19,6 +19,11 @@
 
 export LC_ALL=C
 
+die() {
+  echo "@"
+  exit 1
+}
+
 # Location for the remote git repository.
 GIT_REPO="https://aomedia.googlesource.com/aom"
 
@@ -43,9 +48,8 @@
 echo "prev_hash:$prev_hash"
 
 rm -rf $LIBAOM_SRC_DIR
-# be robust in the face of errors (meaning don't overwrite the wrong place)
-mkdir $LIBAOM_SRC_DIR || exit 1
-cd $LIBAOM_SRC_DIR || exit 1
+mkdir $LIBAOM_SRC_DIR || die "Unable to create ${LIBAOM_SRC_DIR}"
+cd $LIBAOM_SRC_DIR || die "Unable to enter ${LIBAOM_SRC_DIR}"
 
 # Start a local git repo.
 git clone $GIT_REPO .
@@ -62,78 +66,59 @@
 hash=$(git log -1 --format="%H")
 
 # README reminder.
-(
-    # keep meta info / header
-    sed -n '0,/^====/p' < ../README.android
-
-    # sed kept it in there
-    #echo "========"
-
-    echo "Date: $(date +"%A %B %d %Y")"
-    echo "Branch: $GIT_BRANCH"
-    echo "Commit: $hash"
-    echo ""
-) > ../update.$$-README.android
-cat ../update.$$-README.android
-mv ../update.$$-README.android ../README.android
+echo "Update README.android:"
+echo "==============="
+echo "Date: $(date +"%A %B %d %Y")"
+echo "Branch: $GIT_BRANCH"
+echo "Commit: $hash"
+echo "==============="
+echo ""
 
 # Commit message header.
-COMMIT_MSG=../commit-message-`date +"%Y%m%d.%H%M%S"`
-(
-    echo "libaom: Pull from upstream"
-    echo ""
+echo "Commit message:"
+echo "==============="
+echo "libaom: Pull from upstream"
+echo ""
 
-    # Output the current commit hash.
-    echo "Prev HEAD: $prev_hash"
-    echo "New  HEAD: $hash"
-    echo ""
+# Output the current commit hash.
+echo "Current HEAD: $hash"
+echo ""
 
-    # Output log for upstream from current hash.
-    if [ -n "$prev_hash" ]; then
-      echo "git log from upstream:"
-      pretty_git_log="$(git log \
+# Output log for upstream from current hash.
+if [ -n "$prev_hash" ]; then
+  echo "git log from upstream:"
+  pretty_git_log="$(git log \
                     --no-merges \
                     --topo-order \
                     --pretty="%h %s" \
                     --max-count=20 \
                     $prev_hash..$hash)"
-      if [ -z "$pretty_git_log" ]; then
-        echo "No log found. Checking for reverts."
-        pretty_git_log="$(git log \
+  if [ -z "$pretty_git_log" ]; then
+    echo "No log found. Checking for reverts."
+    pretty_git_log="$(git log \
                       --no-merges \
                       --topo-order \
                       --pretty="%h %s" \
                       --max-count=20 \
                       $hash..$prev_hash)"
-      fi
-      echo "$pretty_git_log"
-      # If it makes it to 20 then it's probably skipping even more.
-      if [ `echo "$pretty_git_log" | wc -l` -eq 20 ]; then
-        echo "<...>"
-      fi
-    else
-      # no previous hash
-      echo "git log from upstream:"
-      pretty_git_log="$(git log \
-                    --no-merges \
-                    --topo-order \
-                    --pretty="%h %s" \
-                    --max-count=20)"
-      if [ -z "$pretty_git_log" ]; then
-        echo "No log found. Checking for reverts."
-      fi
-      echo "$pretty_git_log"
-      # If it makes it to 20 then it's probably skipping even more.
-      if [ `echo "$pretty_git_log" | wc -l` -eq 20 ]; then
-        echo "<...>"
-      fi
-    fi
-) > ${COMMIT_MSG}
+  fi
+  echo "$pretty_git_log"
+  # If it makes it to 20 then it's probably skipping even more.
+  if [ `echo "$pretty_git_log" | wc -l` -eq 20 ]; then
+    echo "<...>"
+  fi
+else
+  # no previous hash
+  echo "git log from upstream:"
+  pretty_git_log="$(git log \
+                --no-merges \
+                --topo-order \
+                --pretty="%h %s" \
+                --max-count=20 \
+                $hash)"
+fi
 
-# Tell user about it
-echo "Commit message: (stored in ./${COMMIT_MSG})"
-echo "==============="
-cat ${COMMIT_MSG}
+# Commit message footer.
 echo ""
 echo "==============="
 
@@ -148,7 +133,3 @@
 find . -type d -empty -exec git rm {} \;
 
 chmod 755 build/cmake/*.sh build/cmake/*.pl
-
-# not even sure why we're doing a chdir here as the last thing in the script
-# it isn't going to make any difference semantically.
-cd $BASE_DIR || exit 1