@@ -811,8 +811,13 @@ def build_all(self):
811
811
self .make_lipo (static_fn , library )
812
812
logger .info ("Install include files for {}" .format (self .name ))
813
813
self .install_include ()
814
- logger .info ("Install frameworks for {}" .format (self .name ))
815
- self .install_frameworks ()
814
+ if self .frameworks :
815
+ logger .info ("Make lipo framework for {}" .format (self .name ))
816
+ for framework in self .frameworks :
817
+ framework_fn = join (self .ctx .dist_dir , "frameworks" , "{}.framework" .format (framework ['name' ]))
818
+ ensure_dir (dirname (framework_fn ))
819
+ logger .info (" - Lipo-ize {}" .format (framework ['name' ]))
820
+ self .make_lipo_framework (framework_fn , framework )
816
821
logger .info ("Install sources for {}" .format (self .name ))
817
822
self .install_sources ()
818
823
logger .info ("Install python deps for {}" .format (self .name ))
@@ -865,19 +870,24 @@ def make_lipo(self, filename, library=None):
865
870
shprint (sh .lipo , "-create" , "-output" , filename , * args )
866
871
867
872
@cache_execution
868
- def install_frameworks (self ):
869
- if not self .frameworks :
873
+ def make_lipo_framework (self , filename , framework = None ):
874
+ if framework is None :
875
+ framework = self .framework
876
+ if not framework :
870
877
return
871
- arch = self .filtered_archs [0 ]
872
- build_dir = self .get_build_dir (arch .arch )
873
- for framework in self .frameworks :
874
- logger .info ("Install Framework {}" .format (framework ))
875
- src = join (build_dir , framework )
876
- dest = join (self .ctx .dist_dir , "frameworks" , framework )
877
- ensure_dir (dirname (dest ))
878
- shutil .rmtree (dest , ignore_errors = True )
879
- logger .debug ("Copy {} to {}" .format (src , dest ))
880
- shutil .copytree (src , dest )
878
+ args = []
879
+ ensure_dir (filename )
880
+ for arch in self .filtered_archs :
881
+ framework_p = framework ['path' ].format (arch = arch )
882
+ args += [join (self .get_build_dir (arch .arch ), framework_p , framework ['name' ])]
883
+ logger .info ("Copy the framework folder for Headers, Info.plst, etc in place" )
884
+ shprint (sh .cp , "-r" ,
885
+ join (self .get_build_dir (self .filtered_archs [0 ].arch ),
886
+ framework ['path' ].format (arch = self .filtered_archs [0 ])),
887
+ join (self .ctx .dist_dir , "frameworks" ))
888
+ shprint (sh .rm , join (filename , framework ['name' ]))
889
+ logger .info ("Lipo-ize the framework" )
890
+ shprint (sh .lipo , "-create" , "-output" , join (filename , framework ['name' ]), * args )
881
891
882
892
@cache_execution
883
893
def install_sources (self ):
@@ -1208,17 +1218,19 @@ def update_pbxproj(filename, pbx_frameworks=None):
1208
1218
group = project .get_or_create_group ("Frameworks" )
1209
1219
g_classes = project .get_or_create_group ("Classes" )
1210
1220
file_options = FileOptions (embed_framework = False , code_sign_on_copy = True )
1221
+ file_options_embed = FileOptions (embed_framework = True , code_sign_on_copy = True )
1211
1222
for framework in pbx_frameworks :
1212
- framework_name = "{}.framework" .format (framework )
1213
- if framework_name in frameworks :
1223
+ if framework in [x ['name' ] for x in frameworks ]:
1214
1224
logger .info ("Ensure {} is in the project (pbx_frameworks, local)" .format (framework ))
1215
- f_path = join (ctx .dist_dir , "frameworks" , framework_name )
1225
+ f_path = join (ctx .dist_dir , "frameworks" , f"{ framework } .framework" )
1226
+ project .add_file (f_path , parent = group , tree = "DEVELOPER_DIR" ,
1227
+ force = False , file_options = file_options_embed )
1216
1228
else :
1217
1229
logger .info ("Ensure {} is in the project (pbx_frameworks, system)" .format (framework ))
1218
1230
f_path = join (sysroot , "System" , "Library" , "Frameworks" ,
1219
1231
"{}.framework" .format (framework ))
1220
- project .add_file (f_path , parent = group , tree = "DEVELOPER_DIR" ,
1221
- force = False , file_options = file_options )
1232
+ project .add_file (f_path , parent = group , tree = "DEVELOPER_DIR" ,
1233
+ force = False , file_options = file_options )
1222
1234
for library in pbx_libraries :
1223
1235
logger .info ("Ensure {} is in the project (pbx_libraries, dylib+tbd)" .format (library ))
1224
1236
f_path = join (sysroot , "usr" , "lib" ,
0 commit comments