diff --git a/build/premake/extern_libs4.lua b/build/premake/extern_libs4.lua index 2810a05743..f01afe6851 100644 --- a/build/premake/extern_libs4.lua +++ b/build/premake/extern_libs4.lua @@ -576,18 +576,19 @@ extern_lib_defs = { includedirs { libraries_dir .. "sdl/include/SDL" } end elseif not _OPTIONS["android"] then - -- Support SDL_CONFIG for overriding for the default PATH-based sdl-config - sdl_config_path = os.getenv("SDL_CONFIG") - if not sdl_config_path then - if _OPTIONS["sdl2"] then + -- Support SDL*_CONFIG for overriding the default PATH-based sdl*-config + if _OPTIONS["sdl2"] then + sdl_config_path = os.getenv("SDL2_CONFIG") + if not sdl_config_path then sdl_config_path = "sdl2-config" - else + end + else + sdl_config_path = os.getenv("SDL_CONFIG") + if not sdl_config_path then sdl_config_path = "sdl-config" end end - -- "pkg-config sdl --libs" appears to include both static and dynamic libs - -- when on MacPorts, which is bad, so use sdl-config instead pkgconfig_cflags(nil, sdl_config_path.." --cflags") end end, @@ -599,11 +600,14 @@ extern_lib_defs = { add_default_lib_paths("sdl") end elseif not _OPTIONS["android"] then - sdl_config_path = os.getenv("SDL_CONFIG") - if not sdl_config_path then - if _OPTIONS["sdl2"] then + if _OPTIONS["sdl2"] then + sdl_config_path = os.getenv("SDL2_CONFIG") + if not sdl_config_path then sdl_config_path = "sdl2-config" - else + end + else + sdl_config_path = os.getenv("SDL_CONFIG") + if not sdl_config_path then sdl_config_path = "sdl-config" end end diff --git a/build/workspaces/update-workspaces.sh b/build/workspaces/update-workspaces.sh index 1beba4bf42..879b053fa1 100644 --- a/build/workspaces/update-workspaces.sh +++ b/build/workspaces/update-workspaces.sh @@ -73,6 +73,7 @@ if [ "`uname -s`" = "Darwin" ]; then export GLOOX_CONFIG=${GLOOX_CONFIG:="$(pwd)/../../libraries/osx/gloox/bin/gloox-config"} export ICU_CONFIG=${ICU_CONFIG:="$(pwd)/../../libraries/osx/icu/bin/icu-config"} export SDL_CONFIG=${SDL_CONFIG:="$(pwd)/../../libraries/osx/sdl/bin/sdl-config"} + export SDL2_CONFIG=${SDL2_CONFIG:="$(pwd)/../../libraries/osx/sdl2/bin/sdl2-config"} export WX_CONFIG=${WX_CONFIG:="$(pwd)/../../libraries/osx/wxwidgets/bin/wx-config"} export XML2_CONFIG=${XML2_CONFIG:="$(pwd)/../../libraries/osx/libxml2/bin/xml2-config"} fi diff --git a/libraries/osx/build-osx-libs.sh b/libraries/osx/build-osx-libs.sh index 616ffbc4a9..4ba2926f33 100755 --- a/libraries/osx/build-osx-libs.sh +++ b/libraries/osx/build-osx-libs.sh @@ -26,6 +26,7 @@ ICONV_VERSION="libiconv-1.14" XML2_VERSION="libxml2-2.9.1" # * SDL 1.2.15+ required for Lion support SDL_VERSION="SDL-1.2.15" +SDL2_VERSION="SDL2-2.0.3" BOOST_VERSION="boost_1_52_0" # * wxWidgets 2.9+ is necessary for 64-bit OS X build w/ OpenGL support WXWIDGETS_VERSION="wxWidgets-3.0.1" @@ -295,6 +296,39 @@ else fi popd > /dev/null +# -------------------------------------------------------------- + +echo -e "Building SDL2..." + +LIB_VERSION="${SDL2_VERSION}" +LIB_ARCHIVE="$LIB_VERSION.tar.gz" +LIB_DIRECTORY=$LIB_VERSION +LIB_URL="http://www.libsdl.org/release/" + +mkdir -p sdl2 +pushd sdl2 > /dev/null + +if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]] +then + INSTALL_DIR="$(pwd)" + + rm -f .already-built + download_lib $LIB_URL $LIB_ARCHIVE + + rm -rf $LIB_DIRECTORY bin include lib share + tar -xf $LIB_ARCHIVE + pushd $LIB_DIRECTORY + + # We don't want SDL2 to pull in system iconv, force it to detect ours with flags. + # Don't use X11 - we don't need it and Mountain Lion removed it + (./configure CPPFLAGS="-I${ICONV_DIR}/include" CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS -L${ICONV_DIR}/lib" --prefix="$INSTALL_DIR" --disable-video-x11 --without-x --enable-shared=no && make $JOBS && make install) || die "SDL build failed" + popd + touch .already-built +else + already_built +fi +popd > /dev/null + # -------------------------------------------------------------- echo -e "Building Boost..."