Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,22 +605,27 @@ 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,
"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", "")),
**{
var: value
for var, value in sysconfig.get_config_vars().items()
if var in {"CC", "CFLAGS", "CXX", "CXXFLAGS", "LD",
"LDFLAGS"}
},
}
subprocess.check_call(
["./configure", "--with-zlib=no", "--with-bzip2=no",
"--with-png=no", "--with-harfbuzz=no", "--enable-static",
"--disable-shared",
"--host=" + sysconfig.get_config_var('BUILD_GNU_TYPE')],
env=env, cwd=src_path)
env["CFLAGS"] = env.get("CFLAGS", "") + " -fPIC"
configure = [
"./configure", "--with-zlib=no", "--with-bzip2=no",
"--with-png=no", "--with-harfbuzz=no", "--enable-static",
"--disable-shared"
]
host = sysconfig.get_config_var('BUILD_GNU_TYPE')
if host is not None: # May be unset on PyPy.
configure.append(f"--host={host}")
subprocess.check_call(configure, env=env, cwd=src_path)
if 'GNUMAKE' in env:
make = env['GNUMAKE']
elif 'MAKE' in env:
Expand Down Expand Up @@ -668,6 +673,7 @@ 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",
Expand Down