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

Skip to content

Commit 8d0d1e6

Browse files
authored
Merge pull request #21279 from QuLogic/fix-freetype-wheel
Fix freetype wheel building
2 parents 253cfe8 + d85d7dc commit 8d0d1e6

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

setupext.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -605,22 +605,27 @@ 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-
610608
print(f"Building freetype in {src_path}")
611609
if sys.platform != 'win32': # compilation on non-windows
612610
env = {
613611
**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", "")),
612+
**{
613+
var: value
614+
for var, value in sysconfig.get_config_vars().items()
615+
if var in {"CC", "CFLAGS", "CXX", "CXXFLAGS", "LD",
616+
"LDFLAGS"}
617+
},
617618
}
618-
subprocess.check_call(
619-
["./configure", "--with-zlib=no", "--with-bzip2=no",
620-
"--with-png=no", "--with-harfbuzz=no", "--enable-static",
621-
"--disable-shared",
622-
"--host=" + sysconfig.get_config_var('BUILD_GNU_TYPE')],
623-
env=env, cwd=src_path)
619+
env["CFLAGS"] = env.get("CFLAGS", "") + " -fPIC"
620+
configure = [
621+
"./configure", "--with-zlib=no", "--with-bzip2=no",
622+
"--with-png=no", "--with-harfbuzz=no", "--enable-static",
623+
"--disable-shared"
624+
]
625+
host = sysconfig.get_config_var('BUILD_GNU_TYPE')
626+
if host is not None: # May be unset on PyPy.
627+
configure.append(f"--host={host}")
628+
subprocess.check_call(configure, env=env, cwd=src_path)
624629
if 'GNUMAKE' in env:
625630
make = env['GNUMAKE']
626631
elif 'MAKE' in env:
@@ -668,6 +673,7 @@ def do_custom_build(self, env):
668673
f.truncate()
669674
f.write(vcxproj)
670675

676+
cc = get_ccompiler()
671677
cc.initialize() # Get msbuild in the %PATH% of cc.spawn.
672678
cc.spawn(["msbuild", str(sln_path),
673679
"/t:Clean;Build",

0 commit comments

Comments
 (0)