Bug 1886378 - Rework source-list generation across platforms and architectrues r=glandium

Previously, source lists on different platforms were generated solely
based on architecture. Each architecture's source list would be copied
to lists on various platforms with the same architecture, with
modifications as necessary. However, with recently divergent settings
for platforms sharing the same architecture, maintaining a single list
and modifying it across different platforms becomes cumbersome.

To streamline this process and accommodate differing platform-specific
settings, this patch introduces a new approach. It generates source
lists for each platform-architecture combination. Consequently, source
lists for all platform-architecture combinations can be directly copied
without subsequent modifications. This simplifies maintenance across
different platforms and architectures.

Differential Revision: https://phabricator.services.mozilla.com/D206719
This commit is contained in:
Chun-Min Chang 2024-04-16 16:37:24 +00:00
parent 3f09a6a1c0
commit cdc4ec7b80
2 changed files with 57 additions and 24 deletions

View File

@ -204,7 +204,7 @@ all_platforms="${all_platforms} --disable-avx512"
x86_platforms="--enable-postproc --enable-vp9-postproc --as=yasm"
arm_platforms="--enable-runtime-cpu-detect --enable-realtime-only"
arm64_platforms="--enable-realtime-only"
disable_sve="--disable-sve" # Bug 1885585
disable_sve="--disable-sve" # Bug 1885585, Bug 1889813
gen_config_files linux/x64 "--target=x86_64-linux-gcc ${all_platforms} ${x86_platforms}"
gen_config_files linux/ia32 "--target=x86-linux-gcc ${all_platforms} ${x86_platforms}"
@ -251,34 +251,62 @@ rm -rf $BASE_DIR/sources.mozbuild
write_license $BASE_DIR/sources.mozbuild
echo "files = {" >> $BASE_DIR/sources.mozbuild
echo "Generate X86_64 source list."
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 X64
convert_srcs_to_project_files libvpx_srcs.txt 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
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
# 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."
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 IA32
convert_srcs_to_project_files libvpx_srcs.txt LINUX_IA32
echo "Generate ARM source list."
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
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
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 ARM
convert_srcs_to_project_files libvpx_srcs.txt LINUX_ARM
echo "Generate ARM64 source list."
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 ARM64
# Bug 1885585: The sve files will be excluded from the win/aarch64 build in moz.build.
# Bug 1889813: The sve files will be excluded from the linux/arm64 build in moz.build.
convert_srcs_to_project_files libvpx_srcs.txt 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
echo "Generate generic source list."
config=$(print_config generic)

View File

@ -14,37 +14,45 @@ if CONFIG['VPX_USE_NASM']:
# Linux, Mac and Win share file lists for x86* but not configurations.
if CONFIG['TARGET_CPU'] == 'x86_64':
EXPORTS.vpx += files['X64_EXPORTS']
SOURCES += files['X64_SOURCES']
if CONFIG['OS_TARGET'] == 'WINNT':
EXPORTS.vpx += files['WIN_X64_EXPORTS']
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':
EXPORTS.vpx += files['IA32_EXPORTS']
SOURCES += files['IA32_SOURCES']
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['ARM_EXPORTS']
EXPORTS.vpx += files['LINUX_ARM_EXPORTS']
ASFLAGS += [
'-I%s/media/libvpx/config/linux/arm/' % TOPSRCDIR,
'-I%s/libvpx' % OBJDIR,
@ -52,7 +60,7 @@ elif CONFIG['TARGET_CPU'] == 'arm':
LOCAL_INCLUDES += [ '/media/libvpx/config/linux/arm/' ]
SOURCES += [ '/media/libvpx/config/linux/arm/vpx_config.c' ]
arm_asm_files = files['ARM_SOURCES']
arm_asm_files = files['LINUX_ARM_SOURCES']
if CONFIG['GNU_AS']:
SOURCES += sorted([
@ -71,17 +79,14 @@ elif CONFIG['TARGET_CPU'] == 'arm':
'%%%s/sources/android/cpufeatures' % CONFIG['ANDROID_NDK'],
]
elif CONFIG['TARGET_CPU'] == 'aarch64' and CONFIG['OS_TARGET'] == 'WINNT':
EXPORTS.vpx += files['ARM64_EXPORTS']
# Bug 1885585: clang on win/aarch64 cannot compile SVInt8_t type for now.
SOURCES += [
f for f in files['ARM64_SOURCES'] if not f.endswith('_sve.c')
]
EXPORTS.vpx += files['WIN_AARCH64_EXPORTS']
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['ARM64_EXPORTS']
SOURCES += files['ARM64_SOURCES']
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' ]