Aegisub/subprojects/packagefiles/ffmpeg/0001.patch
2023-12-27 06:50:37 +01:00

100 lines
3.6 KiB
Diff

diff --git a/meson.build b/meson.build
index 27d1387315..e8d7d3ccc2 100644
--- a/meson.build
+++ b/meson.build
@@ -1042,7 +1042,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'],
@@ -1930,6 +1930,7 @@ foreach check : all_checks
prefix = ''
found = true
+ skipchecks = false
preconditions = opts.get('preconditions', [])
@@ -1985,6 +1986,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
@@ -2014,7 +2020,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
@@ -2028,14 +2035,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'
@@ -2055,7 +2062,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) != ''
@@ -2065,15 +2072,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
@@ -3103,6 +3110,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