Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e01d4f1

Browse files
authored
Merge pull request #21263 from QuLogic/better-freetype-compile
Ensure internal FreeType matches Python compile
2 parents e9bd017 + 76f1516 commit e01d4f1

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

setupext.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,13 +605,21 @@ def do_custom_build(self, env):
605605
if (src_path / 'objs' / '.libs' / libfreetype).is_file():
606606
return # Bail out because we have already built FreeType.
607607

608+
cc = get_ccompiler()
609+
608610
print(f"Building freetype in {src_path}")
609611
if sys.platform != 'win32': # compilation on non-windows
610-
env = {**env, "CFLAGS": "{} -fPIC".format(env.get("CFLAGS", ""))}
612+
env = {
613+
**env,
614+
"CC": (shlex.join(cc.compiler) if sys.version_info >= (3, 8)
615+
else " ".join(shlex.quote(x) for x in cc.compiler)),
616+
"CFLAGS": "{} -fPIC".format(env.get("CFLAGS", "")),
617+
}
611618
subprocess.check_call(
612619
["./configure", "--with-zlib=no", "--with-bzip2=no",
613620
"--with-png=no", "--with-harfbuzz=no", "--enable-static",
614-
"--disable-shared"],
621+
"--disable-shared",
622+
"--host=" + sysconfig.get_config_var('BUILD_GNU_TYPE')],
615623
env=env, cwd=src_path)
616624
if 'GNUMAKE' in env:
617625
make = env['GNUMAKE']
@@ -660,7 +668,6 @@ def do_custom_build(self, env):
660668
f.truncate()
661669
f.write(vcxproj)
662670

663-
cc = get_ccompiler()
664671
cc.initialize() # Get msbuild in the %PATH% of cc.spawn.
665672
cc.spawn(["msbuild", str(sln_path),
666673
"/t:Clean;Build",

0 commit comments

Comments
 (0)