summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRay Essick <essick@google.com>2018-11-29 14:14:00 -0800
committerRay Essick <essick@google.com>2018-12-06 15:47:44 -0800
commit247da04c9e8d2f838bb3df25250f6eca9a2c0f0b (patch)
treedd806e2205c0ba17568cc1d076a196127fe85782
parentf8f51a858d4d7ff81127248b30a0cdaf167b0207 (diff)
downloadplatform_external_libaom-247da04c9e8d2f838bb3df25250f6eca9a2c0f0b.tar.gz
platform_external_libaom-247da04c9e8d2f838bb3df25250f6eca9a2c0f0b.tar.bz2
platform_external_libaom-247da04c9e8d2f838bb3df25250f6eca9a2c0f0b.zip
scripts to update local libaom
scripts reading in the upstream libaom, adding to our repo, creating the appropriate Android.bp and config information, and tracking what version of upstream libaom we have here. Bug: 111936705 Test: manual Change-Id: I3b22b034d73a86aa9042855e2953ad0aa011d7f4
-rw-r--r--Android.bp.in47
-rw-r--r--Android.mk1
-rw-r--r--README.android12
-rw-r--r--README.updating60
-rwxr-xr-xgenerate_config.sh126
-rwxr-xr-xupdate_libaom.sh154
6 files changed, 400 insertions, 0 deletions
diff --git a/Android.bp.in b/Android.bp.in
new file mode 100644
index 0000000..387d55f
--- /dev/null
+++ b/Android.bp.in
@@ -0,0 +1,47 @@
+cc_library_static {
+ name: "libaom",
+ vendor_available: true,
+ cflags: [
+ "-O3",
+ ],
+
+ export_include_dirs: [
+ "libaom",
+ ],
+
+ local_include_dirs: [
+ "libaom/third_party/libwebm/",
+ ],
+
+ arch: {
+ arm64: {
+ local_include_dirs: [
+ "config/arm64/",
+ ],
+ srcs: libaom_arm64_c_srcs,
+ },
+
+ arm: {
+ local_include_dirs: [
+ "config/arm/",
+ ],
+ srcs: libaom_arm_c_srcs,
+ },
+
+ x86_64: {
+ local_include_dirs: [
+ "config/x86_64/",
+ ],
+ srcs: libaom_x86_c_srcs,
+ },
+
+ x86: {
+ local_include_dirs: [
+ "config/x86/",
+ ],
+ srcs: libaom_x86_64_c_srcs,
+ },
+
+ },
+
+}
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..612c879
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1 @@
+#Empty Android.mk to shadow third_party/libwebm/Android.mk
diff --git a/README.android b/README.android
new file mode 100644
index 0000000..9f36ce9
--- /dev/null
+++ b/README.android
@@ -0,0 +1,12 @@
+Name: libaom
+URL: https://aomedia.googlesource.com
+Version: v1.0.0
+License: BSD
+License File: libaom/LICENSE
+
+See README.updating to learn how to pull in upstream updates
+Note that we should NOT be modifying the ./libaom subdirectory as it will
+be overwritten with the next execution of this script.
+
+Below this line is automatically generated. Do not test your luck.
+========
diff --git a/README.updating b/README.updating
new file mode 100644
index 0000000..41ada56
--- /dev/null
+++ b/README.updating
@@ -0,0 +1,60 @@
+Description:
+Contains the sources used to compile libaom.
+
+The libaom source is from webmproject.org:
+ https://aomedia.googlesource.com/aom
+
+Notes on updating libaom source code:
+
+Please follow these steps to update libvpx source code:
+
+1. Update libaom source tree. Look for "Current HEAD: <hash>" output to update
+ README.android. Look for "git log from upstream: <git log>" output to add
+ to the commit message.
+
+ ./update_libaom.sh [branch name]
+
+ [the script will automatically update README.android with the git HEAD information
+ and will also prepare a commit message for your use in a file "commit-message-yyyymmdd.hhmmss"
+
+2. Generate updated config files.
+
+ ./generate_config.sh
+
+ This requires some local x86, x86_64, arm, and arm64 tools.
+ The x86 and x86_64 tools are generally present on our development machines
+ The arm and arm64 tools can be installed with apt-get (Note that these
+ are just generic arm and arm64 tools, not the android-specific tools)
+
+ apt-get install g++-arm-linux-gnueabihf
+ apt-get install g++-aarch64-linux-gnu
+
+3. Update README.android file with any Version, Date, Branch, or Commit changes. The
+ version is in the file source/config/aom_version.h
+
+ [the Date, Branch, and Commit information is automatically updated in README.android as
+ part of the update_libaom.sh script you ran in step #1]
+
+4. Commit the changes. The commit message should look like this and is printed
+ by update_libaom.sh:
+ libaom: Pull from upstream
+
+ Current HEAD: <hash>
+
+ git log from upstream:
+ a6b2070 <git commit message 1>
+ 08dabbc <git commit message 2>
+ c29fb02 <git commit message 3>
+
+ [A commit message will be present in a file "commit-message-yyyymmdd.hhmmss" after
+ you run the update_libaom.sh command]
+
+Tools needed to build libaom:
+
+- generate_config.sh
+
+Generate config files that contain the source list for each platform.
+Configuration for the build is taken from aom_config.h for each platform.
+
+- arm and arm64 GNU compilation tools; the apt-get install lines are listed in step #2 above.
+
diff --git a/generate_config.sh b/generate_config.sh
new file mode 100755
index 0000000..7eb77b1
--- /dev/null
+++ b/generate_config.sh
@@ -0,0 +1,126 @@
+#!/bin/bash -e
+#
+#Copyright (C) 2018 The Android Open Source Project
+#
+#Licensed under the Apache License, Version 2.0 (the "License");
+#you may not use this file except in compliance with the License.
+#You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing, software
+#distributed under the License is distributed on an "AS IS" BASIS,
+#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#See the License for the specific language governing permissions and
+#limitations under the License.
+
+
+# This script is used to generate files in the <platform> directories needed to
+# build libaom. Every time libaom source code is updated run this script.
+#
+# $ ./generate_config.sh
+#
+# And this will update all the config files needed.
+
+BASE_DIR=$(pwd)
+LIBAOM_SRC_DIR="libaom"
+LIBAOM_CONFIG_DIR="config"
+TEMP_DIR="$LIBAOM_SRC_DIR.temp"
+ARCH_x86="x86"
+ARCH_x86_64="x86_64"
+ARCH_ARM="arm"
+ARCH_ARM_64="arm64"
+
+# Clean files from previous make.
+function make_clean {
+ make clean > /dev/null
+ rm -f libaom_srcs.txt
+}
+
+# Extract a list of C sources from a libaom_srcs.txt file
+# $1 - path to libaom_srcs.txt
+function libaom_srcs_txt_to_c_srcs {
+ ##grep "CMakeFiles" $1 | grep -v "aom_config.c"| grep -v "gen_src" | grep -v "encoder" | grep -v "mkvmuxer" | grep -v "hdr_util" | sed 's/.*dir/"libaom/' | sed 's/.o$/",/' | sort
+ grep "CMakeFiles" $1 | grep -v "aom_config.c"| grep -v "gen_src" | grep -v "encoder" | grep -v "mkvmuxer" | grep -v "hdr_util" | sed 's/.*dir/ "libaom/' | sed 's/.o$/",/' | sort
+}
+
+# Convert a list of sources to a blueprint file containing a variable
+# assignment.
+# $1 - arch type
+function gen_bp_srcs {
+ (
+ varprefix=libaom_${1//-/_}
+ echo "${varprefix}_c_srcs = ["
+ libaom_srcs_txt_to_c_srcs libaom_srcs_$1.txt
+ echo "\"$LIBAOM_CONFIG_DIR/$1/$LIBAOM_CONFIG_DIR/aom_config.c\","
+ echo "]"
+ echo
+ ) > $BASE_DIR/$TEMP_DIR/config_$1.bp
+}
+
+
+# Generate and copy config folder to $BASE_DIR/$LIBAOM_CONFIG_DIR/$1/$LIBAOM_CONFIG_DIR
+# $1 - arch type
+function libaom_gen_config {
+ mkdir $LIBAOM_CONFIG_DIR/$1
+ mkdir $TEMP_DIR/$1/
+ cd $TEMP_DIR/$1/
+
+ if [ $1 == $ARCH_x86_64 ]; then
+ cmake $BASE_DIR/$LIBAOM_SRC_DIR -DCONFIG_AV1_ENCODER=0 -DCONFIG_LOWBITDEPTH=0 -DCONFIG_LIBYUV=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_SH="CMAKE_SH-NOTFOUND" -G "Unix Makefiles" -DENABLE_AVX=0 -DENABLE_AVX2=0 -DENABLE_SSE4_1=0 -DENABLE_SSE4_2=0 -DENABLE_SSSE3=0 -DENABLE_SSE3=0 > /dev/null
+ make aom aom_common_app_util aom_decoder_app_util > libaom_srcs_$1.txt
+
+ elif [ $1 == $ARCH_x86 ]; then
+ cmake $BASE_DIR/$LIBAOM_SRC_DIR -DCONFIG_AV1_ENCODER=0 -DCONFIG_LOWBITDEPTH=0 -DCONFIG_LIBYUV=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_SH="CMAKE_SH-NOTFOUND" -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=$BASE_DIR/$LIBAOM_SRC_DIR/build/cmake/toolchains/x86-linux.cmake -DENABLE_AVX=0 -DENABLE_AVX2=0 -DENABLE_SSE4_1=0 -DENABLE_SSE4_2=0 -DENABLE_SSSE3=0 -DENABLE_SSE3=0
+ make aom aom_common_app_util aom_decoder_app_util > libaom_srcs_$1.txt
+
+ elif [ $1 == $ARCH_ARM ]; then
+ cmake $BASE_DIR/$LIBAOM_SRC_DIR -DCONFIG_AV1_ENCODER=0 -DCONFIG_LOWBITDEPTH=0 -DCONFIG_LIBYUV=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_SH="CMAKE_SH-NOTFOUND" -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=$BASE_DIR/$LIBAOM_SRC_DIR/build/cmake/toolchains/armv7-linux-gcc.cmake -DCROSS=arm-linux-gnueabihf-
+ make aom aom_common_app_util aom_decoder_app_util webm > libaom_srcs_$1.txt
+
+ elif [ $1 == $ARCH_ARM_64 ]; then
+ cmake $BASE_DIR/$LIBAOM_SRC_DIR -DCONFIG_AV1_ENCODER=0 -DCONFIG_LOWBITDEPTH=0 -DCONFIG_LIBYUV=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_SH="CMAKE_SH-NOTFOUND" -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=$BASE_DIR/$LIBAOM_SRC_DIR/build/cmake/toolchains/arm64-linux-gcc.cmake -DCROSS=aarch64-linux-gnu-
+ make aom aom_common_app_util aom_decoder_app_util webm > libaom_srcs_$1.txt
+
+ else
+ echo "Architecture not supported."
+ fi
+
+ gen_bp_srcs $1
+
+ rm $LIBAOM_CONFIG_DIR/*.cmake
+ cp -R $LIBAOM_CONFIG_DIR $BASE_DIR/$LIBAOM_CONFIG_DIR/$1
+ cd $BASE_DIR
+}
+
+# Remove the temporary directory in case it already exists and create a new temporary diretory.
+if [ -d "$TEMP_DIR" ]; then
+ rm -rf $TEMP_DIR
+fi
+
+mkdir $TEMP_DIR
+
+# Remove the config folder in case it already exists and create a new config folder.
+if [ -d "$LIBAOM_CONFIG_DIR" ]; then
+ rm -rf $LIBAOM_CONFIG_DIR
+fi
+
+mkdir $LIBAOM_CONFIG_DIR
+
+libaom_gen_config $ARCH_ARM_64
+libaom_gen_config $ARCH_ARM
+libaom_gen_config $ARCH_x86_64
+libaom_gen_config $ARCH_x86
+
+cd $BASE_DIR/$TEMP_DIR/
+(
+ echo "// THIS FILE IS AUTOGENERATED, DO NOT EDIT"
+ echo "// Generated from Android.bp.in, run ./generate_config.sh to regenerate"
+ echo
+ cat config_*.bp
+ cat $BASE_DIR/Android.bp.in
+) > $BASE_DIR/Android.bp
+
+cd $BASE_DIR
+rm -r $BASE_DIR/$TEMP_DIR/
+
diff --git a/update_libaom.sh b/update_libaom.sh
new file mode 100755
index 0000000..69fa6db
--- /dev/null
+++ b/update_libaom.sh
@@ -0,0 +1,154 @@
+#!/bin/bash -e
+#
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This tool is used to update libaom source code to a revision of the upstream
+# repository.
+
+# Usage:
+#
+# $ ./update_libaom.sh [branch | revision | file or url containing a revision]
+# When specifying a branch it may be necessary to prefix with origin/
+
+# Tools required for running this tool:
+#
+# 1. Linux / Mac
+# 2. git
+
+export LC_ALL=C
+
+# Location for the remote git repository.
+GIT_REPO="https://aomedia.googlesource.com/aom"
+
+# Update to TOT by default.
+GIT_BRANCH="origin/master"
+
+# Relative path of target checkout.
+LIBAOM_SRC_DIR="libaom"
+
+BASE_DIR=`pwd`
+
+if [ -n "$1" ]; then
+ GIT_BRANCH="$1"
+ if [ -f "$1" ]; then
+ GIT_BRANCH=$(<"$1")
+ elif [[ $1 = http* ]]; then
+ GIT_BRANCH=`curl $1`
+ fi
+fi
+
+prev_hash="$(egrep "^Commit: [[:alnum:]]" README.android | awk '{ print $2 }')"
+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
+
+# Start a local git repo.
+git clone $GIT_REPO .
+
+# Switch the content to the desired revision.
+git checkout -b tot $GIT_BRANCH
+
+add="$(git diff-index --diff-filter=A $prev_hash | \
+tr -s [:blank:] ' ' | cut -f6 -d\ )"
+delete="$(git diff-index --diff-filter=D $prev_hash | \
+tr -s [:blank:] ' ' | cut -f6 -d\ )"
+
+# Get the current commit hash.
+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
+
+# Commit message header.
+COMMIT_MSG=../commit-message-`date +"%Y%m%d.%H%M%S"`
+(
+ echo "libaom: Pull from upstream"
+ echo ""
+
+ # Output the current commit hash.
+ echo "Prev HEAD: $prev_hash"
+ echo "New 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 \
+ --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 \
+ --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}
+
+# Tell user about it
+echo "Commit message: (stored in ./${COMMIT_MSG})"
+echo "==============="
+cat ${COMMIT_MSG}
+echo ""
+echo "==============="
+
+# Git is useless now, remove the local git repo.
+rm -rf .git .gitignore .gitattributes
+
+# Add and remove files.
+echo "$add" | xargs -I {} git add {}
+echo "$delete" | xargs -I {} git rm --ignore-unmatch {}
+
+# Find empty directories and remove them.
+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