Merge branch 'workarounds' into feature

This commit is contained in:
arch1t3cht 2023-10-13 23:55:52 +02:00
commit ee247419b6
8 changed files with 146 additions and 3123 deletions

View File

@ -1,6 +1,6 @@
project('Aegisub', ['c', 'cpp'],
license: 'BSD-3-Clause',
meson_version: '>=0.61.0',
meson_version: '>=1.0.0',
default_options: ['cpp_std=c++14', 'buildtype=debugoptimized'],
version: '3.2.2')

View File

@ -1,8 +1,8 @@
[wrap-git]
directory = dav1d
url = https://github.com/videolan/dav1d.git
revision = 0.9.2
patch_directory = dav1d
revision = head
diff_files = dav1d/0001.patch
[provide]
dav1d = dav1d_dep

View File

@ -1,8 +1,8 @@
[wrap-git]
directory = ffmpeg
url = https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg.git
revision = c7a42b33c46c7b52f5e5c908e78bc411555aac1f
patch_directory = ffmpeg
revision = head
diff_files = ffmpeg/0001.patch
[provide]
libavformat = libavformat_dep

View File

@ -0,0 +1,39 @@
diff --git a/include/dav1d/dav1d.h b/include/dav1d/dav1d.h
index e8f0705..ff48ea0 100644
--- a/include/dav1d/dav1d.h
+++ b/include/dav1d/dav1d.h
@@ -34,7 +34,7 @@
#include "common.h"
#include "picture.h"
#include "data.h"
-#include "version.h"
+#include "dav1d_version.h"
#ifdef __cplusplus
extern "C" {
diff --git a/include/dav1d/meson.build b/include/dav1d/meson.build
index 68faaf9..09b0239 100644
--- a/include/dav1d/meson.build
+++ b/include/dav1d/meson.build
@@ -28,7 +28,7 @@ version_h_data.set('DAV1D_API_VERSION_MAJOR', dav1d_api_version_major)
version_h_data.set('DAV1D_API_VERSION_MINOR', dav1d_api_version_minor)
version_h_data.set('DAV1D_API_VERSION_PATCH', dav1d_api_version_revision)
version_h_target = configure_file(input: 'version.h.in',
- output: 'version.h',
+ output: 'dav1d_version.h',
configuration: version_h_data)
dav1d_api_headers = [
diff --git a/src/meson.build b/src/meson.build
index 3a34e76..53ef660 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -335,7 +335,7 @@ libdav1d = library('dav1d',
)
dav1d_dep = declare_dependency(link_with: libdav1d,
- include_directories : include_directories('../include/dav1d')
+ include_directories : include_directories('../include/', '../include/dav1d/')
)
#

View File

@ -1,366 +0,0 @@
# Copyright © 2018-2019, VideoLAN and dav1d authors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Build definition for the dav1d library
#
# libdav1d source files
libdav1d_sources = files(
'cdf.c',
'cpu.c',
'data.c',
'decode.c',
'dequant_tables.c',
'getbits.c',
'intra_edge.c',
'itx_1d.c',
'lf_mask.c',
'log.c',
'mem.c',
'msac.c',
'obu.c',
'picture.c',
'qm.c',
'ref.c',
'refmvs.c',
'scan.c',
'tables.c',
'warpmv.c',
'wedge.c',
)
# libdav1d bitdepth source files
# These files are compiled for each bitdepth with
# `BITDEPTH` defined to the currently built bitdepth.
libdav1d_tmpl_sources = files(
'cdef_apply_tmpl.c',
'cdef_tmpl.c',
'fg_apply_tmpl.c',
'film_grain_tmpl.c',
'ipred_prepare_tmpl.c',
'ipred_tmpl.c',
'itx_tmpl.c',
'lf_apply_tmpl.c',
'loopfilter_tmpl.c',
'looprestoration_tmpl.c',
'lr_apply_tmpl.c',
'mc_tmpl.c',
'recon_tmpl.c',
)
libdav1d_arch_tmpl_sources = []
libdav1d_bitdepth_objs = []
# libdav1d entrypoint source files
# These source files contain library entry points and are
# built with the stack-realign flag set, where necessary.
libdav1d_entrypoints_sources = files(
'lib.c',
'thread_task.c'
)
# ASM specific sources
libdav1d_asm_objs = []
# Arch-specific flags
arch_flags = []
if is_asm_enabled
if (host_machine.cpu_family() == 'aarch64' or
host_machine.cpu_family().startswith('arm'))
libdav1d_sources += files(
'arm/cpu.c',
'arm/refmvs_init.c',
)
libdav1d_tmpl_sources += files(
'arm/cdef_init_tmpl.c',
'arm/film_grain_init_tmpl.c',
'arm/ipred_init_tmpl.c',
'arm/itx_init_tmpl.c',
'arm/loopfilter_init_tmpl.c',
'arm/looprestoration_init_tmpl.c',
'arm/mc_init_tmpl.c',
)
if (host_machine.cpu_family() == 'aarch64' or
host_machine.cpu() == 'arm64')
libdav1d_sources_asm = files(
# itx.S is used for both 8 and 16 bpc.
'arm/64/itx.S',
'arm/64/looprestoration_common.S',
'arm/64/msac.S',
'arm/64/refmvs.S',
)
if dav1d_bitdepths.contains('8')
libdav1d_sources_asm += files(
'arm/64/cdef.S',
'arm/64/film_grain.S',
'arm/64/ipred.S',
'arm/64/loopfilter.S',
'arm/64/looprestoration.S',
'arm/64/mc.S',
)
endif
if dav1d_bitdepths.contains('16')
libdav1d_sources_asm += files(
'arm/64/cdef16.S',
'arm/64/film_grain16.S',
'arm/64/ipred16.S',
'arm/64/itx16.S',
'arm/64/loopfilter16.S',
'arm/64/looprestoration16.S',
'arm/64/mc16.S',
)
endif
elif host_machine.cpu_family().startswith('arm')
libdav1d_sources_asm = files(
# itx.S is used for both 8 and 16 bpc.
'arm/32/itx.S',
'arm/32/looprestoration_common.S',
'arm/32/msac.S',
'arm/32/refmvs.S',
)
if dav1d_bitdepths.contains('8')
libdav1d_sources_asm += files(
'arm/32/cdef.S',
'arm/32/film_grain.S',
'arm/32/ipred.S',
'arm/32/loopfilter.S',
'arm/32/looprestoration.S',
'arm/32/mc.S',
)
endif
if dav1d_bitdepths.contains('16')
libdav1d_sources_asm += files(
'arm/32/cdef16.S',
'arm/32/film_grain16.S',
'arm/32/ipred16.S',
'arm/32/itx16.S',
'arm/32/loopfilter16.S',
'arm/32/looprestoration16.S',
'arm/32/mc16.S',
)
endif
endif
if use_gaspp
libdav1d_asm_objs = gaspp_gen.process(libdav1d_sources_asm)
else
libdav1d_sources += libdav1d_sources_asm
endif
elif host_machine.cpu_family().startswith('x86')
libdav1d_sources += files(
'x86/cpu.c',
'x86/msac_init.c',
'x86/refmvs_init.c',
)
libdav1d_tmpl_sources += files(
'x86/cdef_init_tmpl.c',
'x86/film_grain_init_tmpl.c',
'x86/ipred_init_tmpl.c',
'x86/itx_init_tmpl.c',
'x86/loopfilter_init_tmpl.c',
'x86/looprestoration_init_tmpl.c',
'x86/mc_init_tmpl.c',
)
# NASM source files
libdav1d_sources_asm = files(
'x86/cpuid.asm',
'x86/msac.asm',
'x86/refmvs.asm',
'x86/cdef_avx2.asm',
'x86/itx_avx2.asm',
'x86/looprestoration_avx2.asm',
'x86/cdef_sse.asm',
'x86/itx_sse.asm',
)
if dav1d_bitdepths.contains('8')
libdav1d_sources_asm += files(
'x86/cdef_avx512.asm',
'x86/mc_avx512.asm',
'x86/mc_avx2.asm',
'x86/film_grain_avx2.asm',
'x86/ipred_avx2.asm',
'x86/loopfilter_avx2.asm',
'x86/film_grain_sse.asm',
'x86/ipred_sse.asm',
'x86/loopfilter_sse.asm',
'x86/looprestoration_sse.asm',
'x86/mc_sse.asm',
)
endif
if dav1d_bitdepths.contains('16')
libdav1d_sources_asm += files(
'x86/cdef16_avx2.asm',
'x86/film_grain16_avx2.asm',
'x86/ipred16_avx2.asm',
'x86/itx16_avx2.asm',
'x86/loopfilter16_avx2.asm',
'x86/looprestoration16_avx2.asm',
'x86/mc16_avx2.asm',
'x86/cdef16_sse.asm',
'x86/film_grain16_sse.asm',
'x86/ipred16_sse.asm',
'x86/itx16_sse.asm',
'x86/loopfilter16_sse.asm',
'x86/looprestoration16_sse.asm',
'x86/mc16_sse.asm',
)
endif
# Compile the ASM sources with NASM
libdav1d_asm_objs = nasm_gen.process(libdav1d_sources_asm)
elif host_machine.cpu() == 'ppc64le'
arch_flags = ['-maltivec', '-mvsx']
libdav1d_sources += files(
'ppc/cpu.c',
)
libdav1d_arch_tmpl_sources += files(
'ppc/cdef_init_tmpl.c',
'ppc/looprestoration_init_tmpl.c',
)
endif
endif
api_export_flags = []
#
# Windows .rc file and API export flags
#
if host_machine.system() == 'windows' and get_option('default_library') != 'static'
rc_file = configure_file(
input : 'dav1d.rc.in',
output : 'dav1d.rc',
configuration : rc_data
)
libdav1d_rc_obj = winmod.compile_resources(rc_file)
api_export_flags = ['-DDAV1D_BUILDING_DLL']
else
libdav1d_rc_obj = []
endif
#
# Library definitions
#
# Helper library for dav1d entrypoints
libdav1d_entrypoints_objs = static_library('dav1d_entrypoint',
libdav1d_entrypoints_sources,
rev_target, config_h_target,
include_directories : dav1d_inc_dirs,
dependencies: [stdatomic_dependencies],
c_args : [stackalign_flag, stackrealign_flag, api_export_flags],
install : false,
build_by_default : false,
).extract_all_objects(recursive: true)
# Helper library for each bitdepth
libdav1d_bitdepth_objs = []
foreach bitdepth : dav1d_bitdepths
libdav1d_bitdepth_objs += static_library(
'dav1d_bitdepth_@0@'.format(bitdepth),
libdav1d_tmpl_sources, config_h_target,
include_directories: dav1d_inc_dirs,
dependencies : [stdatomic_dependencies],
c_args : ['-DBITDEPTH=@0@'.format(bitdepth)] + stackalign_flag,
install : false,
build_by_default : false,
).extract_all_objects(recursive: true)
endforeach
# Helper library for each bitdepth and architecture-specific flags
foreach bitdepth : dav1d_bitdepths
libdav1d_bitdepth_objs += static_library(
'dav1d_arch_bitdepth_@0@'.format(bitdepth),
libdav1d_arch_tmpl_sources, config_h_target,
include_directories: dav1d_inc_dirs,
dependencies : [stdatomic_dependencies],
c_args : ['-DBITDEPTH=@0@'.format(bitdepth)] + stackalign_flag + arch_flags,
install : false,
build_by_default : false,
).extract_all_objects(recursive: true)
endforeach
# The final dav1d library
if host_machine.system() == 'windows'
dav1d_soversion = ''
else
dav1d_soversion = dav1d_api_version_major
endif
libdav1d = library('dav1d',
libdav1d_sources,
libdav1d_asm_objs,
libdav1d_rc_obj,
objects : [
libdav1d_bitdepth_objs,
libdav1d_entrypoints_objs
],
include_directories : dav1d_inc_dirs,
dependencies : [
stdatomic_dependencies,
thread_dependency,
thread_compat_dep,
libdl_dependency,
],
c_args : [stackalign_flag, api_export_flags],
version : dav1d_soname_version,
soversion : dav1d_soversion,
install : true,
)
dav1d_dep = declare_dependency(link_with: libdav1d,
include_directories : include_directories('../include')
)
#
# Generate pkg-config .pc file
#
# pkg_mod = import('pkgconfig')
# pkg_mod.generate(libraries: libdav1d,
# version: meson.project_version(),
# name: 'libdav1d',
# filebase: 'dav1d',
# description: 'AV1 decoding library'
# )

View File

@ -0,0 +1,100 @@
diff --git a/meson.build b/meson.build
index 688b368859..dc9d18acd5 100644
--- a/meson.build
+++ b/meson.build
@@ -1037,7 +1037,7 @@ check_components = [
['user32', ['windows.h', 'winuser.h'], ['GetShellWindow'], ['user32']],
['vfw32', ['windows.h', 'vfw.h'], ['capCreateCaptureWindow'], ['vfw3']],
['vaapi', ['va/va.h'], ['vaInitialize'], ['va']],
- ['zlib', ['zlib.h'], ['zlibVersion'], ['z']],
+ ['zlib', ['zlib.h'], ['zlibVersion'], ['z'], {'meson-dep': 'zlib'}],
# Libraries with preconditions
['vaapi_drm', ['va/va.h', 'va/va_drm.h'], ['vaGetDisplayDRM'], ['va', 'va-drm'],
@@ -1925,6 +1925,7 @@ foreach check : all_checks
prefix = ''
found = true
+ skipchecks = false
preconditions = opts.get('preconditions', [])
@@ -1980,6 +1981,11 @@ foreach check : all_checks
req = false
endif
dep = cc.find_library(link_with, required : req)
+ if not dep.found() and opts.has_key('meson-dep')
+ dep = dependency(opts.get('meson-dep'), required: false)
+ # We can't do compiler checks for non-external dependencies, so skip them and trust the meson dependency
+ skipchecks = true
+ endif
found = found and dep.found()
extra_deps += dep
endforeach
@@ -2009,7 +2015,8 @@ foreach check : all_checks
else
dep = dependency(pkg_name, required : req)
endif
- found = dep.found() and dep.type_name() != 'internal'
+ found = dep.found()
+ skipchecks = dep.type_name() == 'internal' # same here, trust the meson dependency
extra_deps += dep
endif
endif
@@ -2023,14 +2030,14 @@ foreach check : all_checks
endif
if not conf.has(header.underscorify())
- has_header = cc.has_header(header, dependencies: extra_deps)
+ has_header = skipchecks or cc.has_header(header, dependencies: extra_deps)
conf.set10(header.underscorify().to_lower(), has_header)
found = found and has_header
endif
endforeach
endif
- if found
+ if found and not skipchecks
n_funcs_found = 0
foreach symbol : funcs
if check_type == 'header-func'
@@ -2050,7 +2057,7 @@ foreach check : all_checks
endif
endif
- if found
+ if found and not skipchecks
n_defines_found = 0
foreach symbol : defines
if cc.get_define(symbol, dependencies : extra_deps, prefix: prefix, args : c_args + project_c_args) != ''
@@ -2060,15 +2067,15 @@ foreach check : all_checks
found = n_defines_found == defines.length()
endif
- if found and compiles != ''
+ if found and compiles != '' and not skipchecks
found = cc.compiles('\n\n'.join([prefix, compiles]), dependencies : extra_deps, args : c_args + project_c_args, name: name)
endif
- if found and links != ''
+ if found and links != '' and not skipchecks
found = cc.links('\n\n'.join([prefix, links]), dependencies : extra_deps, args : c_args + project_c_args, name: name)
endif
- if found and type != ''
+ if found and type != '' and not skipchecks
found = cc.has_type(type, prefix : prefix, dependencies : extra_deps, args : c_args + project_c_args)
endif
@@ -3087,6 +3094,11 @@ foreach a: arch_list
endforeach
foreach have: have_list
+ if have == 'unistd_h' and conf.get(have) == 0
+ # an atrocious hack to get this working with the zlib subproject on windows...
+ # zlib also uses a HAVE_UNISTD_H define, but it checks it with #ifdef and not #if
+ continue
+ endif
final_conf.set('HAVE_@0@'.format(have.to_upper()), conf.get(have.to_lower()))
endforeach

File diff suppressed because it is too large Load Diff

View File

@ -5,8 +5,8 @@ deps = []
opts = ['tests=disabled', 'libdav1d=enabled']
deps += dependency('zlib')
deps += dependency('libavformat', default_options: opts)
deps += dependency('libavcodec', default_options: opts)
deps += dependency('libavformat', version: '>=60', default_options: opts)
deps += dependency('libavcodec', version: '>=60', default_options: opts)
deps += dependency('libswscale', default_options: opts)
deps += dependency('libavutil', default_options: opts)
deps += dependency('libswresample', default_options: opts)