From 14ead0b8b1c333b8f9a982f926c16c15fc800577 Mon Sep 17 00:00:00 2001 From: Reynisdrangar Date: Sat, 7 Jul 2018 11:56:08 -0600 Subject: [PATCH 1/3] Extend travis build matrix to include bundled/static Doubles the number of builds, unfortunately, but it should cover all the common linkage scenarios, except for macos frameworks, which I'm not sure I know enough about to handle. Also autoformats travis.yml and splits the SDL archive extraction and installation out to a shell script --- .travis.yml | 66 +++++++++++++++------------------- scripts/travis-install-sdl2.sh | 19 ++++++++++ 2 files changed, 47 insertions(+), 38 deletions(-) create mode 100644 scripts/travis-install-sdl2.sh diff --git a/.travis.yml b/.travis.yml index 9d12f0a27d4..4d3866114aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,47 +1,37 @@ language: rust sudo: required rust: -- beta -- nightly -- stable + - beta + - nightly + - stable os: -- linux -- osx + - linux + - osx +env: + matrix: + - CI_BUILD_FEATURES="bundled" + - CI_BUILD_FEATURES="gfx image ttf mixer" + global: + - RUST_TEST_THREADS=1 + - TRAVIS_CARGO_NIGHTLY_FEATURE="" + - LD_LIBRARY_PATH: "/usr/local/lib" + - secure: MJhmVnQ2IM7+sVmc3vU4ndKOcQgLLeHUPW3qaQBQHKQmvoswCwQK60N17uSgWn1Ln8teqvSRHq4KclIjdMHI+VuQXJHQKHDgjcYbHxwmc3AM1Whnp0XB44ksKUmD109BGWSfZQxzF+6dA+YNOQ+mti+bpydMu8n2FMVjA/SXwQ8= + install: -- wget https://www.libsdl.org/release/SDL2-2.0.8.tar.gz -O sdl2.tar.gz -- tar xzf sdl2.tar.gz -- pushd SDL2-* && ./configure && make && sudo make install && popd -- wget -q https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.tar.gz -- wget -q https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.1.tar.gz -- wget -q https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.tar.gz -- wget -q -O SDL2_gfx-1.0.1.tar.gz https://sourceforge.net/projects/sdl2gfx/files/SDL2_gfx-1.0.1.tar.gz/download -- tar xzf SDL2_ttf-*.tar.gz -- tar xzf SDL2_image-*.tar.gz -- tar xzf SDL2_mixer-*.tar.gz -- tar xzf SDL2_gfx-*.tar.gz -- pushd SDL2_ttf-* && ./configure && make && sudo make install && popd -- pushd SDL2_image-* && ./configure && make && sudo make install && popd -- pushd SDL2_mixer-* && ./configure && make && sudo make install && popd -- pushd SDL2_gfx-* && ./autogen.sh && ./configure && make && sudo make install && popd + - if [[ $CI_BUILD_FEATURES != *"bundled"* ]]; then bash scripts/travis-install-sdl2.sh; fi before_script: -- shopt -s expand_aliases -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then alias pip=pip2; fi -- | - pip install 'travis-cargo<0.2' --user && - export PATH=$HOME/.local/bin:$PATH && - export PATH=~/Library/Python/2.7/bin:$PATH + - shopt -s expand_aliases + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then alias pip=pip2; fi + - | + pip install 'travis-cargo<0.2' --user && + export PATH=$HOME/.local/bin:$PATH && + export PATH=~/Library/Python/2.7/bin:$PATH script: -- | - travis-cargo build -- --features "gfx image ttf mixer" && - travis-cargo build -- --examples --features "gfx image ttf mixer" && - travis-cargo test -- --features "gfx image ttf mixer" && - travis-cargo --only stable doc -- --features "gfx image ttf mixer" + - | + travis-cargo build -- --features "${CI_BUILD_FEATURES}" && + travis-cargo build -- --examples --features "${CI_BUILD_FEATURES}" && + travis-cargo test -- --features "${CI_BUILD_FEATURES}" && + travis-cargo --only stable doc -- --features "${CI_BUILD_FEATURES}" after_success: -- travis-cargo --only stable doc-upload -env: - global: - - RUST_TEST_THREADS=1 - - TRAVIS_CARGO_NIGHTLY_FEATURE="" - - LD_LIBRARY_PATH: "/usr/local/lib" - - secure: MJhmVnQ2IM7+sVmc3vU4ndKOcQgLLeHUPW3qaQBQHKQmvoswCwQK60N17uSgWn1Ln8teqvSRHq4KclIjdMHI+VuQXJHQKHDgjcYbHxwmc3AM1Whnp0XB44ksKUmD109BGWSfZQxzF+6dA+YNOQ+mti+bpydMu8n2FMVjA/SXwQ8= + - travis-cargo --only stable doc-upload diff --git a/scripts/travis-install-sdl2.sh b/scripts/travis-install-sdl2.sh new file mode 100644 index 00000000000..a6f42b5fcf2 --- /dev/null +++ b/scripts/travis-install-sdl2.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -xueo pipefail + +wget https://www.libsdl.org/release/SDL2-2.0.8.tar.gz -O sdl2.tar.gz +tar xzf sdl2.tar.gz +pushd SDL2-* && ./configure && make && sudo make install && popd +wget -q https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.tar.gz +wget -q https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.1.tar.gz +wget -q https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.tar.gz +wget -q -O SDL2_gfx-1.0.1.tar.gz https://sourceforge.net/projects/sdl2gfx/files/SDL2_gfx-1.0.1.tar.gz/download +tar xzf SDL2_ttf-*.tar.gz +tar xzf SDL2_image-*.tar.gz +tar xzf SDL2_mixer-*.tar.gz +tar xzf SDL2_gfx-*.tar.gz +pushd SDL2_ttf-* && ./configure && make && sudo make install && popd +pushd SDL2_image-* && ./configure && make && sudo make install && popd +pushd SDL2_mixer-* && ./configure && make && sudo make install && popd +pushd SDL2_gfx-* && ./autogen.sh && ./configure && make && sudo make install && popd From 0472c00dd9d29236afad7722fcdf57ed0d801e5b Mon Sep 17 00:00:00 2001 From: Drew Pirrone-Brusse Date: Sat, 22 Sep 2018 15:02:49 -0400 Subject: [PATCH 2/3] Lock bundled SDL2 builds to 2.0.5 --- sdl2-sys/build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdl2-sys/build.rs b/sdl2-sys/build.rs index 5b182008887..0359e96fc42 100644 --- a/sdl2-sys/build.rs +++ b/sdl2-sys/build.rs @@ -20,10 +20,10 @@ use std::path::{Path, PathBuf}; use std::{io, fs, env}; // corresponds to the headers that we have in sdl2-sys/SDL2-{version} -const SDL2_HEADERS_BUNDLED_VERSION: &str = "2.0.8"; +const SDL2_HEADERS_BUNDLED_VERSION: &str = "2.0.5"; // means the lastest stable version that can be downloaded from SDL2's source -const LASTEST_SDL2_VERSION: &str = "2.0.8"; +const LASTEST_SDL2_VERSION: &str = "2.0.5"; #[cfg(feature = "bindgen")] macro_rules! add_msvc_includes_to_bindings { From e5100d17c2023ecb3acc6edc7c13f304bf60b529 Mon Sep 17 00:00:00 2001 From: Drew Pirrone-Brusse Date: Sat, 22 Sep 2018 15:37:02 -0400 Subject: [PATCH 3/3] Fix a test in audio.rs Assert that stereo buffers are *at least* twice the original size, rather than more than twice the size. --- src/sdl2/audio.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl2/audio.rs b/src/sdl2/audio.rs index c4bc2612732..88942bccb50 100644 --- a/src/sdl2/audio.rs +++ b/src/sdl2/audio.rs @@ -829,7 +829,7 @@ mod test { assert!(cvt.is_conversion_needed()); // since we're going from mono to stereo, our capacity must be at least twice the original (255) vec size - assert!(cvt.capacity(255) > 255*2, "capacity must be able to hold the converted audio sample"); + assert!(cvt.capacity(255) >= 255*2, "capacity must be able to hold the converted audio sample"); let new_buffer = cvt.convert(buffer); assert_eq!(new_buffer.len(), new_buffer_expected.len(), "capacity must be exactly equal to twice the original vec size");