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

Skip to content

Commit b70b681

Browse files
authored
Merge pull request #21277 from meeseeksmachine/auto-backport-of-pr-21263-on-v3.5.x
Backport PR #21263 on branch v3.5.x (Ensure internal FreeType matches Python compile)
2 parents cb58a9a + 5d483d1 commit b70b681

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

setupext.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -607,12 +607,25 @@ def do_custom_build(self, env):
607607

608608
print(f"Building freetype in {src_path}")
609609
if sys.platform != 'win32': # compilation on non-windows
610-
env = {**env, "CFLAGS": "{} -fPIC".format(env.get("CFLAGS", ""))}
611-
subprocess.check_call(
612-
["./configure", "--with-zlib=no", "--with-bzip2=no",
613-
"--with-png=no", "--with-harfbuzz=no", "--enable-static",
614-
"--disable-shared"],
615-
env=env, cwd=src_path)
610+
env = {
611+
**env,
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+
},
618+
}
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)
616629
if 'GNUMAKE' in env:
617630
make = env['GNUMAKE']
618631
elif 'MAKE' in env:

0 commit comments

Comments
 (0)