@@ -235,18 +235,36 @@ def build_cmake(self, source_root, build_root):
235
235
if len (m ) == 1 :
236
236
build_root = m [0 ]
237
237
238
- cmake_build_dir = os .path .join (build_root , 'cmake-%s' %
238
+ cmake_install_dir = os .path .join (build_root , 'cmake-%s' %
239
+ self .args .host_target )
240
+ cmake_build_dir = os .path .join (build_root , 'cmake-%s-build' %
239
241
self .args .host_target )
240
242
if not os .path .isdir (cmake_build_dir ):
241
243
os .makedirs (cmake_build_dir )
242
244
243
245
cwd = os .getcwd ()
246
+
247
+ file_dir = os .path .dirname (os .path .abspath (__file__ ))
248
+ cmake_patch_path = os .path .join (file_dir , "cmake-swift.patch" )
249
+ cmake_source_dir = os .path .join (source_root , "cmake" )
250
+ os .chdir (cmake_source_dir )
251
+ shell .call_without_sleeping (['git' , 'apply' , cmake_patch_path ],
252
+ echo = True )
253
+
244
254
os .chdir (cmake_build_dir )
245
- shell .call_without_sleeping ([cmake_bootstrap ], echo = True )
255
+ shell .call_without_sleeping ([cmake_bootstrap , '--prefix=%s' %
256
+ cmake_install_dir ], echo = True )
246
257
shell .call_without_sleeping (['make' , '-j%s' % self .args .build_jobs ],
247
258
echo = True )
259
+ shell .call_without_sleeping (['make' , 'install' ], echo = True )
260
+
261
+ os .chdir (cmake_source_dir )
262
+ # undo the patch so the next time we call this it applies again
263
+ shell .call_without_sleeping (['git' , 'checkout' , '-f' ],
264
+ echo = True )
265
+
248
266
os .chdir (cwd )
249
- return os .path .join (cmake_build_dir , 'bin' , 'cmake' )
267
+ return os .path .join (cmake_install_dir , 'bin' , 'cmake' )
250
268
251
269
# For Linux only, determine the version of the installed CMake compared to
252
270
# the source and build the source if necessary. Returns the path to the
0 commit comments