summaryrefslogtreecommitdiffstats
path: root/media/libaom/lint_config.sh
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-10-15 21:44:18 -0500
committertrav90 <travawine@palemoon.org>2018-10-15 21:44:18 -0500
commit07c17b6b98ed32fcecff15c083ab0fd878de3cf0 (patch)
tree403ca55d2e61cf99e2140714ef3555ec51301b8b /media/libaom/lint_config.sh
parentb927e0d5caad3a7703829bdc1093bfc67ef3fb97 (diff)
downloadUXP-07c17b6b98ed32fcecff15c083ab0fd878de3cf0.tar
UXP-07c17b6b98ed32fcecff15c083ab0fd878de3cf0.tar.gz
UXP-07c17b6b98ed32fcecff15c083ab0fd878de3cf0.tar.lz
UXP-07c17b6b98ed32fcecff15c083ab0fd878de3cf0.tar.xz
UXP-07c17b6b98ed32fcecff15c083ab0fd878de3cf0.zip
Port the libvpx mozbuild generator to aom
This is a port of the libvpx scripts, themselves a port of Chromium's scripts to generate an external build description using hooks in the upstream configure and make scripts. The libaom library is a fork of libvpx so we can use a similar approach. The upstream source is located in $(topsrc_dir)/third_party/aom but the build description and any patches are under the media directory with the other codecs, similar to how zlib works. Config files and headers generated by the upstream build system are also under $(topsrc_dir)/media/libaom/.
Diffstat (limited to 'media/libaom/lint_config.sh')
-rwxr-xr-xmedia/libaom/lint_config.sh112
1 files changed, 112 insertions, 0 deletions
diff --git a/media/libaom/lint_config.sh b/media/libaom/lint_config.sh
new file mode 100755
index 000000000..1a6c96dfb
--- /dev/null
+++ b/media/libaom/lint_config.sh
@@ -0,0 +1,112 @@
+#!/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 script is used to compare vpx_config.h and vpx_config.asm to
+# verify the two files match.
+#
+# Arguments:
+#
+# -h - C Header file.
+# -a - ASM file.
+# -p - Print the options if correct.
+# -o - Output file.
+#
+# Usage:
+#
+# # Compare the two configuration files and output the final results.
+# ./lint_config.sh -h vpx_config.h -a vpx_config.asm -o libvpx.config -p
+
+export LC_ALL=C
+print_final="no"
+
+while getopts "h:a:o:p" flag
+do
+ if [ "$flag" = "h" ]; then
+ header_file=$OPTARG
+ elif [ "$flag" = "a" ]; then
+ asm_file=$OPTARG
+ elif [ "$flag" = "o" ]; then
+ out_file=$OPTARG
+ elif [ "$flag" = "p" ]; then
+ print_final="yes"
+ fi
+done
+
+if [ -z "$header_file" ]; then
+ echo "Header file not specified."
+ false
+ exit
+fi
+
+if [ -z "$asm_file" ]; then
+ echo "ASM file not specified."
+ false
+ exit
+fi
+
+# Concat header file and assembly file and select those ended with 0 or 1.
+combined_config="$(cat $header_file $asm_file | grep -E ' +[01] *$')"
+
+# Extra filtering for known exceptions.
+combined_config="$(echo "$combined_config" | grep -v WIDE_REFERENCE)"
+combined_config="$(echo "$combined_config" | grep -v ARCHITECTURE)"
+combined_config="$(echo "$combined_config" | grep -v DO1STROUNDING)"
+
+# Remove all spaces.
+combined_config="$(echo "$combined_config" | sed 's/[ \t]//g')"
+
+# Remove #define in the header file.
+combined_config="$(echo "$combined_config" | sed 's/.*define//')"
+
+# Remove equ in the ASM file.
+combined_config="$(echo "$combined_config" | sed 's/\.equ//')" # gas style
+combined_config="$(echo "$combined_config" | sed 's/equ//')" # rvds style
+combined_config="$(echo "$combined_config" | sed 's/\.set//')" # apple style
+
+# Remove %define in YASM ASM files.
+combined_config="$(echo "$combined_config" | sed 's/%define\s *//')" # yasm style
+
+# Remove useless comma in gas style assembly file.
+combined_config="$(echo "$combined_config" | sed 's/,//')"
+
+# Substitute 0 with =no.
+combined_config="$(echo "$combined_config" | sed 's/0$/=no/')"
+
+# Substitute 1 with =yes.
+combined_config="$(echo "$combined_config" | sed 's/1$/=yes/')"
+
+# Find the mismatch variables.
+odd_config="$(echo "$combined_config" | sort | uniq -u)"
+odd_vars="$(echo "$odd_config" | sed 's/=.*//' | uniq)"
+
+for var in $odd_vars; do
+ echo "Error: Configuration mismatch for $var."
+ echo "Header file: $header_file"
+ echo "$(cat -n $header_file | grep "$var[ \t]")"
+ echo "Assembly file: $asm_file"
+ echo "$(cat -n $asm_file | grep "$var[ \t]")"
+ echo ""
+done
+
+if [ -n "$odd_vars" ]; then
+ false
+ exit
+fi
+
+if [ "$print_final" = "no" ]; then
+ exit
+fi
+
+# Do some additional filter to make libvpx happy.
+combined_config="$(echo "$combined_config" | grep -v ARCH_X86=no)"
+combined_config="$(echo "$combined_config" | grep -v ARCH_X86_64=no)"
+
+# Print out the unique configurations.
+if [ -n "$out_file" ]; then
+ echo "$combined_config" | sort | uniq > $out_file
+else
+ echo "$combined_config" | sort | uniq
+fi