From 23755a527a5e0f24a7591fcc41dece7ce5f080b7 Mon Sep 17 00:00:00 2001 From: Raul Marin Date: Thu, 3 May 2018 17:03:25 +0200 Subject: [PATCH] Use pkg-config to find FreeType2 if available --- SConstruct | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index 39225faec..35a9afa1d 100644 --- a/SConstruct +++ b/SConstruct @@ -1401,6 +1401,7 @@ if not preconfigured: ['harfbuzz', 'harfbuzz/hb.h',True,'C++'] ] + CHECK_PKG_CONFIG = conf.CheckPKGConfig('0.15.0') if env.get('FREETYPE_LIBS') or env.get('FREETYPE_INCLUDES'): REQUIRED_LIBSHEADERS.insert(0,['freetype','ft2build.h',True,'C']) if env.get('FREETYPE_INCLUDES'): @@ -1409,6 +1410,21 @@ if not preconfigured: if env.get('FREETYPE_LIBS'): lib_path = env['FREETYPE_LIBS'] env.AppendUnique(LIBPATH = fix_path(lib_path)) + elif CHECK_PKG_CONFIG and conf.CheckPKG('freetype2'): + # Freetype 2.9+ doesn't use freetype-config and uses pkg-config instead + cmd = 'pkg-config freetype2 --libs --cflags' + if env['RUNTIME_LINK'] == 'static': + cmd += ' --static' + + temp_env = Environment(ENV=os.environ) + try: + temp_env.ParseConfig(cmd) + for lib in temp_env['LIBS']: + env.AppendUnique(LIBPATH = fix_path(lib)) + for inc in temp_env['CPPPATH']: + env.AppendUnique(CPPPATH = fix_path(inc)) + except OSError as e: + pass elif conf.parse_config('FREETYPE_CONFIG'): # check if freetype links to bz2 if env['RUNTIME_LINK'] == 'static': @@ -1642,9 +1658,6 @@ if not preconfigured: color_print(1,'%s not detected on your system' % env['QUERIED_ICU_DATA'] ) env['MISSING_DEPS'].append('ICU_DATA') - - CHECK_PKG_CONFIG = conf.CheckPKGConfig('0.15.0') - if len(env['REQUESTED_PLUGINS']): if env['HOST']: for plugin in env['REQUESTED_PLUGINS']: