Bug 1476408 - No longer necessary to run lint_config.sh anymore; r=TD-Linux
authorDan Minor <dminor@mozilla.com>
Mon, 23 Jul 2018 16:08:09 -0400
changeset 823531 6054e26e2f98fb8b780c83d76554c46f3cc1f6fa
parent 823530 7714681863fe70dadcaf4702f5a1a357bef46e22
child 823532 3c9776cc9cb5bc5a2a5b65217a74021b2919c98c
push id117712
push userrwood@mozilla.com
push dateFri, 27 Jul 2018 15:10:54 +0000
reviewersTD-Linux
bugs1476408
milestone63.0a1
Bug 1476408 - No longer necessary to run lint_config.sh anymore; r=TD-Linux Summary: Upstream can now code generate the rtcd interface files directly from the aom_config.h header, so we no longer have to generate an intermediate file by running lint_config.sh. This also means we can remove the code for creating a temporary directory. Reviewers: TD-Linux Tags: #secure-revision Bug #: 1476408 Differential Revision: https://phabricator.services.mozilla.com/D2357
media/libaom/generate_sources_mozbuild.sh
media/libaom/lint_config.sh
--- a/media/libaom/generate_sources_mozbuild.sh
+++ b/media/libaom/generate_sources_mozbuild.sh
@@ -20,88 +20,61 @@ LIBAOM_CONFIG_DIR="config"
 
 # Print license header.
 # $1 - Output base name
 function write_license {
   echo "# This file is generated. Do not edit." >> $1
   echo "" >> $1
 }
 
-# Print the configuration.
-# $1 - Header file directory.
-function print_config {
-  $BASE_DIR/lint_config.sh -p \
-    -h $BASE_DIR/$LIBAOM_CONFIG_DIR/$1/config/aom_config.h \
-    -a $BASE_DIR/$LIBAOM_CONFIG_DIR/$1/config/aom_config.asm
-}
-
 # Generate *_rtcd.h files.
 # $1 - Header file directory.
 # $2 - Architecture.
 # $3 - Optional - any additional arguments to pass through.
 function gen_rtcd_header {
   echo "Generate $LIBAOM_CONFIG_DIR/$1/*_rtcd.h files."
 
-  rm -rf $TEMP_DIR/libaom.config
-  $BASE_DIR/lint_config.sh -p \
-    -h $BASE_DIR/$LIBAOM_CONFIG_DIR/$1/config/aom_config.h \
-    -a $BASE_DIR/$LIBAOM_CONFIG_DIR/$1/config/aom_config.asm \
-    -o $TEMP_DIR/libaom.config
+  AOM_CONFIG=$BASE_DIR/$LIBAOM_CONFIG_DIR/$1/config/aom_config.h
 
   $BASE_DIR/$LIBAOM_SRC_DIR/build/make/rtcd.pl \
     --arch=$2 \
     --sym=aom_rtcd $3 \
-    --config=$TEMP_DIR/libaom.config \
+    --config=$AOM_CONFIG \
     $BASE_DIR/$LIBAOM_SRC_DIR/av1/common/av1_rtcd_defs.pl \
     > $BASE_DIR/$LIBAOM_CONFIG_DIR/$1/config/av1_rtcd.h
 
   $BASE_DIR/$LIBAOM_SRC_DIR/build/make/rtcd.pl \
     --arch=$2 \
     --sym=aom_scale_rtcd $3 \
-    --config=$TEMP_DIR/libaom.config \
+    --config=$AOM_CONFIG \
     $BASE_DIR/$LIBAOM_SRC_DIR/aom_scale/aom_scale_rtcd.pl \
     > $BASE_DIR/$LIBAOM_CONFIG_DIR/$1/config/aom_scale_rtcd.h
 
   $BASE_DIR/$LIBAOM_SRC_DIR/build/make/rtcd.pl \
     --arch=$2 \
     --sym=aom_dsp_rtcd $3 \
-    --config=$TEMP_DIR/libaom.config \
+    --config=$AOM_CONFIG \
     $BASE_DIR/$LIBAOM_SRC_DIR/aom_dsp/aom_dsp_rtcd_defs.pl \
     > $BASE_DIR/$LIBAOM_CONFIG_DIR/$1/config/aom_dsp_rtcd.h
-
-  rm -rf $TEMP_DIR/libaom.config
 }
 
 echo "Generating config files."
 cd $BASE_DIR
 python generate_sources_mozbuild.py
 
 # Copy aom_version.h once. The file is the same for all platforms.
 cp aom_version.h $BASE_DIR/$LIBAOM_CONFIG_DIR
 
-echo "Remove temporary directory."
-rm -rf $TEMP_DIR
-
-echo "Create temporary directory."
-TEMP_DIR="$BASE_DIR/.temp"
-rm -rf $TEMP_DIR
-cp -R $LIBAOM_SRC_DIR $TEMP_DIR
-cd $TEMP_DIR
-
 gen_rtcd_header linux/x64 x86_64
 gen_rtcd_header linux/ia32 x86
 gen_rtcd_header mac/x64 x86_64
 gen_rtcd_header win/x64 x86_64
 gen_rtcd_header win/ia32 x86
 gen_rtcd_header win/mingw32 x86
 gen_rtcd_header win/mingw64 x86_64
 
 gen_rtcd_header linux/arm armv7
 
 gen_rtcd_header generic generic
 
-echo "Remove temporary directory."
-cd $BASE_DIR
-rm -rf $TEMP_DIR
-
 cd $BASE_DIR/$LIBAOM_SRC_DIR
 
 cd $BASE_DIR
deleted file mode 100755
--- a/media/libaom/lint_config.sh
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/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)"
-
-# aom_dsp_rtcd_defs.h checks for definition here, not value.
-combined_config="$(echo "$combined_config" | grep -v CONFIG_EXT_PARTITION_TYPES=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