Skip to content

Commit

Permalink
Use pkg-config to find FreeType2 if available (ref #4164)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raul Marin authored and artemp committed Aug 6, 2020
1 parent d8346dd commit bc01c22
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,7 @@ if not preconfigured:
]
OPTIONAL_LIBSHEADERS = []

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'):
Expand All @@ -1406,6 +1407,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':
Expand Down Expand Up @@ -1635,9 +1651,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']:
Expand Down

0 comments on commit bc01c22

Please sign in to comment.