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