@@ -854,8 +854,13 @@ def build_all(self):
854
854
self .make_lipo (static_fn , library )
855
855
logger .info ("Install include files for {}" .format (self .name ))
856
856
self .install_include ()
857
- logger .info ("Install frameworks for {}" .format (self .name ))
858
- self .install_frameworks ()
857
+ if self .frameworks :
858
+ logger .info ("Make lipo framework for {}" .format (self .name ))
859
+ for framework in self .frameworks :
860
+ framework_fn = join (self .ctx .dist_dir , "frameworks" , "{}.framework" .format (framework ['name' ]))
861
+ ensure_dir (dirname (framework_fn ))
862
+ logger .info (" - Lipo-ize {}" .format (framework ['name' ]))
863
+ self .make_lipo_framework (framework_fn , framework )
859
864
logger .info ("Install sources for {}" .format (self .name ))
860
865
self .install_sources ()
861
866
logger .info ("Install {}" .format (self .name ))
@@ -905,20 +910,24 @@ def make_lipo(self, filename, library=None):
905
910
shprint (sh .lipo , "-create" , "-output" , filename , * args )
906
911
907
912
@cache_execution
908
- def install_frameworks (self ):
909
- if not self .frameworks :
913
+ def make_lipo_framework (self , filename , framework = None ):
914
+ if framework is None :
915
+ framework = self .framework
916
+ if not framework :
910
917
return
911
- arch = self .filtered_archs [0 ]
912
- build_dir = self .get_build_dir (arch .arch )
913
- for framework in self .frameworks :
914
- logger .info ("Install Framework {}" .format (framework ))
915
- src = join (build_dir , framework )
916
- dest = join (self .ctx .dist_dir , "frameworks" , framework )
917
- ensure_dir (dirname (dest ))
918
- if exists (dest ):
919
- shutil .rmtree (dest )
920
- logger .debug ("Copy {} to {}" .format (src , dest ))
921
- shutil .copytree (src , dest )
918
+ args = []
919
+ ensure_dir (filename )
920
+ for arch in self .filtered_archs :
921
+ framework_p = framework ['path' ].format (arch = arch )
922
+ args += [join (self .get_build_dir (arch .arch ), framework_p , framework ['name' ])]
923
+ logger .info ("Copy the framework folder for Headers, Info.plst, etc in place" )
924
+ shprint (sh .cp , "-r" ,
925
+ join (self .get_build_dir (self .filtered_archs [0 ].arch ),
926
+ framework ['path' ].format (arch = self .filtered_archs [0 ])),
927
+ join (self .ctx .dist_dir , "frameworks" ))
928
+ shprint (sh .rm , join (filename , framework ['name' ]))
929
+ logger .info ("Lipo-ize the framework" )
930
+ shprint (sh .lipo , "-create" , "-output" , join (filename , framework ['name' ]), * args )
922
931
923
932
@cache_execution
924
933
def install_sources (self ):
@@ -1216,17 +1225,19 @@ def update_pbxproj(filename, pbx_frameworks=None):
1216
1225
group = project .get_or_create_group ("Frameworks" )
1217
1226
g_classes = project .get_or_create_group ("Classes" )
1218
1227
file_options = FileOptions (embed_framework = False , code_sign_on_copy = True )
1228
+ file_options_embed = FileOptions (embed_framework = True , code_sign_on_copy = True )
1219
1229
for framework in pbx_frameworks :
1220
- framework_name = "{}.framework" .format (framework )
1221
- if framework_name in frameworks :
1230
+ if framework in [x ['name' ] for x in frameworks ]:
1222
1231
logger .info ("Ensure {} is in the project (pbx_frameworks, local)" .format (framework ))
1223
- f_path = join (ctx .dist_dir , "frameworks" , framework_name )
1232
+ f_path = join (ctx .dist_dir , "frameworks" , f"{ framework } .framework" )
1233
+ project .add_file (f_path , parent = group , tree = "DEVELOPER_DIR" ,
1234
+ force = False , file_options = file_options_embed )
1224
1235
else :
1225
1236
logger .info ("Ensure {} is in the project (pbx_frameworks, system)" .format (framework ))
1226
1237
f_path = join (sysroot , "System" , "Library" , "Frameworks" ,
1227
1238
"{}.framework" .format (framework ))
1228
- project .add_file (f_path , parent = group , tree = "DEVELOPER_DIR" ,
1229
- force = False , file_options = file_options )
1239
+ project .add_file (f_path , parent = group , tree = "DEVELOPER_DIR" ,
1240
+ force = False , file_options = file_options )
1230
1241
for library in pbx_libraries :
1231
1242
logger .info ("Ensure {} is in the project (pbx_libraries, dylib+tbd)" .format (library ))
1232
1243
f_path = join (sysroot , "usr" , "lib" ,
0 commit comments