Commit 387f212a authored by Felix Geyer's avatar Felix Geyer

Update upstream source from tag 'upstream/2.0.8+dfsg1'

Update to upstream version '2.0.8+dfsg1'
with Debian dir 20bdcb76f5fc351f691eef9f454156cc0afeb65a
parents f5e64793 f49ee840
......@@ -42,16 +42,16 @@ include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake)
# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
set(SDL_MAJOR_VERSION 2)
set(SDL_MINOR_VERSION 0)
set(SDL_MICRO_VERSION 7)
set(SDL_MICRO_VERSION 8)
set(SDL_INTERFACE_AGE 0)
set(SDL_BINARY_AGE 7)
set(SDL_BINARY_AGE 8)
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
# Set defaults preventing destination file conflicts
set(CMAKE_DEBUG_POSTFIX "d"
set(SDL_CMAKE_DEBUG_POSTFIX "d"
CACHE STRING "Name suffix for debug builds")
mark_as_advanced(CMAKE_IMPORT_LIBRARY_SUFFIX CMAKE_DEBUG_POSTFIX)
mark_as_advanced(CMAKE_IMPORT_LIBRARY_SUFFIX SDL_CMAKE_DEBUG_POSTFIX)
# Calculate a libtool-like version number
math(EXPR LT_CURRENT "${SDL_MICRO_VERSION} - ${SDL_INTERFACE_AGE}")
......@@ -340,6 +340,7 @@ set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared versi
set(SDL_STATIC ON CACHE BOOL "Build a static version of the library")
dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" OFF "SDL_STATIC" OFF)
set_option(SDL_TEST "Build the test directory" OFF)
# General source files
file(GLOB SOURCE_FILES
......@@ -356,7 +357,8 @@ file(GLOB SOURCE_FILES
${SDL2_SOURCE_DIR}/src/stdlib/*.c
${SDL2_SOURCE_DIR}/src/thread/*.c
${SDL2_SOURCE_DIR}/src/timer/*.c
${SDL2_SOURCE_DIR}/src/video/*.c)
${SDL2_SOURCE_DIR}/src/video/*.c
${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c)
if(ASSERTIONS STREQUAL "auto")
......@@ -579,6 +581,8 @@ if(ASSEMBLY)
endif()
endif()
check_include_file("immintrin.h" HAVE_IMMINTRIN_H)
if(ALTIVEC)
set(CMAKE_REQUIRED_FLAGS "-maltivec")
check_c_source_compiles("
......@@ -637,8 +641,10 @@ if(LIBC)
wcslen wcscmp
strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
_ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp
_stricmp _strnicmp sscanf atan atan2 acos asin ceil copysign cos
cosf fabs floor log pow scalbn sin sinf sqrt sqrtf tan tanf)
_stricmp _strnicmp sscanf
acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf
copysign copysignf cos cosf fabs fabsf floor floorf fmod fmodf
log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
string(TOUPPER ${_FN} _UPPER)
set(HAVE_${_UPPER} 1)
endforeach()
......@@ -1177,11 +1183,10 @@ elseif(WINDOWS)
check_include_file(ddraw.h HAVE_DDRAW_H)
check_include_file(dsound.h HAVE_DSOUND_H)
check_include_file(dinput.h HAVE_DINPUT_H)
check_include_file(xaudio2.h HAVE_XAUDIO2_H)
check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)
check_include_file(dxgi.h HAVE_DXGI_H)
if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H)
if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H)
set(HAVE_DIRECTX TRUE)
if(NOT CMAKE_COMPILER_IS_MINGW AND NOT USE_WINSDK_DIRECTX)
# TODO: change $ENV{DXSDL_DIR} to get the path from the include checks
......@@ -1204,12 +1209,6 @@ elseif(WINDOWS)
set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES})
endif()
if(HAVE_XAUDIO2_H)
set(SDL_AUDIO_DRIVER_XAUDIO2 1)
file(GLOB XAUDIO2_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/xaudio2/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${XAUDIO2_AUDIO_SOURCES})
endif()
if(HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H)
set(SDL_AUDIO_DRIVER_WASAPI 1)
file(GLOB WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/*.c)
......@@ -1483,6 +1482,13 @@ elseif(APPLE)
set(SDL_VIDEO_RENDER_OGL 1)
set(HAVE_VIDEO_OPENGL TRUE)
endif()
if(VIDEO_OPENGLES)
set(SDL_VIDEO_OPENGL_EGL 1)
set(SDL_VIDEO_OPENGL_ES2 1)
set(SDL_VIDEO_RENDER_OGL_ES2 1)
set(HAVE_VIDEO_OPENGLES TRUE)
endif()
endif()
endif()
......@@ -1691,6 +1697,9 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
add_library(SDL2main STATIC ${SDLMAIN_SOURCES})
target_include_directories(SDL2main PUBLIC $<INSTALL_INTERFACE:include>)
set(_INSTALL_LIBS "SDL2main")
if (NOT ANDROID)
set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
endif()
if(SDL_SHARED)
add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES})
......@@ -1716,6 +1725,9 @@ if(SDL_SHARED)
set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
target_include_directories(SDL2 PUBLIC $<INSTALL_INTERFACE:include>)
if (NOT ANDROID)
set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
endif()
endif()
if(SDL_STATIC)
......@@ -1739,6 +1751,18 @@ if(SDL_STATIC)
set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS})
target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
target_include_directories(SDL2-static PUBLIC $<INSTALL_INTERFACE:include>)
if (NOT ANDROID)
set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
endif()
endif()
##### Tests #####
if(SDL_TEST)
file(GLOB TEST_SOURCES ${SDL2_SOURCE_DIR}/src/test/*.c)
add_library(SDL2_test STATIC ${TEST_SOURCES})
add_subdirectory(test)
endif()
##### Installation targets #####
......@@ -1791,10 +1815,12 @@ if(NOT (WINDOWS OR CYGWIN))
else()
set(SOEXT "so")
endif()
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
\"libSDL2-2.0.${SOEXT}\" \"libSDL2.${SOEXT}\")")
install(FILES ${SDL2_BINARY_DIR}/libSDL2.${SOEXT} DESTINATION "lib${LIB_SUFFIX}")
if(NOT ANDROID)
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
\"libSDL2-2.0.${SOEXT}\" \"libSDL2.${SOEXT}\")")
install(FILES ${SDL2_BINARY_DIR}/libSDL2.${SOEXT} DESTINATION "lib${LIB_SUFFIX}")
endif()
endif()
if(FREEBSD)
# FreeBSD uses ${PREFIX}/libdata/pkgconfig
......
Simple DirectMedia Layer
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
......
Summary: Simple DirectMedia Layer
Name: SDL2
Version: 2.0.7
Version: 2.0.8
Release: 2
Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
URL: http://www.libsdl.org/
......
This is a list of major changes in SDL's version history.
---------------------------------------------------------------------------
2.0.8:
---------------------------------------------------------------------------
General:
* Added SDL_fmod() and SDL_log10()
* Each of the SDL math functions now has the corresponding float version
* Added SDL_SetYUVConversionMode() and SDL_GetYUVConversionMode() to control the formula used when converting to and from YUV colorspace. The options are JPEG, BT.601, and BT.709
Windows:
* Implemented WASAPI support on Windows UWP and removed the deprecated XAudio2 implementation
* Added resampling support on WASAPI on Windows 7 and above
Windows UWP:
* Added SDL_WinRTGetDeviceFamily() to find out what type of device your application is running on
Mac OS X:
* Added support for the Vulkan SDK for Mac:
https://www.lunarg.com/lunarg-releases-vulkan-sdk-1-0-69-0-for-mac/
* Added support for OpenGL ES using ANGLE when it's available
Mac OS X / iOS / tvOS:
* Added a Metal 2D render implementation
* Added SDL_RenderGetMetalLayer() and SDL_RenderGetMetalCommandEncoder() to insert your own drawing into SDL rendering when using the Metal implementation
iOS:
* Added the hint SDL_HINT_IOS_HIDE_HOME_INDICATOR to control whether the home indicator bar on iPhone X should be hidden. This defaults to dimming the indicator for fullscreen applications and showing the indicator for windowed applications.
iOS / Android:
* Added the hint SDL_HINT_RETURN_KEY_HIDES_IME to control whether the return key on the software keyboard should hide the keyboard or send a key event (the default)
Android:
* SDL now supports building with Android Studio and Gradle by default, and the old Ant project is available in android-project-ant
* SDL now requires the API 19 SDK to build, but can still target devices down to API 14 (Android 4.0.1)
* Added SDL_IsAndroidTV() to tell whether the application is running on Android TV
Android / tvOS:
* Added the hint SDL_HINT_TV_REMOTE_AS_JOYSTICK to control whether TV remotes should be listed as joystick devices (the default) or send keyboard events.
Linux:
* Added the hint SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR to control whether the X server should skip the compositor for the SDL application. This defaults to "1"
* Added the hint SDL_HINT_VIDEO_DOUBLE_BUFFER to control whether the Raspberry Pi and KMSDRM video drivers should use double or triple buffering (the default)
---------------------------------------------------------------------------
2.0.7:
---------------------------------------------------------------------------
......
......@@ -25,46 +25,21 @@ if [ -z "$1" ] || [ -z "$SOURCES" ]; then
echo "Usage: androidbuild.sh com.yourcompany.yourapp < sources.list"
echo "Usage: androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c"
echo "To copy SDL source instead of symlinking: COPYSOURCE=1 androidbuild.sh ... "
echo "You can pass additional arguments to ndk-build with the NDKARGS variable: NDKARGS=\"-s\" androidbuild.sh ..."
exit 1
fi
SDLPATH="$( cd "$(dirname "$0")/.." ; pwd -P )"
NDKBUILD=`which ndk-build`
if [ -z "$NDKBUILD" ];then
echo "Could not find the ndk-build utility, install Android's NDK and add it to the path"
exit 1
fi
ANDROID=`which android`
if [ -z "$ANDROID" ];then
echo "Could not find the android utility, install Android's SDK and add it to the path"
if [ -z "$ANDROID_HOME" ];then
echo "Please set the ANDROID_HOME directory to the path of the Android SDK"
exit 1
fi
ANT=`which ant`
if [ -z "$ANT" ];then
echo "Could not find the ant utility, install Android's SDK and add it to the path"
if [ ! -d "$ANDROID_HOME/ndk-bundle" -a -z "$ANDROID_NDK_HOME" ]; then
echo "Please set the ANDROID_NDK_HOME directory to the path of the Android NDK"
exit 1
fi
NCPUS="1"
case "$OSTYPE" in
darwin*)
NCPU=`sysctl -n hw.ncpu`
;;
linux*)
if [ -n `which nproc` ]; then
NCPUS=`nproc`
fi
;;
*);;
esac
APP="$1"
APPARR=(${APP//./ })
BUILDPATH="$SDLPATH/build/$APP"
......@@ -77,27 +52,28 @@ mkdir -p $BUILDPATH
cp -r $SDLPATH/android-project/* $BUILDPATH
# Copy SDL sources
mkdir -p $BUILDPATH/jni/SDL
mkdir -p $BUILDPATH/app/jni/SDL
if [ -z "$COPYSOURCE" ]; then
ln -s $SDLPATH/src $BUILDPATH/jni/SDL
ln -s $SDLPATH/include $BUILDPATH/jni/SDL
ln -s $SDLPATH/src $BUILDPATH/app/jni/SDL
ln -s $SDLPATH/include $BUILDPATH/app/jni/SDL
else
cp -r $SDLPATH/src $BUILDPATH/jni/SDL
cp -r $SDLPATH/include $BUILDPATH/jni/SDL
cp -r $SDLPATH/src $BUILDPATH/app/jni/SDL
cp -r $SDLPATH/include $BUILDPATH/app/jni/SDL
fi
cp -r $SDLPATH/Android.mk $BUILDPATH/jni/SDL
sed -i -e "s|YourSourceHere.c|$MKSOURCES|g" $BUILDPATH/jni/src/Android.mk
sed -i -e "s|org\.libsdl\.app|$APP|g" $BUILDPATH/AndroidManifest.xml
cp -r $SDLPATH/Android.mk $BUILDPATH/app/jni/SDL
sed -i -e "s|YourSourceHere.c|$MKSOURCES|g" $BUILDPATH/app/jni/src/Android.mk
sed -i -e "s|org\.libsdl\.app|$APP|g" $BUILDPATH/app/build.gradle
sed -i -e "s|org\.libsdl\.app|$APP|g" $BUILDPATH/app/src/main/AndroidManifest.xml
# Copy user sources
for src in "${SOURCES[@]}"
do
cp $src $BUILDPATH/jni/src
cp $src $BUILDPATH/app/jni/src
done
# Create an inherited Activity
cd $BUILDPATH/src
cd $BUILDPATH/app/src/main/java
for folder in "${APPARR[@]}"
do
mkdir -p $folder
......@@ -105,31 +81,20 @@ do
done
ACTIVITY="${folder}Activity"
sed -i -e "s|SDLActivity|$ACTIVITY|g" $BUILDPATH/AndroidManifest.xml
sed -i -e "s|SDLActivity|$APP|g" $BUILDPATH/build.xml
sed -i -e "s|\"SDLActivity\"|\"$ACTIVITY\"|g" $BUILDPATH/app/src/main/AndroidManifest.xml
# Fill in a default Activity
echo "package $APP;" > "$ACTIVITY.java"
echo "import org.libsdl.app.SDLActivity;" >> "$ACTIVITY.java"
echo "public class $ACTIVITY extends SDLActivity {}" >> "$ACTIVITY.java"
# Update project and build
cd $BUILDPATH
$ANDROID update project --path $BUILDPATH
$NDKBUILD -j $NCPUS $NDKARGS
$ANT debug
cat >"$ACTIVITY.java" <<__EOF__
package $APP;
cd $CURDIR
import org.libsdl.app.SDLActivity;
APK="$BUILDPATH/bin/$APP-debug.apk"
public class $ACTIVITY extends SDLActivity
{
}
__EOF__
if [ -f "$APK" ]; then
echo "Your APK is ready at $APK"
echo "To install to your device: "
echo "cd $BUILDPATH"
echo "ant debug install"
exit 0
fi
echo "There was an error building the APK"
exit 1
\ No newline at end of file
# Update project and build
echo "To build and install to a device for testing, run the following:"
echo "cd $BUILDPATH"
echo "./gradlew installDebug"
......@@ -68,7 +68,7 @@ ndk-build \
NDK_OUT=$obj \
NDK_LIBS_OUT=$lib \
APP_BUILD_SCRIPT=Android.mk \
APP_ABI="all" \
APP_PLATFORM=android-12 \