@@ -854,8 +854,13 @@ def build_all(self):
854854 self .make_lipo (static_fn , library )
855855 logger .info ("Install include files for {}" .format (self .name ))
856856 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 )
859864 logger .info ("Install sources for {}" .format (self .name ))
860865 self .install_sources ()
861866 logger .info ("Install {}" .format (self .name ))
@@ -905,20 +910,24 @@ def make_lipo(self, filename, library=None):
905910 shprint (sh .lipo , "-create" , "-output" , filename , * args )
906911
907912 @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 :
910917 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 )
922931
923932 @cache_execution
924933 def install_sources (self ):
@@ -1216,17 +1225,19 @@ def update_pbxproj(filename, pbx_frameworks=None):
12161225 group = project .get_or_create_group ("Frameworks" )
12171226 g_classes = project .get_or_create_group ("Classes" )
12181227 file_options = FileOptions (embed_framework = False , code_sign_on_copy = True )
1228+ file_options_embed = FileOptions (embed_framework = True , code_sign_on_copy = True )
12191229 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 ]:
12221231 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 )
12241235 else :
12251236 logger .info ("Ensure {} is in the project (pbx_frameworks, system)" .format (framework ))
12261237 f_path = join (sysroot , "System" , "Library" , "Frameworks" ,
12271238 "{}.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 )
12301241 for library in pbx_libraries :
12311242 logger .info ("Ensure {} is in the project (pbx_libraries, dylib+tbd)" .format (library ))
12321243 f_path = join (sysroot , "usr" , "lib" ,
0 commit comments