From 0708ee8724626ba8ca458bc7af06880e07d202fd Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Thu, 4 Apr 2024 11:01:17 +0100 Subject: [PATCH] Use `pkg-config` to determine static linking dependencies, default to original behaviour. --- src/build.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/build.py b/src/build.py index 015c9dd8b..86ab81b30 100644 --- a/src/build.py +++ b/src/build.py @@ -91,11 +91,15 @@ if '-DHAVE_TIFF' in env['CPPDEFINES']: enabled_imaging_libraries.append('tiff_reader.cpp') if '-DHAVE_WEBP' in env['CPPDEFINES']: - lib_env['LIBS'].append('webp') - if env['RUNTIME_LINK'] == 'static': - lib_env['LIBS'].append('sharpyuv'); - enabled_imaging_libraries.append('webp_reader.cpp') - enabled_imaging_libraries.append('webp_io.cpp') + cmd="pkg-config libwebp --libs" + if env['RUNTIME_LINK'] == 'static': + cmd += " --static" + try: + lib_env.ParseConfig(cmd) + except: + lib_env['LIBS'].append('webp') + enabled_imaging_libraries.append('webp_reader.cpp') + enabled_imaging_libraries.append('webp_io.cpp') if env['XMLPARSER'] == 'libxml2' and env['HAS_LIBXML2']: lib_env['LIBS'].append('xml2')