File tree Expand file tree Collapse file tree 2 files changed +16
-21
lines changed Expand file tree Collapse file tree 2 files changed +16
-21
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,22 @@ fn link_sdl2(target_os: &str) {
196
196
// TODO: Add other platform linker options here.
197
197
}
198
198
}
199
+ // SDL libraries seem to not be packed with pkgconfig file on all distros,
200
+ // and in the same distros (fedora at least) a symlink is also missing.
201
+ //
202
+ // Linking directly with file is not possible with cargo since the
203
+ // ':filename' syntax is used for renaming of libraries, which basically
204
+ // leaves it up to the user to make a symlink to the shared object so
205
+ // -lSDL2_mixer can find it.
206
+ #[ cfg( all( not( feature = "use-pkgconfig" ) , not( feature = "static-link" ) ) ) ] {
207
+ if cfg ! ( all( any( target_os="linux" , target_os="freebsd" ) , feature = "mixer" ) ) {
208
+ println ! ( "cargo:rustc-flags=-l SDL2_mixer" ) ;
209
+ } else if cfg ! ( all( target_os="windows" , feature = "mixer" ) ) {
210
+ println ! ( "cargo:rustc-flags=-l SDL2_mixer" ) ;
211
+ } else if cfg ! ( all( any( target_os="macos" , feature="use_mac_framework" ) , feature = "mixer" ) ) {
212
+ println ! ( "cargo:rustc-flags=-l framework=SDL2_mixer" ) ;
213
+ }
214
+ }
199
215
}
200
216
201
217
fn main ( ) {
Original file line number Diff line number Diff line change @@ -34,27 +34,6 @@ use ::rwops::RWops;
34
34
use :: version:: Version ;
35
35
use sys;
36
36
37
- // Setup linking for all targets.
38
- #[ cfg( target_os="macos" ) ]
39
- mod mac {
40
- #[ cfg( any( mac_framework, feature="use_mac_framework" ) ) ]
41
- #[ link( kind="framework" , name="SDL2_mixer" ) ]
42
- extern "C" {
43
- }
44
-
45
- #[ cfg( not( any( mac_framework, feature="use_mac_framework" ) ) ) ]
46
- #[ link( name="SDL2_mixer" ) ]
47
- extern "C" {
48
- }
49
- }
50
-
51
- #[ cfg( any( target_os="windows" , target_os="linux" , target_os="freebsd" ) ) ]
52
- mod others {
53
- #[ link( name="SDL2_mixer" ) ]
54
- extern "C" {
55
- }
56
- }
57
-
58
37
// This comes from SDL_audio.h
59
38
#[ allow( non_camel_case_types) ]
60
39
mod ll {
You can’t perform that action at this time.
0 commit comments