Quelle generate_sources_mozbuild.sh
Sprache: Shell
#!/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.
# Modified from chromium/src/third_party/libvpx/generate_gni.sh
# This script is used to generate sources.mozbuild and files in the # config/platform directories needed to build libvpx. # Every time libvpx source code is updated just run this script. # # Usage: # $ ./generate_sources_mozbuild.sh
# Print license header. # $1 - Output base name function write_license { echo"# This file is generated. Do not edit." >> $1 echo"" >> $1
}
# Search for source files with the same basename in vp8, vp9, and vpx_dsp. The # build does not support duplicate file names. function find_duplicates {
local readonly duplicate_file_names=$(find \
$BASE_DIR/$LIBVPX_SRC_DIR/vp8 \
$BASE_DIR/$LIBVPX_SRC_DIR/vp9 \
$BASE_DIR/$LIBVPX_SRC_DIR/vpx_dsp \
-type f -name \*.c | xargs -I {} basename {} | sort | uniq -d \
)
if [ -n "${duplicate_file_names}" ]; then echo"ERROR: DUPLICATE FILES FOUND" for file in ${duplicate_file_names}; do
find \
$BASE_DIR/$LIBVPX_SRC_DIR/vp8 \
$BASE_DIR/$LIBVPX_SRC_DIR/vp9 \
$BASE_DIR/$LIBVPX_SRC_DIR/vpx_dsp \
-name $file done
exit 1 fi
}
# Generate sources.mozbuild with a list of source files. # $1 - Array name for file list. This is processed with 'declare' below to # regenerate the array locally. # $2 - Variable name. # $3 - Output file. function write_sources { # Convert the first argument back in to an array.
declare -a file_list=("${!1}")
echo" '$2': [" >> "$3" for f in $file_list do echo" 'libvpx/$f'," >> "$3" done echo"]," >> "$3"
}
# Convert a list of source files into sources.mozbuild. # $1 - Input file. # $2 - Output prefix. # $3 - Path of vpx_config.c under $LIBVPX_CONFIG_DIR function convert_srcs_to_project_files { # Do the following here: # 1. Filter .c, .h, .s, .S and .asm files. # 3. Convert .asm.s to .asm because moz.build will do the conversion.
local source_list=$(grep -E '(\.c|\.h|\.S|\.s|\.asm)$' $1)
# Adjust the path for vpx_config.c while maintaining list order: # Since the config file resides in $BASE_DIR/$LIBVPX_CONFIG_DIR, while the # files in $source_list are placed under $BASE_DIR/libvpx (see write_sources), # the config file path requires adjustment. To ensure the list remains sorted, # we must first remove it and then insert it at the beginning of the list.
# Remove vpx_config.c
source_list=$(echo"$source_list" | grep -v 'vpx_config\.c') # Insert vpx_config.c at the beginning of the list.
local config=$(echo"../$LIBVPX_CONFIG_DIR/$3/vpx_config.c")
source_list=$(echo"$config" ; echo"$source_list")
# The actual ARM files end in .asm. We have rules to translate them to .S
source_list=$(echo"$source_list" | sed s/\.asm\.s$/.asm/)
# Exports - everything in vpx, vpx_mem, vpx_ports, vpx_scale
local exports_list=$(echo"$source_list" | \
egrep '^(vpx|vpx_mem|vpx_ports|vpx_scale)/.*h$') # but not anything in one level down, like 'internal'
exports_list=$(echo"$exports_list" | egrep -v '/(internal|src)/') # or any of the other internal-ish header files.
exports_list=$(echo"$exports_list" | egrep -v '/(emmintrin_compat.h|mem_.*|msvc.h|vpx_once.h)$')
# Remove these files from the main list.
source_list=$(comm -23 <(echo"$source_list") <(echo"$exports_list"))
# Write a single file that includes all source files for all archs.
local c_sources=$(echo"$source_list" | egrep '.(asm|c)$')
local exports_sources=$(echo"$exports_list" | egrep '.h$')
echo"Generate X86_64 source list on Linux."
config=$(print_config linux/x64)
make_clean make libvpx_srcs.txt target=libs $config > /dev/null
convert_srcs_to_project_files libvpx_srcs.txt LINUX_X64 linux/x64
echo"Generate X86_64 source list on Mac."
config=$(print_config mac/x64)
make_clean make libvpx_srcs.txt target=libs $config > /dev/null
convert_srcs_to_project_files libvpx_srcs.txt MAC_X64 mac/x64
echo"Generate X86_64 source list on Windows."
config=$(print_config win/x64)
make_clean make libvpx_srcs.txt target=libs $config > /dev/null
convert_srcs_to_project_files libvpx_srcs.txt WIN_X64 win/x64
# Copy vpx_version.h once. The file is the same for all platforms. cp vpx_version.h $BASE_DIR/$LIBVPX_CONFIG_DIR
echo"Generate IA32 source list on Linux."
config=$(print_config linux/ia32)
make_clean make libvpx_srcs.txt target=libs $config > /dev/null
convert_srcs_to_project_files libvpx_srcs.txt LINUX_IA32 linux/ia32
echo"Generate IA32 source list on Mac."
config=$(print_config mac/ia32)
make_clean make libvpx_srcs.txt target=libs $config > /dev/null
convert_srcs_to_project_files libvpx_srcs.txt MAC_IA32 mac/ia32
echo"Generate IA32 source list on Windows."
config=$(print_config win/ia32)
make_clean make libvpx_srcs.txt target=libs $config > /dev/null
convert_srcs_to_project_files libvpx_srcs.txt WIN_IA32 win/ia32
echo"Generate ARM source list on Linux."
config=$(print_config linux/arm)
make_clean make libvpx_srcs.txt target=libs $config > /dev/null
convert_srcs_to_project_files libvpx_srcs.txt LINUX_ARM linux/arm
echo"Generate ARM64 source list on Linux"
config=$(print_config linux/arm64)
make_clean make libvpx_srcs.txt target=libs $config > /dev/null
convert_srcs_to_project_files libvpx_srcs.txt LINUX_ARM64 linux/arm64
echo"Generate ARM64 source list on Mac"
config=$(print_config mac/arm64)
make_clean make libvpx_srcs.txt target=libs $config > /dev/null
convert_srcs_to_project_files libvpx_srcs.txt MAC_ARM64 mac/arm64
echo"Generate AARCH64 source list on Windows."
config=$(print_config win/aarch64)
make_clean make libvpx_srcs.txt target=libs $config > /dev/null
convert_srcs_to_project_files libvpx_srcs.txt WIN_AARCH64 win/aarch64
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.