@@ -1015,7 +1015,7 @@ fn link_rlib(sess: Session, obj_filename: &Path,
1015
1015
cstore:: NativeStatic => {
1016
1016
a. add_native_library ( l. as_slice ( ) ) ;
1017
1017
}
1018
- cstore:: NativeUnknown => { }
1018
+ cstore:: NativeFramework | cstore :: NativeUnknown => { }
1019
1019
}
1020
1020
}
1021
1021
return a;
@@ -1044,8 +1044,13 @@ fn link_staticlib(sess: Session, obj_filename: &Path, out_filename: &Path) {
1044
1044
} ;
1045
1045
a. add_rlib ( & p) ;
1046
1046
let native_libs = csearch:: get_native_libraries ( sess. cstore , cnum) ;
1047
- for lib in native_libs. iter ( ) {
1048
- sess. warn ( format ! ( "unlinked native library: {}" , * lib) ) ;
1047
+ for & ( kind, ref lib) in native_libs. iter ( ) {
1048
+ let name = match kind {
1049
+ cstore:: NativeStatic => "static library" ,
1050
+ cstore:: NativeUnknown => "library" ,
1051
+ cstore:: NativeFramework => "framework" ,
1052
+ } ;
1053
+ sess. warn ( format ! ( "unlinked native {}: {}" , name, * lib) ) ;
1049
1054
}
1050
1055
}
1051
1056
}
@@ -1204,8 +1209,17 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
1204
1209
args. push ( cratepath. as_str ( ) . unwrap ( ) . to_owned ( ) ) ;
1205
1210
1206
1211
let libs = csearch:: get_native_libraries ( sess. cstore , cnum) ;
1207
- for lib in libs. iter ( ) {
1208
- args. push ( "-l" + * lib) ;
1212
+ for & ( kind, ref lib) in libs. iter ( ) {
1213
+ match kind {
1214
+ cstore:: NativeUnknown => args. push ( "-l" + * lib) ,
1215
+ cstore:: NativeFramework => {
1216
+ args. push ( ~"-framework") ;
1217
+ args. push ( lib. to_owned ( ) ) ;
1218
+ }
1219
+ cstore:: NativeStatic => {
1220
+ sess. bug ( "statics shouldn't be propagated" ) ;
1221
+ }
1222
+ }
1209
1223
}
1210
1224
}
1211
1225
return ;
@@ -1262,7 +1276,15 @@ fn add_local_native_libraries(args: &mut ~[~str], sess: Session) {
1262
1276
args. push ( "-L" + path. as_str ( ) . unwrap ( ) . to_owned ( ) ) ;
1263
1277
}
1264
1278
1265
- for & ( ref l, _) in cstore:: get_used_libraries ( sess. cstore ) . iter ( ) {
1266
- args. push ( ~"-l" + * l) ;
1279
+ for & ( ref l, kind) in cstore:: get_used_libraries ( sess. cstore ) . iter ( ) {
1280
+ match kind {
1281
+ cstore:: NativeUnknown | cstore:: NativeStatic => {
1282
+ args. push ( "-l" + * l) ;
1283
+ }
1284
+ cstore:: NativeFramework => {
1285
+ args. push ( ~"-framework") ;
1286
+ args. push ( l. to_owned ( ) ) ;
1287
+ }
1288
+ }
1267
1289
}
1268
1290
}
0 commit comments