@@ -1122,23 +1122,15 @@ def do_custom_build(self):
1122
1122
subprocess .check_call (["make" ], env = env , cwd = src_path )
1123
1123
else :
1124
1124
# compilation on windows
1125
- FREETYPE_BUILD_CMD = """\
1126
- call "%ProgramFiles%\\ Microsoft SDKs\\ Windows\\ v7.0\\ Bin\\ SetEnv.Cmd" /Release /{xXX} /xp
1125
+ FREETYPE_BUILD_CMD = r"""
1126
+ call "%ProgramFiles%\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.Cmd" ^
1127
+ /Release /{xXX} /xp
1127
1128
call "{vcvarsall}" {xXX}
1128
- set MSBUILD=C:\\ Windows\\ Microsoft.NET\\ Framework\\ v4.0.30319\\ MSBuild.exe
1129
- <
10000
span class=pl-s>rd /S /Q %FREETYPE%\\ objs
1130
- %MSBUILD% %FREETYPE%\\ builds\\ windows\\ {vc20xx}\\ freetype.sln /t:Clean;Build /p:Configuration="{config}";Platform={WinXX}
1131
- echo Build completed, moving result"
1132
- :: move to the "normal" path for the unix builds...
1133
- mkdir %FREETYPE%\\ objs\\ .libs
1134
- :: REMINDER: fix when changing the version
1135
- copy %FREETYPE%\\ objs\\ {vc20xx}\\ {xXX}\\ freetype261.lib %FREETYPE%\\ objs\\ .libs\\ libfreetype.lib
1136
- if errorlevel 1 (
1137
- rem This is a py27 version, which has a different location for the lib file :-/
1138
- copy %FREETYPE%\\ objs\\ win32\\ {vc20xx}\\ freetype261.lib %FREETYPE%\\ objs\\ .libs\\ libfreetype.lib
1139
- )
1129
+ set MSBUILD=C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
1130
+ %MSBUILD% "builds\windows\{vc20xx}\freetype.sln" ^
1131
+ /t:Clean;Build /p:Configuration="{config}";Platform={WinXX}
1140
1132
"""
1141
- from setup_external_compile import fixproj , prepare_build_cmd , VS2010 , X64
1133
+ from setup_external_compile import fixproj , prepare_build_cmd , VS2010 , X64 , xXX
1142
1134
# Note: freetype has no build profile for 2014, so we don't bother...
1143
1135
vc = 'vc2010' if VS2010 else 'vc2008'
1144
1136
WinXX = 'x64' if X64 else 'Win32'
@@ -1147,13 +1139,21 @@ def do_custom_build(self):
1147
1139
fixproj (os .path .join (src_path , 'builds' , 'windows' , vc , 'freetype.sln' ), WinXX )
1148
1140
fixproj (os .path .join (src_path , 'builds' , 'windows' , vc , 'freetype.vcproj' ), WinXX )
1149
1141
1150
- cmdfile = os .path .join ("build" , ' build_freetype.cmd' )
1142
+ cmdfile = os .path .join ("build" , " build_freetype.cmd" )
1151
1143
with open (cmdfile , 'w' ) as cmd :
1152
1144
cmd .write (prepare_build_cmd (FREETYPE_BUILD_CMD , vc20xx = vc , WinXX = WinXX ,
1153
1145
config = 'Release' if VS2010 else 'LIB Release' ))
1154
1146
1155
- os .environ ['FREETYPE' ] = src_path
1156
- subprocess .check_call ([cmdfile ], shell = True )
1147
+ shutil .rmtree (str (Path (src_path , "objs" )), ignore_errors = True )
1148
+ subprocess .check_call ([os .path .abspath (cmdfile )],
1149
+ shell = True , cwd = src_path )
1150
+ # Move to the corresponding Unix build path.
1151
+ Path (src_path , "objs/.libs" ).mkdir ()
1152
+ # Be robust against change of FreeType version.
1153
+ lib_path , = (Path (src_path , "objs" , vc , xXX )
1154
+ .glob ("freetype*.lib" ))
1155
+ shutil .copy2 (str (lib_path ),
1156
+ str (Path (src_path , "objs/.libs/libfreetype.lib" )))
1157
1157
1158
1158
1159
1159
class FT2Font (SetupPackage ):
0 commit comments