Backed out 10 changesets (bug 1803810) for xpcshell failures on test_import_global...
[gecko.git] / media / libaom / generate_sources_mozbuild.sh
blob071d75a8c7bdbe2758e104f4f33d95566dafdcbb
1 #!/bin/bash -e
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
7 # Modified from chromium/src/third_party/libaom/generate_gni.sh
9 # This script is used to generate sources.mozbuild and files in the
10 # config/platform directories needed to build libaom.
11 # Every time libaom source code is updated just run this script.
13 # Usage:
14 # $ ./generate_sources_mozbuild.sh
16 export LC_ALL=C
17 BASE_DIR=$(pwd)
18 LIBAOM_SRC_DIR="../../third_party/aom"
19 LIBAOM_CONFIG_DIR="config"
21 # Print license header.
22 # $1 - Output base name
23 function write_license {
24 echo "# This file is generated. Do not edit." >> $1
25 echo "" >> $1
28 # Generate *_rtcd.h files.
29 # $1 - Header file directory.
30 # $2 - Architecture.
31 # $3 - Optional - any additional arguments to pass through.
32 function gen_rtcd_header {
33 echo "Generate $LIBAOM_CONFIG_DIR/$1/*_rtcd.h files."
35 AOM_CONFIG=$BASE_DIR/$LIBAOM_CONFIG_DIR/$1/config/aom_config.h
37 $BASE_DIR/$LIBAOM_SRC_DIR/build/cmake/rtcd.pl \
38 --arch=$2 \
39 --sym=av1_rtcd $3 \
40 --config=$AOM_CONFIG \
41 $BASE_DIR/$LIBAOM_SRC_DIR/av1/common/av1_rtcd_defs.pl \
42 > $BASE_DIR/$LIBAOM_CONFIG_DIR/$1/config/av1_rtcd.h
44 $BASE_DIR/$LIBAOM_SRC_DIR/build/cmake/rtcd.pl \
45 --arch=$2 \
46 --sym=aom_scale_rtcd $3 \
47 --config=$AOM_CONFIG \
48 $BASE_DIR/$LIBAOM_SRC_DIR/aom_scale/aom_scale_rtcd.pl \
49 > $BASE_DIR/$LIBAOM_CONFIG_DIR/$1/config/aom_scale_rtcd.h
51 $BASE_DIR/$LIBAOM_SRC_DIR/build/cmake/rtcd.pl \
52 --arch=$2 \
53 --sym=aom_dsp_rtcd $3 \
54 --config=$AOM_CONFIG \
55 $BASE_DIR/$LIBAOM_SRC_DIR/aom_dsp/aom_dsp_rtcd_defs.pl \
56 > $BASE_DIR/$LIBAOM_CONFIG_DIR/$1/config/aom_dsp_rtcd.h
59 echo "Generating config files."
60 python3 -m venv temp
61 . temp/bin/activate
62 pip install pyparsing==2.4.7
63 python3 generate_sources_mozbuild.py
64 deactivate
65 rm -r temp
67 # Copy aom_version.h once. The file is the same for all platforms.
68 cp aom_version.h $BASE_DIR/$LIBAOM_CONFIG_DIR
70 gen_rtcd_header linux/x64 x86_64
71 gen_rtcd_header linux/ia32 x86
72 gen_rtcd_header mac/x64 x86_64
73 gen_rtcd_header win/x64 x86_64
74 gen_rtcd_header win/ia32 x86
76 gen_rtcd_header linux/arm armv7
78 gen_rtcd_header generic generic
80 cd $BASE_DIR/$LIBAOM_SRC_DIR
82 cd $BASE_DIR