diff --git a/Makefile b/Makefile index 32037764..46285597 100644 --- a/Makefile +++ b/Makefile @@ -68,20 +68,20 @@ endif RUSTDOC = rustdoc # Extracts target from rustc. -TARGET = $(shell rustc --version 2> /dev/null | awk "/host:/ { print \$$2 }") +TARGET = $(shell rustc --version verbose 2> /dev/null | awk "/host:/ { print \$$2 }") # TARGET = x86_64-unknown-linux-gnu # TARGET = x86_64-apple-darwin -TARGET_LIB_DIR = target/$(TARGET)/lib/ +TARGET_LIB_DIR = target/deps/ # Ask 'rustc' the file name of the library and use a dummy name if the source has not been created yet. # The dummy file name is used to trigger the creation of the source first time. # Next time 'rustc' will return the right file name. RLIB_FILE = $(shell (rustc --crate-type=rlib --crate-file-name "$(LIB_ENTRY_FILE)" 2> /dev/null) || (echo "dummy.rlib")) # You can't have quotes around paths because 'make' doesn't see it exists. -RLIB = target/$(TARGET)/lib/$(RLIB_FILE) +RLIB = target/$(RLIB_FILE) DYLIB_FILE = $(shell (rustc --crate-type=dylib --crate-file-name "$(LIB_ENTRY_FILE)" 2> /dev/null) || (echo "dummy.dylib")) -DYLIB = target/$(TARGET)/lib/$(DYLIB_FILE) +DYLIB = target/$(DYLIB_FILE) # Use 'VERBOSE=1' to echo all commands, for example 'make help VERBOSE=1'. ifdef VERBOSE @@ -93,7 +93,7 @@ endif all: $(DEFAULT) help: - $(Q)echo "--- rust-empty (0.5 007)" + $(Q)echo "--- rust-empty (0.6 003)" $(Q)echo "make run - Runs executable" $(Q)echo "make exe - Builds main executable" $(Q)echo "make lib - Both static and dynamic library" @@ -110,8 +110,8 @@ help: $(Q)echo "make examples - Builds examples" $(Q)echo "make cargo-lite-exe - Setup executable package" $(Q)echo "make cargo-lite-lib - Setup library package" - $(Q)echo "make cargo-exe - EXPERIMENTAL: Setup executable package" - $(Q)echo "make cargo-lib - EXPERIMENTAL: Setup library package" + $(Q)echo "make cargo-exe - Setup executable package" + $(Q)echo "make cargo-lib - Setup library package" $(Q)echo "make rust-ci-lib - Setup Travis CI Rust library" $(Q)echo "make rust-ci-exe - Setup Travis CI Rust executable" $(Q)echo "make rusti - Setup 'rusti.sh' for interactive Rust" @@ -211,12 +211,12 @@ cargo-exe: $(EXE_ENTRY_FILE) ( \ name=$${PWD##/*/} ; \ readme=$$((test -e README.md && echo -e "readme = \"README.md\"") || ("")) ; \ - echo -e "[package]\n\nname = \"$$name\"\nversion = \"0.0\"\n$$readme\nauthors = [\"Your Name \"]\ntags = []\n\n[[bin]]\n\nname = \"$$name\"\npath = \"$(EXE_ENTRY_FILE)\"\n" > Cargo.toml \ + echo -e "[package]\n\nname = \"$$name\"\nversion = \"0.0.0\"\n$$readme\nauthors = [\"Your Name \"]\ntags = []\n\n[[bin]]\n\nname = \"$$name\"\npath = \"$(EXE_ENTRY_FILE)\"\n" > Cargo.toml \ && echo "--- Created 'Cargo.toml' for executable" \ && cat Cargo.toml \ ) -cargo-lib: $(EXE_ENTRY_FILE) +cargo-lib: $(LIB_ENTRY_FILE) $(Q)( \ test -e Cargo.toml \ && echo "--- The file 'Cargo.toml' already exists" \ @@ -225,7 +225,7 @@ cargo-lib: $(EXE_ENTRY_FILE) ( \ name=$${PWD##/*/} ; \ readme=$$((test -e README.md && echo -e "readme = \"README.md\"") || ("")) ; \ - echo -e "[package]\n\nname = \"$$name\"\nversion = \"0.0\"\n$$readme\nauthors = [\"Your Name \"]\ntags = []\n\n[[lib]]\n\nname = \"$$name\"\npath = \"$(LIB_ENTRY_FILE)\"\n" > Cargo.toml \ + echo -e "[package]\n\nname = \"$$name\"\nversion = \"0.0.0\"\n$$readme\nauthors = [\"Your Name \"]\ntags = []\n\n[[lib]]\n\nname = \"$$name\"\npath = \"$(LIB_ENTRY_FILE)\"\n" > Cargo.toml \ && echo "--- Created 'Cargo.toml' for executable" \ && cat Cargo.toml \ ) @@ -255,7 +255,7 @@ rust-ci-exe: $(EXE_ENTRY_FILE) ) doc: $(SOURCE_FILES) | src/ - $(Q)$(RUSTDOC) $(LIB_ENTRY_FILE) -L "target/$(TARGET)/lib" \ + $(Q)$(RUSTDOC) $(LIB_ENTRY_FILE) -L "$(TARGET_LIB_DIR)" \ && echo "--- Built documentation" run: exe @@ -267,7 +267,7 @@ target-dir: $(TARGET_LIB_DIR) exe: bin/main | $(TARGET_LIB_DIR) bin/main: $(SOURCE_FILES) | bin/ $(EXE_ENTRY_FILE) - $(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) $(EXE_ENTRY_FILE) -o bin/main -L "target/$(TARGET)/lib" \ + $(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) $(EXE_ENTRY_FILE) -o bin/main -L "$(TARGET_LIB_DIR)" -L "target" \ && echo "--- Built executable" \ && echo "--- Type 'make run' to run executable" @@ -280,7 +280,7 @@ test-external: bin/test-external && ./test-external bin/test-external: $(SOURCE_FILES) | rlib bin/ src/test.rs - $(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) --test src/test.rs -o bin/test-external -L "target/$(TARGET)/lib" \ + $(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) --test src/test.rs -o bin/test-external -L "$(TARGET_LIB_DIR)" -L "target" \ && echo "--- Built external test runner" test-internal: bin/test-internal @@ -288,7 +288,7 @@ test-internal: bin/test-internal && ./test-internal bin/test-internal: $(SOURCE_FILES) | rlib src/ bin/ - $(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) --test $(LIB_ENTRY_FILE) -o bin/test-internal -L "target/$(TARGET)/lib" \ + $(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) --test $(LIB_ENTRY_FILE) -o bin/test-internal -L "$(TARGET_LIB_DIR)" -L "target" \ && echo "--- Built internal test runner" bench: bench-internal bench-external @@ -305,13 +305,13 @@ lib: rlib dylib rlib: $(RLIB) $(RLIB): $(SOURCE_FILES) | $(LIB_ENTRY_FILE) $(TARGET_LIB_DIR) - $(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) --crate-type=rlib $(LIB_ENTRY_FILE) -L "target/$(TARGET)/lib" --out-dir "target/$(TARGET)/lib/" \ + $(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) --crate-type=rlib $(LIB_ENTRY_FILE) -L "$(TARGET_LIB_DIR)" --out-dir "target" \ && echo "--- Built rlib" dylib: $(DYLIB) $(DYLIB): $(SOURCE_FILES) | $(LIB_ENTRY_FILE) $(TARGET_LIB_DIR) - $(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) --crate-type=dylib $(LIB_ENTRY_FILE) -L "target/$(TARGET)/lib" --out-dir "target/$(TARGET)/lib/" \ + $(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) --crate-type=dylib $(LIB_ENTRY_FILE) -L "$(TARGET_LIB_DIR)" --out-dir "target/" \ && echo "--- Built dylib" bin/: @@ -350,7 +350,7 @@ git-ignore: examples: $(EXAMPLE_FILES) $(EXAMPLE_FILES): lib examples-dir - $(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) $@ -L "target/$(TARGET)/lib" --out-dir examples/ \ + $(Q)$(COMPILER) --target "$(TARGET)" $(COMPILER_FLAGS) $@ -L "$(TARGET_LIB_DIR)" -L "target" --out-dir examples/ \ && echo "--- Built '$@' (make $@)" $(EXE_ENTRY_FILE): | src/ @@ -416,7 +416,7 @@ while true; do echo -n "> " read line TMP="`mktemp r.XXXXXX`" - $(COMPILER) - -o $$TMP -L "target/$(TARGET)/lib/" <; + (arg1: c_int, arg2: *const c_void, arg3: c_int, + arg4: *const c_void)>; pub type Mix_EffectDone_t = - ::std::option::Option; + ::std::option::Option; extern "C" { - pub fn Mix_Linked_Version() -> *SDL_version; + pub fn Mix_Linked_Version() -> *const SDL_version; pub fn Mix_Init(flags: c_int) -> c_int; pub fn Mix_Quit(); pub fn Mix_OpenAudio(frequency: c_int, format: uint16_t, channels: c_int, chunksize: c_int) -> c_int; pub fn Mix_AllocateChannels(numchans: c_int) -> c_int; - pub fn Mix_QuerySpec(frequency: *c_int, format: *uint16_t, - channels: *c_int) -> c_int; - pub fn Mix_LoadWAV_RW(src: *SDL_RWops, freesrc: c_int) -> - *Mix_Chunk; - pub fn Mix_LoadMUS(file: *c_char) -> *Mix_Music; - pub fn Mix_LoadMUS_RW(src: *SDL_RWops, freesrc: c_int) -> - *Mix_Music; - pub fn Mix_LoadMUSType_RW(src: *SDL_RWops, _type: Mix_MusicType, - freesrc: c_int) -> *Mix_Music; - pub fn Mix_QuickLoad_WAV(mem: *uint8_t) -> *Mix_Chunk; - pub fn Mix_QuickLoad_RAW(mem: *uint8_t, len: uint32_t) -> *Mix_Chunk; - pub fn Mix_FreeChunk(chunk: *Mix_Chunk); - pub fn Mix_FreeMusic(music: *Mix_Music); + pub fn Mix_QuerySpec(frequency: *const c_int, format: *const uint16_t, + channels: *const c_int) -> c_int; + pub fn Mix_LoadWAV_RW(src: *const SDL_RWops, freesrc: c_int) -> + *const Mix_Chunk; + pub fn Mix_LoadMUS(file: *const c_char) -> *const Mix_Music; + pub fn Mix_LoadMUS_RW(src: *const SDL_RWops, freesrc: c_int) -> + *const Mix_Music; + pub fn Mix_LoadMUSType_RW(src: *const SDL_RWops, _type: Mix_MusicType, + freesrc: c_int) -> *const Mix_Music; + pub fn Mix_QuickLoad_WAV(mem: *const uint8_t) -> *const Mix_Chunk; + pub fn Mix_QuickLoad_RAW(mem: *const uint8_t, len: uint32_t) -> *const Mix_Chunk; + pub fn Mix_FreeChunk(chunk: *const Mix_Chunk); + pub fn Mix_FreeMusic(music: *const Mix_Music); pub fn Mix_GetNumChunkDecoders() -> c_int; - pub fn Mix_GetChunkDecoder(index: c_int) -> *c_char; + pub fn Mix_GetChunkDecoder(index: c_int) -> *const c_char; pub fn Mix_GetNumMusicDecoders() -> c_int; - pub fn Mix_GetMusicDecoder(index: c_int) -> *c_char; - pub fn Mix_GetMusicType(music: *Mix_Music) -> Mix_MusicType; + pub fn Mix_GetMusicDecoder(index: c_int) -> *const c_char; + pub fn Mix_GetMusicType(music: *const Mix_Music) -> Mix_MusicType; pub fn Mix_SetPostMix(mix_func: ::std::option::Option, - arg: *c_void); + arg: *const c_void); pub fn Mix_HookMusic(mix_func: ::std::option::Option, - arg: *c_void); + arg: *const c_void); pub fn Mix_HookMusicFinished(music_finished: ::std::option::Option); - pub fn Mix_GetMusicHookData() -> *c_void; + pub fn Mix_GetMusicHookData() -> *const c_void; pub fn Mix_ChannelFinished(channel_finished: ::std::option::Option); pub fn Mix_RegisterEffect(chan: c_int, f: Mix_EffectFunc_t, - d: Mix_EffectDone_t, arg: *c_void) -> c_int; + d: Mix_EffectDone_t, arg: *const c_void) -> c_int; pub fn Mix_UnregisterEffect(channel: c_int, f: Mix_EffectFunc_t) -> c_int; pub fn Mix_UnregisterAllEffects(channel: c_int) -> c_int; pub fn Mix_SetPanning(channel: c_int, left: uint8_t, right: uint8_t) -> c_int; @@ -100,18 +100,18 @@ extern "C" { pub fn Mix_GroupCount(tag: c_int) -> c_int; pub fn Mix_GroupOldest(tag: c_int) -> c_int; pub fn Mix_GroupNewer(tag: c_int) -> c_int; - pub fn Mix_PlayChannelTimed(channel: c_int, chunk: *Mix_Chunk, + pub fn Mix_PlayChannelTimed(channel: c_int, chunk: *const Mix_Chunk, loops: c_int, ticks: c_int) -> c_int; - pub fn Mix_PlayMusic(music: *Mix_Music, loops: c_int) -> c_int; - pub fn Mix_FadeInMusic(music: *Mix_Music, loops: c_int, ms: c_int) -> + pub fn Mix_PlayMusic(music: *const Mix_Music, loops: c_int) -> c_int; + pub fn Mix_FadeInMusic(music: *const Mix_Music, loops: c_int, ms: c_int) -> c_int; - pub fn Mix_FadeInMusicPos(music: *Mix_Music, loops: c_int, ms: c_int, + pub fn Mix_FadeInMusicPos(music: *const Mix_Music, loops: c_int, ms: c_int, position: c_double) -> c_int; - pub fn Mix_FadeInChannelTimed(channel: c_int, chunk: *Mix_Chunk, + pub fn Mix_FadeInChannelTimed(channel: c_int, chunk: *const Mix_Chunk, loops: c_int, ms: c_int, ticks: c_int) -> c_int; pub fn Mix_Volume(channel: c_int, volume: c_int) -> c_int; - pub fn Mix_VolumeChunk(chunk: *Mix_Chunk, volume: c_int) -> c_int; + pub fn Mix_VolumeChunk(chunk: *const Mix_Chunk, volume: c_int) -> c_int; pub fn Mix_VolumeMusic(volume: c_int) -> c_int; pub fn Mix_HaltChannel(channel: c_int) -> c_int; pub fn Mix_HaltGroup(tag: c_int) -> c_int; @@ -132,17 +132,17 @@ extern "C" { pub fn Mix_SetMusicPosition(position: c_double) -> c_int; pub fn Mix_Playing(channel: c_int) -> c_int; pub fn Mix_PlayingMusic() -> c_int; - pub fn Mix_SetMusicCMD(command: *c_char) -> c_int; + pub fn Mix_SetMusicCMD(command: *const c_char) -> c_int; pub fn Mix_SetSynchroValue(value: c_int) -> c_int; pub fn Mix_GetSynchroValue() -> c_int; - pub fn Mix_SetSoundFonts(paths: *c_char) -> c_int; - pub fn Mix_GetSoundFonts() -> *c_char; + pub fn Mix_SetSoundFonts(paths: *const c_char) -> c_int; + pub fn Mix_GetSoundFonts() -> *const c_char; pub fn Mix_EachSoundFont(function: ::std::option::Option c_int>, - data: *c_void) -> c_int; - pub fn Mix_GetChunk(channel: c_int) -> *Mix_Chunk; + data: *const c_void) -> c_int; + pub fn Mix_GetChunk(channel: c_int) -> *const Mix_Chunk; pub fn Mix_CloseAudio(); } diff --git a/src/sdl2_mixer/lib.rs b/src/sdl2_mixer/lib.rs index 2595847f..aa92862c 100644 --- a/src/sdl2_mixer/lib.rs +++ b/src/sdl2_mixer/lib.rs @@ -176,7 +176,7 @@ pub fn get_chunk_decoder(index: int) -> String { /// The internal format for an audio chunk. #[deriving(PartialEq)] #[allow(raw_pointer_deriving, visible_private_types)] pub struct Chunk { - pub raw: *ffi::Mix_Chunk, + pub raw: *const ffi::Mix_Chunk, pub owned: bool } @@ -602,7 +602,7 @@ extern "C" fn c_music_finished_hook() { /// This is an opaque data type used for Music data. #[deriving(PartialEq)] #[allow(raw_pointer_deriving, visible_private_types)] pub struct Music { - pub raw: *ffi::Mix_Music, + pub raw: *const ffi::Mix_Music, pub owned: bool, }