Skip to content

Commit

Permalink
meson: Fix freetype and icu dependency lookup
Browse files Browse the repository at this point in the history
It is wrong to search for a different name depending on the compiler. If
anything, cmake name could be available on systems that uses GCC too.

This also fix regression in the usage of freetype subproject fallback as
its name is "freetype2" and was previously used even when the
"freetype" option was set to "auto".
  • Loading branch information
xclaesse authored and behdad committed Sep 8, 2022
1 parent 7c0791d commit 53a194a
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions meson.build
Expand Up @@ -83,25 +83,39 @@ check_funcs = [

m_dep = cpp.find_library('m', required: false)

# https://github.com/harfbuzz/harfbuzz/pull/2498
freetype_dep = dependency(cpp.get_argument_syntax() == 'msvc' ? 'freetype' : 'freetype2',
required: get_option('freetype'),
default_options: ['harfbuzz=disabled'])

# Try pkgconfig name
freetype_dep = dependency('freetype2', required: false)
if not freetype_dep.found()
# Try cmake name
freetype_dep = dependency('freetype', required: false)
endif
if not freetype_dep.found()
# Subproject fallback, `allow_fallback: true` means the fallback will be
# tried even if the freetype option is set to `auto`.
freetype_dep = dependency('freetype2',
required: get_option('freetype'),
default_options: ['harfbuzz=disabled'],
allow_fallback: true)
endif

glib_dep = dependency('glib-2.0', required: get_option('glib'))
gobject_dep = dependency('gobject-2.0', required: get_option('gobject'))
graphite2_dep = dependency('graphite2', required: get_option('graphite2'))
graphite_dep = dependency('graphite2', required: get_option('graphite'))

if cpp.get_argument_syntax() == 'msvc'
# Try pkgconfig name
icu_dep = dependency('icu-uc', required: false)
if not icu_dep.found()
# Try cmake name
icu_dep = dependency('ICU',
required: get_option('icu'),
required: false,
components: 'uc',
method: 'cmake')
else
icu_dep = dependency('icu-uc',
required: get_option('icu'),
method: 'pkg-config')
endif
if not icu_dep.found()
# Subproject fallback if icu option is enabled
icu_dep = dependency('icu-uc', required: get_option('icu'))
endif

if icu_dep.found() and icu_dep.type_name() == 'pkgconfig'
Expand Down

0 comments on commit 53a194a

Please sign in to comment.