@@ -605,22 +605,27 @@ def do_custom_build(self, env):
605
605
if (src_path / 'objs' / '.libs' / libfreetype ).is_file ():
606
606
return # Bail out because we have already built FreeType.
607
607
608
- cc = get_ccompiler ()
609
-
610
608
print (f"Building freetype in { src_path } " )
611
609
if sys .platform != 'win32' : # compilation on non-windows
612
610
env = {
613
611
** 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
+ },
617
618
}
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 )
624
629
if 'GNUMAKE' in env :
625
630
make = env ['GNUMAKE' ]
626
631
elif 'MAKE' in env :
@@ -668,6 +673,7 @@ def do_custom_build(self, env):
668
673
f .truncate ()
669
674
f .write (vcxproj )
670
675
676
+ cc = get_ccompiler ()
671
677
cc .initialize () # Get msbuild in the %PATH% of cc.spawn.
672
678
cc .spawn (["msbuild" , str (sln_path ),
673
679
"/t:Clean;Build" ,
0 commit comments