Bug 1886378 - Include vpx_config.c directly in source list r=glandium

Initially, *vpx_config.c* on various platform-architecture combinations
was revmoed from the input list for source list generation and later
added to the source list in moz.build. This was necessary because the
generated list was based solely on architecture, while the vpx_config.c
differed across platform-architecture combinations.

With the source list generation reworked in the previous patch, each
platform-architecture combination now has its own list. Therefore,
vpx_config.c can be directly included in the source list, simplifying
the process.

Differential Revision: https://phabricator.services.mozilla.com/D207183
This commit is contained in:
Chun-Min Chang 2024-04-16 16:37:25 +00:00
Родитель cdc4ec7b80
Коммит 6f46fb6bb4
2 изменённых файлов: 20 добавлений и 21 удалений

Просмотреть файл

@ -69,6 +69,7 @@ function write_sources {
# 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.
@ -76,9 +77,17 @@ function convert_srcs_to_project_files {
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.
# The platform-specific vpx_config.c will be added into in moz.build later.
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")
# Remove include-only asm files (no object code emitted)
source_list=$(echo "$source_list" | grep -v 'x86_abi_support\.asm')
@ -255,19 +264,19 @@ 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
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
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
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
@ -276,43 +285,43 @@ 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
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
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
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
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
convert_srcs_to_project_files libvpx_srcs.txt LINUX_ARM64 linux/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
convert_srcs_to_project_files libvpx_srcs.txt WIN_AARCH64 win/aarch64
echo "Generate generic source list."
config=$(print_config generic)
make_clean
make libvpx_srcs.txt target=libs $config > /dev/null
convert_srcs_to_project_files libvpx_srcs.txt GENERIC
convert_srcs_to_project_files libvpx_srcs.txt GENERIC generic
echo "}" >> $BASE_DIR/sources.mozbuild

Просмотреть файл

@ -19,38 +19,32 @@ if CONFIG['TARGET_CPU'] == 'x86_64':
SOURCES += files['WIN_X64_SOURCES']
ASFLAGS += [ '-I%s/media/libvpx/config/win/x64/' % TOPSRCDIR ]
LOCAL_INCLUDES += [ '/media/libvpx/config/win/x64/' ]
SOURCES += [ '/media/libvpx/config/win/x64/vpx_config.c' ]
elif CONFIG['OS_TARGET'] == 'Darwin':
EXPORTS.vpx += files['MAC_X64_EXPORTS']
SOURCES += files['MAC_X64_SOURCES']
ASFLAGS += [ '-I%s/media/libvpx/config/mac/x64/' % TOPSRCDIR ]
LOCAL_INCLUDES += [ '/media/libvpx/config/mac/x64/' ]
SOURCES += [ '/media/libvpx/config/mac/x64/vpx_config.c' ]
else: # Android, Linux, BSDs, etc.
EXPORTS.vpx += files['LINUX_X64_EXPORTS']
SOURCES += files['LINUX_X64_SOURCES']
ASFLAGS += [ '-I%s/media/libvpx/config/linux/x64/' % TOPSRCDIR ]
LOCAL_INCLUDES += [ '/media/libvpx/config/linux/x64/' ]
SOURCES += [ '/media/libvpx/config/linux/x64/vpx_config.c' ]
elif CONFIG['TARGET_CPU'] == 'x86':
if CONFIG['OS_TARGET'] == 'WINNT':
EXPORTS.vpx += files['WIN_IA32_EXPORTS']
SOURCES += files['WIN_IA32_SOURCES']
ASFLAGS += [ '-I%s/media/libvpx/config/win/ia32/' % TOPSRCDIR ]
LOCAL_INCLUDES += [ '/media/libvpx/config/win/ia32/' ]
SOURCES += [ '/media/libvpx/config/win/ia32/vpx_config.c' ]
elif CONFIG['OS_TARGET'] == 'Darwin':
EXPORTS.vpx += files['MAC_IA32_EXPORTS']
SOURCES += files['MAC_IA32_SOURCES']
ASFLAGS += [ '-I%s/media/libvpx/config/mac/ia32/' % TOPSRCDIR ]
LOCAL_INCLUDES += [ '/media/libvpx/config/mac/ia32/' ]
SOURCES += [ '/media/libvpx/config/mac/ia32/vpx_config.c' ]
else: # Android, Linux, BSDs, etc.
EXPORTS.vpx += files['LINUX_IA32_EXPORTS']
SOURCES += files['LINUX_IA32_SOURCES']
ASFLAGS += [ '-I%s/media/libvpx/config/linux/ia32/' % TOPSRCDIR ]
LOCAL_INCLUDES += [ '/media/libvpx/config/linux/ia32/' ]
SOURCES += [ '/media/libvpx/config/linux/ia32/vpx_config.c' ]
elif CONFIG['TARGET_CPU'] == 'arm':
EXPORTS.vpx += files['LINUX_ARM_EXPORTS']
ASFLAGS += [
@ -58,7 +52,6 @@ elif CONFIG['TARGET_CPU'] == 'arm':
'-I%s/libvpx' % OBJDIR,
]
LOCAL_INCLUDES += [ '/media/libvpx/config/linux/arm/' ]
SOURCES += [ '/media/libvpx/config/linux/arm/vpx_config.c' ]
arm_asm_files = files['LINUX_ARM_SOURCES']
@ -83,20 +76,17 @@ elif CONFIG['TARGET_CPU'] == 'aarch64' and CONFIG['OS_TARGET'] == 'WINNT':
SOURCES += files['WIN_AARCH64_SOURCES']
ASFLAGS += [ '-I%s/media/libvpx/config/win/aarch64/' % TOPSRCDIR ]
LOCAL_INCLUDES += [ '/media/libvpx/config/win/aarch64/' ]
SOURCES += [ '/media/libvpx/config/win/aarch64/vpx_config.c' ]
elif CONFIG['TARGET_CPU'] == 'aarch64':
EXPORTS.vpx += files['LINUX_ARM64_EXPORTS']
SOURCES += files['LINUX_ARM64_SOURCES']
ASFLAGS += [ '-I%s/media/libvpx/config/linux/arm64/' % TOPSRCDIR ]
LOCAL_INCLUDES += [ '/media/libvpx/config/linux/arm64/' ]
SOURCES += [ '/media/libvpx/config/linux/arm64/vpx_config.c' ]
else:
# Generic C-only configuration
EXPORTS.vpx += files['GENERIC_EXPORTS']
SOURCES += files['GENERIC_SOURCES']
ASFLAGS += [ '-I%s/media/libvpx/config/generic/' % TOPSRCDIR ]
LOCAL_INCLUDES += [ '/media/libvpx/config/generic/' ]
SOURCES += [ '/media/libvpx/config/generic/vpx_config.c' ]
# We allow warnings for third-party code that can be updated from upstream.
AllowCompilerWarnings()