@@ -270,16 +270,23 @@ def set_pkgconfig_path(self):
270
270
os .environ ['PKG_CONFIG_PATH' ] = pkgconfig_path
271
271
272
272
def setup_extension (self , ext , package , default_include_dirs = [],
273
- default_library_dirs = [], default_libraries = []):
273
+ default_library_dirs = [], default_libraries = [],
274
+ alt_exec = None ):
274
275
"""
275
276
Add parameters to the given `ext` for the given `package`.
276
277
"""
277
278
flag_map = {
278
279
'-I' : 'include_dirs' , '-L' : 'library_dirs' , '-l' : 'libraries' }
279
- command = "pkg-config --libs --cflags " + package
280
280
281
- use_defaults = True
281
+ executable = alt_exec
282
282
if self .has_pkgconfig :
283
+ executable = 'pkg-config {0}' .format (package )
284
+
285
+ use_defaults = True
286
+
287
+ if executable is not None :
288
+ command = "{0} --libs --cflags " .format (executable )
289
+
283
290
try :
284
291
output = check_output (command , shell = True )
285
292
except subprocess .CalledProcessError :
@@ -752,7 +759,8 @@ def add_flags(self, ext):
752
759
'lib/freetype2/include/freetype2' ],
753
760
default_library_dirs = [
754
761
'freetype2/lib' ],
755
- default_libraries = ['freetype' , 'z' ])
762
+ default_libraries = ['freetype' , 'z' ],
763
+ alt_exec = 'freetype-config' )
756
764
757
765
758
766
class FT2Font (SetupPackage ):
0 commit comments