diff --git a/setupext.py b/setupext.py index 0d85f479d106..80cce3ade3fa 100644 --- a/setupext.py +++ b/setupext.py @@ -605,13 +605,21 @@ def do_custom_build(self, env): if (src_path / 'objs' / '.libs' / libfreetype).is_file(): return # Bail out because we have already built FreeType. + cc = get_ccompiler() + print(f"Building freetype in {src_path}") if sys.platform != 'win32': # compilation on non-windows - env = {**env, "CFLAGS": "{} -fPIC".format(env.get("CFLAGS", ""))} + env = { + **env, + "CC": (shlex.join(cc.compiler) if sys.version_info >= (3, 8) + else " ".join(shlex.quote(x) for x in cc.compiler)), + "CFLAGS": "{} -fPIC".format(env.get("CFLAGS", "")), + } subprocess.check_call( ["./configure", "--with-zlib=no", "--with-bzip2=no", "--with-png=no", "--with-harfbuzz=no", "--enable-static", - "--disable-shared"], + "--disable-shared", + "--host=" + sysconfig.get_config_var('BUILD_GNU_TYPE')], env=env, cwd=src_path) if 'GNUMAKE' in env: make = env['GNUMAKE'] @@ -660,7 +668,6 @@ def do_custom_build(self, env): f.truncate() f.write(vcxproj) - cc = get_ccompiler() cc.initialize() # Get msbuild in the %PATH% of cc.spawn. cc.spawn(["msbuild", str(sln_path), "/t:Clean;Build",