Warning, /graphics/krita/3rdparty/ext_freetype/0001-patch-msvc.patch is written in an unsupported language. File is not indexed.
0001 From 604fe807078ce41d0ac7742547e90b17c066709f Mon Sep 17 00:00:00 2001 0002 From: Eli Schwartz <eschwartz93@gmail.com> 0003 Date: Tue, 8 Nov 2022 16:24:08 -0500 0004 Subject: [PATCH] meson: fix regression in detecting freetype2/icu-uc when 0005 explicitly disabled 0006 0007 In #3811 / commit 53a194aa3f5f7de0b40e879e41fcbe0de6e9fefe a broken and 0008 half-implemented approach to kind of sort of handling the detection of 0009 both pkg-config and cmake names for dependencies, was implemented. It 0010 just checked for both versions with required: false, but when the build 0011 was configured with *disabled* options, it was still found because it 0012 was treated as auto. 0013 0014 Really, the problem here is trying to outsmart Meson, which handles a 0015 lot of edge cases correctly. But it's possible, albeit very wordy, to 0016 manually implement Meson's internal logic via if/else fallbacks. Do so 0017 here. 0018 --- 0019 meson.build | 79 +++++++++++++++++++++++++++++++++++++---------------- 0020 1 file changed, 56 insertions(+), 23 deletions(-) 0021 0022 diff --git a/meson.build b/meson.build 0023 index b80679d3aa..86b5b0169f 100644 0024 --- a/meson.build 0025 +++ b/meson.build 0026 @@ -83,20 +83,35 @@ check_funcs = [ 0027 0028 m_dep = cpp.find_library('m', required: false) 0029 0030 - 0031 -# Try pkgconfig name 0032 -freetype_dep = dependency('freetype2', required: false) 0033 -if not freetype_dep.found() 0034 - # Try cmake name 0035 - freetype_dep = dependency('freetype', required: false) 0036 -endif 0037 -if not freetype_dep.found() 0038 - # Subproject fallback, `allow_fallback: true` means the fallback will be 0039 - # tried even if the freetype option is set to `auto`. 0040 - freetype_dep = dependency('freetype2', 0041 +if meson.version().version_compare('>=0.60.0') 0042 + # pkg-config: freetype2, cmake: Freetype 0043 + freetype_dep = dependency('freetype2', 'Freetype', 0044 required: get_option('freetype'), 0045 default_options: ['harfbuzz=disabled'], 0046 allow_fallback: true) 0047 +else 0048 + # painful hack to handle multiple dependencies but also respect options 0049 + freetype_opt = get_option('freetype') 0050 + # we want to handle enabled manually after fallbacks, but also handle disabled normally 0051 + if freetype_opt.enabled() 0052 + freetype_opt = false 0053 + endif 0054 + # try pkg-config name 0055 + freetype_dep = dependency('freetype2', method: 'pkg-config', required: freetype_opt) 0056 + # when disabled, leave it not-found 0057 + if not freetype_dep.found() and not get_option('freetype').disabled() 0058 + # Try cmake name 0059 + freetype_dep = dependency('Freetype', method: 'cmake', required: false) 0060 + # Subproject fallback, `allow_fallback: true` means the fallback will be 0061 + # tried even if the freetype option is set to `auto`. 0062 + if not freetype_dep.found() 0063 + freetype_dep = dependency('freetype2', 0064 + method: 'pkg-config', 0065 + required: get_option('freetype'), 0066 + default_options: ['harfbuzz=disabled'], 0067 + allow_fallback: true) 0068 + endif 0069 + endif 0070 endif 0071 0072 glib_dep = dependency('glib-2.0', required: get_option('glib')) 0073 @@ -104,18 +119,36 @@ gobject_dep = dependency('gobject-2.0', required: get_option('gobject')) 0074 graphite2_dep = dependency('graphite2', required: get_option('graphite2')) 0075 graphite_dep = dependency('graphite2', required: get_option('graphite')) 0076 0077 -# Try pkgconfig name 0078 -icu_dep = dependency('icu-uc', required: false) 0079 -if not icu_dep.found() 0080 - # Try cmake name 0081 - icu_dep = dependency('ICU', 0082 - required: false, 0083 - components: 'uc', 0084 - method: 'cmake') 0085 -endif 0086 -if not icu_dep.found() 0087 - # Subproject fallback if icu option is enabled 0088 - icu_dep = dependency('icu-uc', required: get_option('icu')) 0089 +if meson.version().version_compare('>=0.60.0') 0090 + # pkg-config: icu-uc, cmake: ICU but with components 0091 + icu_dep = dependency('icu-uc', 'ICU', 0092 + components: 'uc', 0093 + required: get_option('icu'), 0094 + default_options: ['harfbuzz=disabled'], 0095 + allow_fallback: true) 0096 +else 0097 + # painful hack to handle multiple dependencies but also respect options 0098 + icu_opt = get_option('icu') 0099 + # we want to handle enabled manually after fallbacks, but also handle disabled normally 0100 + if icu_opt.enabled() 0101 + icu_opt = false 0102 + endif 0103 + # try pkg-config name 0104 + icu_dep = dependency('icu-uc', method: 'pkg-config', required: icu_opt) 0105 + # when disabled, leave it not-found 0106 + if not icu_dep.found() and not get_option('icu').disabled() 0107 + # Try cmake name 0108 + icu_dep = dependency('ICU', method: 'cmake', components: 'uc', required: false) 0109 + # Try again with subproject fallback. `allow_fallback: true` means the 0110 + # fallback will be tried even if the icu option is set to `auto`, but 0111 + # we cannot pass this option until Meson 0.59.0, because no wrap file 0112 + # is checked into git. 0113 + if not icu_dep.found() 0114 + icu_dep = dependency('icu-uc', 0115 + method: 'pkg-config', 0116 + required: get_option('icu')) 0117 + endif 0118 + endif 0119 endif 0120 0121 if icu_dep.found() and icu_dep.type_name() == 'pkgconfig'