summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-09-17 19:05:46 +0000
committerMatthias Clasen <mclasen@redhat.com>2020-09-17 19:05:46 +0000
commit25fedea4091818e39676e130f512214bf4192a8d (patch)
treed74df18e47a22505c8b78abaf4efa285a1589774
parentfc9c3c3628aef1ee0b646b9bd10f47cee1549ec4 (diff)
parentf91c203bb40ef3024627c22710037bf67ac061cf (diff)
downloadpango-25fedea4091818e39676e130f512214bf4192a8d.tar.gz
Merge branch 'optional-dependencies' into 'master'
Make dependencies to fontconfig and freetype optional and explicit. See merge request GNOME/pango!239
-rw-r--r--meson.build20
-rw-r--r--meson_options.txt12
2 files changed, 22 insertions, 10 deletions
diff --git a/meson.build b/meson.build
index 20f73947..482b0735 100644
--- a/meson.build
+++ b/meson.build
@@ -270,16 +270,24 @@ endif
pango_deps += harfbuzz_dep
# Only use FontConfig fallback when required or requested
-fontconfig_required = (host_system != 'windows' and host_system != 'darwin') or get_option('use_fontconfig')
-fontconfig_dep = dependency('fontconfig', version: fontconfig_req_version, required: false)
+fontconfig_option = get_option('fontconfig')
+
+fontconfig_sys_required = (host_system != 'windows' and host_system != 'darwin')
+if fontconfig_sys_required and fontconfig_option.disabled()
+ error('Fontconfig is required on this platform (pass -Dfontconfig=enabled or -Dfontconfig=auto)')
+endif
+
+fontconfig_required = fontconfig_sys_required or fontconfig_option.enabled()
+
+fontconfig_dep = dependency('fontconfig', version: fontconfig_req_version, required: fontconfig_option)
if fontconfig_dep.found()
fontconfig_pc = 'fontconfig'
else
if cc.get_id() == 'msvc' and cc.has_header('fontconfig/fontconfig.h')
# Look for the Visual Studio-style import library if FontConfig's .pc file cannot be
# found on Visual Studio
- fontconfig_dep = cc.find_library('fontconfig', required: false)
+ fontconfig_dep = cc.find_library('fontconfig', required: fontconfig_option)
if fontconfig_dep.found()
fontconfig_lib = '-lfontconfig'
endif
@@ -312,7 +320,7 @@ message('fontconfig has FcWeightFromOpenTypeDouble: ' + res)
# The first version of freetype with a pkg-config file is 2.1.5
# We require both fontconfig and freetype if we are to have either.
-freetype_dep = dependency('freetype2', required: false)
+freetype_dep = dependency('freetype2', required: get_option('freetype'))
if freetype_dep.found()
freetype2_pc = 'freetype2'
@@ -320,7 +328,7 @@ else
if cc.get_id() == 'msvc' and cc.has_header('ft2build.h')
foreach ft2_lib: ['freetype', 'freetypemt']
if not freetype_dep.found()
- freetype_dep = cc.find_library(ft2_lib, required: false)
+ freetype_dep = cc.find_library(ft2_lib, required: get_option('freetype'))
if freetype_dep.found()
freetype2_lib = '-l@0@'.format(ft2_lib)
endif
@@ -330,7 +338,7 @@ else
endif
if fontconfig_required and not freetype_dep.found()
- freetype_dep = dependency('freetype2', required: false,
+ freetype_dep = dependency('freetype2', required: get_option('freetype'),
fallback: ['freetype2', 'freetype_dep'])
endif
diff --git a/meson_options.txt b/meson_options.txt
index 437ba149..5aa7c795 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -10,10 +10,10 @@ option('install-tests',
description : 'Install tests',
type: 'boolean',
value: 'false')
-option('use_fontconfig',
- description : 'Force using FontConfig where it is optional, on Windows and macOS. This is ignored on platforms where it is required',
- type: 'boolean',
- value: 'false')
+option('fontconfig',
+ description : 'Build with FontConfig support. Passing \'auto\' or \'disabled\' disables fontconfig where it is optional, i.e. on Windows and macOS. Passing \'disabled\' on platforms where fontconfig is required results in error.',
+ type: 'feature',
+ value: 'auto')
option('sysprof',
type : 'feature',
value : 'disabled',
@@ -30,3 +30,7 @@ option('xft',
type : 'feature',
value : 'auto',
description : 'Build with xft support')
+option('freetype',
+ type : 'feature',
+ value : 'auto',
+ description : 'Build with freetype support')