Add a vendored copy of SDL
This commit is contained in:
351
vendored/sdl/build-scripts/android-prefab.sh
Normal file
351
vendored/sdl/build-scripts/android-prefab.sh
Normal file
@ -0,0 +1,351 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if ! [ "x$ANDROID_NDK_HOME" != "x" -a -d "$ANDROID_NDK_HOME" ]; then
|
||||
echo "ANDROID_NDK_HOME environment variable is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [ "x$ANDROID_HOME" != "x" -a -d "$ANDROID_HOME" ]; then
|
||||
echo "ANDROID_HOME environment variable is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "x$ANDROID_API" = "x" ]; then
|
||||
ANDROID_API="$(ls "$ANDROID_HOME/platforms" | grep -E "^android-[0-9]+$" | sed 's/android-//' | sort -n -r | head -1)"
|
||||
if [ "x$ANDROID_API" = "x" ]; then
|
||||
echo "No Android platform found in $ANDROID_HOME/platforms"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if ! [ -d "$ANDROID_HOME/platforms/android-$ANDROID_API" ]; then
|
||||
echo "Android api version $ANDROID_API is not available ($ANDROID_HOME/platforms/android-$ANDROID_API does not exist)" >2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
android_platformdir="$ANDROID_HOME/platforms/android-$ANDROID_API"
|
||||
|
||||
echo "Building for android api version $ANDROID_API"
|
||||
echo "android_platformdir=$android_platformdir"
|
||||
|
||||
scriptdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
|
||||
sdl_root=$(cd -P -- "$(dirname -- "$0")/.." && printf '%s\n' "$(pwd -P)")
|
||||
|
||||
build_root="${sdl_root}/build-android-prefab"
|
||||
|
||||
android_abis="armeabi-v7a arm64-v8a x86 x86_64"
|
||||
android_api=19
|
||||
android_ndk=21
|
||||
android_stl="c++_shared"
|
||||
|
||||
sdl_major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' "${sdl_root}/include/SDL_version.h")
|
||||
sdl_minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' "${sdl_root}/include/SDL_version.h")
|
||||
sdl_patch=$(sed -ne 's/^#define SDL_PATCHLEVEL *//p' "${sdl_root}/include/SDL_version.h")
|
||||
sdl_version="${sdl_major}.${sdl_minor}.${sdl_patch}"
|
||||
echo "Building Android prefab package for SDL version $sdl_version"
|
||||
|
||||
prefabhome="${build_root}/prefab-${sdl_version}"
|
||||
rm -rf "$prefabhome"
|
||||
mkdir -p "${prefabhome}"
|
||||
|
||||
build_cmake_projects() {
|
||||
for android_abi in $android_abis; do
|
||||
echo "Configuring CMake project for $android_abi"
|
||||
cmake -S "$sdl_root" -B "${build_root}/build_${android_abi}" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake" \
|
||||
-DANDROID_PLATFORM=${android_platform} \
|
||||
-DANDROID_ABI=${android_abi} \
|
||||
-DSDL_SHARED=ON \
|
||||
-DSDL_STATIC=ON \
|
||||
-DSDL_STATIC_PIC=ON \
|
||||
-DSDL_TEST=ON \
|
||||
-DSDL2_DISABLE_SDL2MAIN=OFF \
|
||||
-DSDL2_DISABLE_INSTALL=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX="${build_root}/build_${android_abi}/prefix" \
|
||||
-DCMAKE_INSTALL_INCLUDEDIR=include \
|
||||
-DCMAKE_INSTALL_LIBDIR=lib \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-GNinja
|
||||
|
||||
rm -rf "${build_root}/build_${android_abi}/prefix"
|
||||
|
||||
echo "Building CMake project for $android_abi"
|
||||
cmake --build "${build_root}/build_${android_abi}"
|
||||
|
||||
echo "Installing CMake project for $android_abi"
|
||||
cmake --install "${build_root}/build_${android_abi}"
|
||||
done
|
||||
}
|
||||
|
||||
classes_sources_jar_path="${prefabhome}/classes-sources.jar"
|
||||
classes_jar_path="${prefabhome}/classes.jar"
|
||||
compile_java() {
|
||||
classes_sources_root="${prefabhome}/classes-sources"
|
||||
|
||||
rm -rf "${classes_sources_root}"
|
||||
mkdir -p "${classes_sources_root}/META-INF"
|
||||
|
||||
echo "Copying LICENSE.txt to java build folder"
|
||||
cp "$sdl_root/LICENSE.txt" "${classes_sources_root}/META-INF"
|
||||
|
||||
echo "Copy JAVA sources to java build folder"
|
||||
cp -r "$sdl_root/android-project/app/src/main/java/org" "${classes_sources_root}"
|
||||
|
||||
java_sourceslist_path="${prefabhome}/java_sources.txt"
|
||||
pushd "${classes_sources_root}"
|
||||
echo "Collecting sources for classes-sources.jar"
|
||||
find "." -name "*.java" >"${java_sourceslist_path}"
|
||||
find "META-INF" -name "*" >>"${java_sourceslist_path}"
|
||||
|
||||
echo "Creating classes-sources.jar"
|
||||
jar -cf "${classes_sources_jar_path}" "@${java_sourceslist_path}"
|
||||
popd
|
||||
|
||||
classes_root="${prefabhome}/classes"
|
||||
mkdir -p "${classes_root}/META-INF"
|
||||
cp "$sdl_root/LICENSE.txt" "${classes_root}/META-INF"
|
||||
java_sourceslist_path="${prefabhome}/java_sources.txt"
|
||||
|
||||
echo "Collecting sources for classes.jar"
|
||||
find "$sdl_root/android-project/app/src/main/java" -name "*.java" >"${java_sourceslist_path}"
|
||||
|
||||
echo "Compiling classes"
|
||||
javac -encoding utf-8 -classpath "$android_platformdir/android.jar" -d "${classes_root}" "@${java_sourceslist_path}"
|
||||
|
||||
java_classeslist_path="${prefabhome}/java_classes.txt"
|
||||
pushd "${classes_root}"
|
||||
find "." -name "*.class" >"${java_classeslist_path}"
|
||||
find "META-INF" -name "*" >>"${java_classeslist_path}"
|
||||
echo "Creating classes.jar"
|
||||
jar -cf "${classes_jar_path}" "@${java_classeslist_path}"
|
||||
popd
|
||||
}
|
||||
|
||||
pom_filename="SDL${sdl_major}-${sdl_version}.pom"
|
||||
pom_filepath="${prefabhome}/${pom_filename}"
|
||||
create_pom_xml() {
|
||||
echo "Creating ${pom_filename}"
|
||||
cat >"${pom_filepath}" <<EOF
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.libsdl.android</groupId>
|
||||
<artifactId>SDL${sdl_major}</artifactId>
|
||||
<version>${sdl_version}</version>
|
||||
<packaging>aar</packaging>
|
||||
<name>SDL${sdl_major}</name>
|
||||
<description>The AAR for SDL${sdl_major}</description>
|
||||
<url>https://libsdl.org/</url>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>zlib License</name>
|
||||
<url>https://github.com/libsdl-org/SDL/blob/main/LICENSE.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
<scm>
|
||||
<connection>scm:git:https://github.com/libsdl-org/SDL</connection>
|
||||
<url>https://github.com/libsdl-org/SDL</url>
|
||||
</scm>
|
||||
</project>
|
||||
EOF
|
||||
}
|
||||
|
||||
create_aar_androidmanifest() {
|
||||
echo "Creating AndroidManifest.xml"
|
||||
cat >"${aar_root}/AndroidManifest.xml" <<EOF
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.libsdl.android" android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<uses-sdk android:minSdkVersion="16"
|
||||
android:targetSdkVersion="29"/>
|
||||
</manifest>
|
||||
EOF
|
||||
}
|
||||
|
||||
echo "Creating AAR root directory"
|
||||
aar_root="${prefabhome}/SDL${sdl_major}-${sdl_version}"
|
||||
mkdir -p "${aar_root}"
|
||||
|
||||
aar_metainfdir_path=${aar_root}/META-INF
|
||||
mkdir -p "${aar_metainfdir_path}"
|
||||
cp "${sdl_root}/LICENSE.txt" "${aar_metainfdir_path}"
|
||||
|
||||
prefabworkdir="${aar_root}/prefab"
|
||||
mkdir -p "${prefabworkdir}"
|
||||
|
||||
cat >"${prefabworkdir}/prefab.json" <<EOF
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "SDL$sdl_major",
|
||||
"version": "$sdl_version",
|
||||
"dependencies": []
|
||||
}
|
||||
EOF
|
||||
|
||||
modulesworkdir="${prefabworkdir}/modules"
|
||||
mkdir -p "${modulesworkdir}"
|
||||
|
||||
create_shared_sdl_module() {
|
||||
echo "Creating SDL${sdl_major} prefab module"
|
||||
for android_abi in $android_abis; do
|
||||
sdl_moduleworkdir="${modulesworkdir}/SDL${sdl_major}"
|
||||
mkdir -p "${sdl_moduleworkdir}"
|
||||
|
||||
abi_build_prefix="${build_root}/build_${android_abi}/prefix"
|
||||
|
||||
cat >"${sdl_moduleworkdir}/module.json" <<EOF
|
||||
{
|
||||
"export_libraries": [],
|
||||
"library_name": "libSDL${sdl_major}"
|
||||
}
|
||||
EOF
|
||||
mkdir -p "${sdl_moduleworkdir}/include"
|
||||
cp -r "${abi_build_prefix}/include/SDL${sdl_major}/"* "${sdl_moduleworkdir}/include/"
|
||||
rm "${sdl_moduleworkdir}/include/SDL_config.h"
|
||||
cp "$sdl_root/include/SDL_config.h" "$sdl_root/include/SDL_config_android.h" "${sdl_moduleworkdir}/include/"
|
||||
|
||||
abi_sdllibdir="${sdl_moduleworkdir}/libs/android.${android_abi}"
|
||||
mkdir -p "${abi_sdllibdir}"
|
||||
cat >"${abi_sdllibdir}/abi.json" <<EOF
|
||||
{
|
||||
"abi": "${android_abi}",
|
||||
"api": ${android_api},
|
||||
"ndk": ${android_ndk},
|
||||
"stl": "${android_stl}",
|
||||
"static": false
|
||||
}
|
||||
EOF
|
||||
cp "${abi_build_prefix}/lib/libSDL${sdl_major}.so" "${abi_sdllibdir}"
|
||||
done
|
||||
}
|
||||
|
||||
create_static_sdl_module() {
|
||||
echo "Creating SDL${sdl_major}-static prefab module"
|
||||
for android_abi in $android_abis; do
|
||||
sdl_moduleworkdir="${modulesworkdir}/SDL${sdl_major}-static"
|
||||
mkdir -p "${sdl_moduleworkdir}"
|
||||
|
||||
abi_build_prefix="${build_root}/build_${android_abi}/prefix"
|
||||
|
||||
cat >"${sdl_moduleworkdir}/module.json" <<EOF
|
||||
{
|
||||
"export_libraries": ["-ldl", "-lGLESv1_CM", "-lGLESv2", "-llog", "-landroid", "-lOpenSLES"]
|
||||
"library_name": "libSDL${sdl_major}"
|
||||
}
|
||||
EOF
|
||||
mkdir -p "${sdl_moduleworkdir}/include"
|
||||
cp -r "${abi_build_prefix}/include/SDL${sdl_major}/"* "${sdl_moduleworkdir}/include"
|
||||
rm "${sdl_moduleworkdir}/include/SDL_config.h"
|
||||
cp "$sdl_root/include/SDL_config.h" "$sdl_root/include/SDL_config_android.h" "${sdl_moduleworkdir}/include/"
|
||||
|
||||
abi_sdllibdir="${sdl_moduleworkdir}/libs/android.${android_abi}"
|
||||
mkdir -p "${abi_sdllibdir}"
|
||||
cat >"${abi_sdllibdir}/abi.json" <<EOF
|
||||
{
|
||||
"abi": "${android_abi}",
|
||||
"api": ${android_api},
|
||||
"ndk": ${android_ndk},
|
||||
"stl": "${android_stl}",
|
||||
"static": true
|
||||
}
|
||||
EOF
|
||||
cp "${abi_build_prefix}/lib/libSDL${sdl_major}.a" "${abi_sdllibdir}"
|
||||
done
|
||||
}
|
||||
|
||||
create_sdlmain_module() {
|
||||
echo "Creating SDL${sdl_major}main prefab module"
|
||||
for android_abi in $android_abis; do
|
||||
sdl_moduleworkdir="${modulesworkdir}/SDL${sdl_major}main"
|
||||
mkdir -p "${sdl_moduleworkdir}"
|
||||
|
||||
abi_build_prefix="${build_root}/build_${android_abi}/prefix"
|
||||
|
||||
cat >"${sdl_moduleworkdir}/module.json" <<EOF
|
||||
{
|
||||
"export_libraries": [],
|
||||
"library_name": "libSDL${sdl_major}main"
|
||||
}
|
||||
EOF
|
||||
abi_sdllibdir="${sdl_moduleworkdir}/libs/android.${android_abi}"
|
||||
mkdir -p "${abi_sdllibdir}"
|
||||
cat >"${abi_sdllibdir}/abi.json" <<EOF
|
||||
{
|
||||
"abi": "${android_abi}",
|
||||
"api": ${android_api},
|
||||
"ndk": ${android_ndk},
|
||||
"stl": "${android_stl}",
|
||||
"static": true
|
||||
}
|
||||
EOF
|
||||
cp "${abi_build_prefix}/lib/libSDL${sdl_major}main.a" "${abi_sdllibdir}"
|
||||
done
|
||||
}
|
||||
|
||||
create_sdltest_module() {
|
||||
echo "Creating SDL${sdl_major}test prefab module"
|
||||
for android_abi in $android_abis; do
|
||||
sdl_moduleworkdir="${modulesworkdir}/SDL${sdl_major}test"
|
||||
mkdir -p "${sdl_moduleworkdir}"
|
||||
|
||||
abi_build_prefix="${build_root}/build_${android_abi}/prefix"
|
||||
|
||||
cat >"${sdl_moduleworkdir}/module.json" <<EOF
|
||||
{
|
||||
"export_libraries": [],
|
||||
"library_name": "libSDL${sdl_major}_test"
|
||||
}
|
||||
EOF
|
||||
abi_sdllibdir="${sdl_moduleworkdir}/libs/android.${android_abi}"
|
||||
mkdir -p "${abi_sdllibdir}"
|
||||
cat >"${abi_sdllibdir}/abi.json" <<EOF
|
||||
{
|
||||
"abi": "${android_abi}",
|
||||
"api": ${android_api},
|
||||
"ndk": ${android_ndk},
|
||||
"stl": "${android_stl}",
|
||||
"static": true
|
||||
}
|
||||
EOF
|
||||
cp "${abi_build_prefix}/lib/libSDL${sdl_major}_test.a" "${abi_sdllibdir}"
|
||||
done
|
||||
}
|
||||
|
||||
build_cmake_projects
|
||||
|
||||
compile_java
|
||||
|
||||
create_pom_xml
|
||||
|
||||
create_aar_androidmanifest
|
||||
|
||||
create_shared_sdl_module
|
||||
|
||||
create_static_sdl_module
|
||||
|
||||
create_sdlmain_module
|
||||
|
||||
create_sdltest_module
|
||||
|
||||
pushd "${aar_root}"
|
||||
aar_filename="SDL${sdl_major}-${sdl_version}.aar"
|
||||
cp "${classes_jar_path}" ./classes.jar
|
||||
cp "${classes_sources_jar_path}" ./classes-sources.jar
|
||||
zip -r "${aar_filename}" AndroidManifest.xml classes.jar classes-sources.jar prefab META-INF
|
||||
zip -Tv "${aar_filename}" 2>/dev/null ;
|
||||
mv "${aar_filename}" "${prefabhome}"
|
||||
popd
|
||||
|
||||
maven_filename="SDL${sdl_major}-${sdl_version}.zip"
|
||||
|
||||
pushd "${prefabhome}"
|
||||
zip_filename="SDL${sdl_major}-${sdl_version}.zip"
|
||||
zip "${maven_filename}" "${aar_filename}" "${pom_filename}" 2>/dev/null;
|
||||
zip -Tv "${zip_filename}" 2>/dev/null;
|
||||
popd
|
||||
|
||||
echo "Prefab zip is ready at ${prefabhome}/${aar_filename}"
|
||||
echo "Maven archive is ready at ${prefabhome}/${zip_filename}"
|
100
vendored/sdl/build-scripts/androidbuild.sh
Normal file
100
vendored/sdl/build-scripts/androidbuild.sh
Normal file
@ -0,0 +1,100 @@
|
||||
#!/bin/bash
|
||||
|
||||
SOURCES=()
|
||||
MKSOURCES=""
|
||||
CURDIR=`pwd -P`
|
||||
|
||||
# Fetch sources
|
||||
if [[ $# -ge 2 ]]; then
|
||||
for src in ${@:2}
|
||||
do
|
||||
SOURCES+=($src)
|
||||
MKSOURCES="$MKSOURCES $(basename $src)"
|
||||
done
|
||||
else
|
||||
if [ -n "$1" ]; then
|
||||
while read src
|
||||
do
|
||||
SOURCES+=($src)
|
||||
MKSOURCES="$MKSOURCES $(basename $src)"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
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 ... "
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SDLPATH="$( cd "$(dirname "$0")/.." ; pwd -P )"
|
||||
|
||||
if [ -z "$ANDROID_HOME" ];then
|
||||
echo "Please set the ANDROID_HOME directory to the path of the Android SDK"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
APP="$1"
|
||||
APPARR=(${APP//./ })
|
||||
BUILDPATH="$SDLPATH/build/$APP"
|
||||
|
||||
# Start Building
|
||||
|
||||
rm -rf $BUILDPATH
|
||||
mkdir -p $BUILDPATH
|
||||
|
||||
cp -r $SDLPATH/android-project/* $BUILDPATH
|
||||
|
||||
# Copy SDL sources
|
||||
mkdir -p $BUILDPATH/app/jni/SDL
|
||||
if [ -z "$COPYSOURCE" ]; then
|
||||
ln -s $SDLPATH/src $BUILDPATH/app/jni/SDL
|
||||
ln -s $SDLPATH/include $BUILDPATH/app/jni/SDL
|
||||
else
|
||||
cp -r $SDLPATH/src $BUILDPATH/app/jni/SDL
|
||||
cp -r $SDLPATH/include $BUILDPATH/app/jni/SDL
|
||||
fi
|
||||
|
||||
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/app/jni/src
|
||||
done
|
||||
|
||||
# Create an inherited Activity
|
||||
cd $BUILDPATH/app/src/main/java
|
||||
for folder in "${APPARR[@]}"
|
||||
do
|
||||
mkdir -p $folder
|
||||
cd $folder
|
||||
done
|
||||
|
||||
ACTIVITY="${folder}Activity"
|
||||
sed -i -e "s|\"SDLActivity\"|\"$ACTIVITY\"|g" $BUILDPATH/app/src/main/AndroidManifest.xml
|
||||
|
||||
# Fill in a default Activity
|
||||
cat >"$ACTIVITY.java" <<__EOF__
|
||||
package $APP;
|
||||
|
||||
import org.libsdl.app.SDLActivity;
|
||||
|
||||
public class $ACTIVITY extends SDLActivity
|
||||
{
|
||||
}
|
||||
__EOF__
|
||||
|
||||
# Update project and build
|
||||
echo "To build and install to a device for testing, run the following:"
|
||||
echo "cd $BUILDPATH"
|
||||
echo "./gradlew installDebug"
|
73
vendored/sdl/build-scripts/androidbuildlibs.sh
Normal file
73
vendored/sdl/build-scripts/androidbuildlibs.sh
Normal file
@ -0,0 +1,73 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Build the Android libraries without needing a project
|
||||
# (AndroidManifest.xml, jni/{Application,Android}.mk, etc.)
|
||||
#
|
||||
# Usage: androidbuildlibs.sh [arg for ndk-build ...]"
|
||||
#
|
||||
# Useful NDK arguments:
|
||||
#
|
||||
# NDK_DEBUG=1 - build debug version
|
||||
# NDK_LIBS_OUT=<dest> - specify alternate destination for installable
|
||||
# modules.
|
||||
#
|
||||
# Note that SDLmain is not an installable module (.so) so libSDLmain.a
|
||||
# can be found in $obj/local/<abi> along with the unstripped libSDL.so.
|
||||
#
|
||||
|
||||
|
||||
# Android.mk is in srcdir
|
||||
srcdir=`dirname $0`/..
|
||||
srcdir=`cd $srcdir && pwd`
|
||||
cd $srcdir
|
||||
|
||||
|
||||
#
|
||||
# Create the build directories
|
||||
#
|
||||
|
||||
build=build
|
||||
buildandroid=$build/android
|
||||
obj=
|
||||
lib=
|
||||
ndk_args=
|
||||
|
||||
# Allow an external caller to specify locations.
|
||||
for arg in $*; do
|
||||
if [ "${arg:0:8}" == "NDK_OUT=" ]; then
|
||||
obj=${arg#NDK_OUT=}
|
||||
elif [ "${arg:0:13}" == "NDK_LIBS_OUT=" ]; then
|
||||
lib=${arg#NDK_LIBS_OUT=}
|
||||
else
|
||||
ndk_args="$ndk_args $arg"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z $obj ]; then
|
||||
obj=$buildandroid/obj
|
||||
fi
|
||||
if [ -z $lib ]; then
|
||||
lib=$buildandroid/lib
|
||||
fi
|
||||
|
||||
for dir in $build $buildandroid $obj $lib; do
|
||||
if test -d $dir; then
|
||||
:
|
||||
else
|
||||
mkdir $dir || exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# APP_* variables set in the environment here will not be seen by the
|
||||
# ndk-build makefile segments that use them, e.g., default-application.mk.
|
||||
# For consistency, pass all values on the command line.
|
||||
ndk-build \
|
||||
NDK_PROJECT_PATH=null \
|
||||
NDK_OUT=$obj \
|
||||
NDK_LIBS_OUT=$lib \
|
||||
APP_BUILD_SCRIPT=Android.mk \
|
||||
APP_ABI="armeabi-v7a arm64-v8a x86 x86_64" \
|
||||
APP_PLATFORM=android-16 \
|
||||
APP_MODULES="SDL2 SDL2_main" \
|
||||
$ndk_args
|
62
vendored/sdl/build-scripts/checker-buildbot.sh
Normal file
62
vendored/sdl/build-scripts/checker-buildbot.sh
Normal file
@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This is a script used by some Buildbot buildslaves to push the project
|
||||
# through Clang's static analyzer and prepare the output to be uploaded
|
||||
# back to the buildmaster. You might find it useful too.
|
||||
|
||||
# Install Clang (you already have it on Mac OS X, apt-get install clang
|
||||
# on Ubuntu, etc), and make sure scan-build is in your $PATH.
|
||||
|
||||
FINALDIR="$1"
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
cd `dirname "$0"`
|
||||
cd ..
|
||||
|
||||
rm -rf checker-buildbot analysis
|
||||
if [ ! -z "$FINALDIR" ]; then
|
||||
rm -rf "$FINALDIR"
|
||||
fi
|
||||
|
||||
mkdir checker-buildbot
|
||||
cd checker-buildbot
|
||||
|
||||
# We turn off deprecated declarations, because we don't care about these warnings during static analysis.
|
||||
# The -Wno-liblto is new since our checker-279 upgrade, I think; checker otherwise warns "libLTO.dylib relative to clang installed dir not found"
|
||||
|
||||
# You might want to do this for CMake-backed builds instead...
|
||||
scan-build -o analysis cmake -G Ninja -Wno-dev -DSDL_STATIC=OFF -DCMAKE_BUILD_TYPE=Debug -DSDL_ASSERTIONS=enabled -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_SHARED_LINKER_FLAGS="-Wno-liblto" ..
|
||||
|
||||
# ...or run configure without the scan-build wrapper...
|
||||
#CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0 -Wno-deprecated-declarations" LDFLAGS="-Wno-liblto" ../configure --enable-assertions=enabled
|
||||
|
||||
rm -rf analysis
|
||||
scan-build -o analysis ninja
|
||||
|
||||
if [ `ls -A analysis |wc -l` == 0 ] ; then
|
||||
mkdir analysis/zarro
|
||||
echo '<html><head><title>Zarro boogs</title></head><body>Static analysis: no issues to report.</body></html>' >analysis/zarro/index.html
|
||||
fi
|
||||
|
||||
mv analysis/* ../analysis
|
||||
rmdir analysis # Make sure this is empty.
|
||||
cd ..
|
||||
chmod -R a+r analysis
|
||||
chmod -R go-w analysis
|
||||
find analysis -type d -exec chmod a+x {} \;
|
||||
if [ -x /usr/bin/xattr ]; then find analysis -exec /usr/bin/xattr -d com.apple.quarantine {} \; 2>/dev/null ; fi
|
||||
|
||||
if [ ! -z "$FINALDIR" ]; then
|
||||
mv analysis "$FINALDIR"
|
||||
else
|
||||
FINALDIR=analysis
|
||||
fi
|
||||
|
||||
rm -rf checker-buildbot
|
||||
|
||||
echo "Done. Final output is in '$FINALDIR' ..."
|
||||
|
||||
# end of checker-buildbot.sh ...
|
||||
|
102
vendored/sdl/build-scripts/clang++-fat.sh
Normal file
102
vendored/sdl/build-scripts/clang++-fat.sh
Normal file
@ -0,0 +1,102 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Build Universal binaries on Mac OS X, thanks Ryan!
|
||||
#
|
||||
# Usage: ./configure CXX="sh clang++-fat.sh" && make && rm -rf arm64 x64
|
||||
|
||||
DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
|
||||
|
||||
# Intel 64-bit compiler flags (10.7 runtime compatibility)
|
||||
CLANG_COMPILE_X64="clang++ -arch x86_64 -mmacosx-version-min=10.7 \
|
||||
-I/usr/local/include"
|
||||
|
||||
CLANG_LINK_X64="-mmacosx-version-min=10.7"
|
||||
|
||||
# ARM 64-bit compiler flags (11.0 runtime compatibility)
|
||||
CLANG_COMPILE_ARM64="clang++ -arch arm64 -mmacosx-version-min=11.0 \
|
||||
-I/usr/local/include"
|
||||
|
||||
CLANG_LINK_ARM64="-mmacosx-version-min=11.0"
|
||||
|
||||
|
||||
# Output both Intel and ARM object files
|
||||
args="$*"
|
||||
compile=yes
|
||||
link=yes
|
||||
while test x$1 != x; do
|
||||
case $1 in
|
||||
--version) exec clang++ $1;;
|
||||
-v) exec clang++ $1;;
|
||||
-V) exec clang++ $1;;
|
||||
-print-prog-name=*) exec clang++ $1;;
|
||||
-print-search-dirs) exec clang++ $1;;
|
||||
-E) CLANG_COMPILE_ARM64="$CLANG_COMPILE_ARM64 -E"
|
||||
CLANG_COMPILE_X64="$CLANG_COMPILE_X64 -E"
|
||||
compile=no; link=no;;
|
||||
-c) link=no;;
|
||||
-o) output=$2;;
|
||||
*.c|*.cc|*.cpp|*.S|*.m|*.mm) source=$1;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
if test x$link = xyes; then
|
||||
CLANG_COMPILE_ARM64="$CLANG_COMPILE_ARM64 $CLANG_LINK_ARM64"
|
||||
CLANG_COMPILE_X64="$CLANG_COMPILE_X64 $CLANG_LINK_X64"
|
||||
fi
|
||||
if test x"$output" = x; then
|
||||
if test x$link = xyes; then
|
||||
output=a.out
|
||||
elif test x$compile = xyes; then
|
||||
output=`echo $source | sed -e 's|.*/||' -e 's|\(.*\)\.[^\.]*|\1|'`.o
|
||||
fi
|
||||
fi
|
||||
|
||||
# Compile ARM 64-bit
|
||||
if test x"$output" != x; then
|
||||
dir=arm64/`dirname $output`
|
||||
if test -d $dir; then
|
||||
:
|
||||
else
|
||||
mkdir -p $dir
|
||||
fi
|
||||
fi
|
||||
set -- $args
|
||||
while test x$1 != x; do
|
||||
if test -f "arm64/$1" && test "$1" != "$output"; then
|
||||
arm64_args="$arm64_args arm64/$1"
|
||||
else
|
||||
arm64_args="$arm64_args $1"
|
||||
fi
|
||||
shift
|
||||
done
|
||||
$CLANG_COMPILE_ARM64 $arm64_args || exit $?
|
||||
if test x"$output" != x; then
|
||||
cp $output arm64/$output
|
||||
fi
|
||||
|
||||
# Compile Intel 64-bit
|
||||
if test x"$output" != x; then
|
||||
dir=x64/`dirname $output`
|
||||
if test -d $dir; then
|
||||
:
|
||||
else
|
||||
mkdir -p $dir
|
||||
fi
|
||||
fi
|
||||
set -- $args
|
||||
while test x$1 != x; do
|
||||
if test -f "x64/$1" && test "$1" != "$output"; then
|
||||
x64_args="$x64_args x64/$1"
|
||||
else
|
||||
x64_args="$x64_args $1"
|
||||
fi
|
||||
shift
|
||||
done
|
||||
$CLANG_COMPILE_X64 $x64_args || exit $?
|
||||
if test x"$output" != x; then
|
||||
cp $output x64/$output
|
||||
fi
|
||||
|
||||
if test x"$output" != x; then
|
||||
lipo -create -o $output arm64/$output x64/$output
|
||||
fi
|
105
vendored/sdl/build-scripts/clang-fat.sh
Normal file
105
vendored/sdl/build-scripts/clang-fat.sh
Normal file
@ -0,0 +1,105 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Build Universal binaries on Mac OS X, thanks Ryan!
|
||||
#
|
||||
# Usage: ./configure CC="sh clang-fat.sh" && make && rm -rf arm64 x64
|
||||
|
||||
DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
|
||||
|
||||
# Intel 64-bit compiler flags (10.9 runtime compatibility)
|
||||
CLANG_COMPILE_X64="clang -arch x86_64 -mmacosx-version-min=10.9 \
|
||||
-DMAC_OS_X_VERSION_MIN_REQUIRED=1070 \
|
||||
-I/usr/local/include"
|
||||
|
||||
CLANG_LINK_X64="-mmacosx-version-min=10.9"
|
||||
|
||||
# ARM 64-bit compiler flags (11.0 runtime compatibility)
|
||||
CLANG_COMPILE_ARM64="clang -arch arm64 -mmacosx-version-min=11.0 \
|
||||
-I/usr/local/include"
|
||||
|
||||
CLANG_LINK_ARM64="-mmacosx-version-min=11.0"
|
||||
|
||||
|
||||
# Output both Intel and ARM object files
|
||||
args="$*"
|
||||
compile=yes
|
||||
link=yes
|
||||
while test x$1 != x; do
|
||||
case $1 in
|
||||
--version) exec clang $1;;
|
||||
-v) exec clang $1;;
|
||||
-V) exec clang $1;;
|
||||
-print-prog-name=*) exec clang $1;;
|
||||
-print-search-dirs) exec clang $1;;
|
||||
-E) CLANG_COMPILE_X64="$CLANG_COMPILE_X64 -E"
|
||||
CLANG_COMPILE_ARM64="$CLANG_COMPILE_ARM64 -E"
|
||||
compile=no; link=no;;
|
||||
-c) link=no;;
|
||||
-o) output=$2;;
|
||||
*.c|*.cc|*.cpp|*.S|*.m|*.mm) source=$1;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
if test x$link = xyes; then
|
||||
CLANG_COMPILE_X64="$CLANG_COMPILE_X64 $CLANG_LINK_X64"
|
||||
CLANG_COMPILE_ARM64="$CLANG_COMPILE_ARM64 $CLANG_LINK_ARM64"
|
||||
fi
|
||||
if test x"$output" = x; then
|
||||
if test x$link = xyes; then
|
||||
output=a.out
|
||||
elif test x$compile = xyes; then
|
||||
output=`echo $source | sed -e 's|.*/||' -e 's|\(.*\)\.[^\.]*|\1|'`.o
|
||||
fi
|
||||
fi
|
||||
|
||||
# Compile Intel 64-bit
|
||||
if test x"$output" != x; then
|
||||
dir=x64/`dirname $output`
|
||||
if test -d $dir; then
|
||||
:
|
||||
else
|
||||
mkdir -p $dir
|
||||
fi
|
||||
fi
|
||||
set -- $args
|
||||
while test x$1 != x; do
|
||||
if test -f "x64/$1" && test "$1" != "$output"; then
|
||||
x64_args="$x64_args x64/$1"
|
||||
else
|
||||
x64_args="$x64_args $1"
|
||||
fi
|
||||
shift
|
||||
done
|
||||
$CLANG_COMPILE_X64 $x64_args || exit $?
|
||||
if test x"$output" != x; then
|
||||
cp $output x64/$output
|
||||
fi
|
||||
|
||||
# Compile ARM 64-bit
|
||||
if test x"$output" != x; then
|
||||
dir=arm64/`dirname $output`
|
||||
if test -d $dir; then
|
||||
:
|
||||
else
|
||||
mkdir -p $dir
|
||||
fi
|
||||
fi
|
||||
set -- $args
|
||||
while test x$1 != x; do
|
||||
if test -f "arm64/$1" && test "$1" != "$output"; then
|
||||
arm64_args="$arm64_args arm64/$1"
|
||||
else
|
||||
arm64_args="$arm64_args $1"
|
||||
fi
|
||||
shift
|
||||
done
|
||||
$CLANG_COMPILE_ARM64 $arm64_args || exit $?
|
||||
if test x"$output" != x; then
|
||||
cp $output arm64/$output
|
||||
fi
|
||||
|
||||
|
||||
if test x"$output" != x; then
|
||||
lipo -create -o $output arm64/$output x64/$output
|
||||
fi
|
||||
|
32
vendored/sdl/build-scripts/clang-format-src.sh
Normal file
32
vendored/sdl/build-scripts/clang-format-src.sh
Normal file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd "$(dirname $0)/../src"
|
||||
|
||||
echo "Running clang-format in $(pwd)"
|
||||
|
||||
find . -regex '.*\.[chm]p*' -exec clang-format -i {} \;
|
||||
|
||||
# Revert third-party code
|
||||
git checkout \
|
||||
events/imKStoUCS.* \
|
||||
hidapi \
|
||||
joystick/controller_type.c \
|
||||
joystick/controller_type.h \
|
||||
joystick/hidapi/steam/controller_constants.h \
|
||||
joystick/hidapi/steam/controller_structs.h \
|
||||
libm \
|
||||
stdlib/SDL_malloc.c \
|
||||
stdlib/SDL_qsort.c \
|
||||
stdlib/SDL_strtokr.c \
|
||||
video/arm \
|
||||
video/khronos \
|
||||
video/x11/edid-parse.c \
|
||||
video/yuv2rgb
|
||||
clang-format -i hidapi/SDL_hidapi.c
|
||||
|
||||
# Revert generated code
|
||||
git checkout dynapi/SDL_dynapi_overrides.h
|
||||
git checkout dynapi/SDL_dynapi_procs.h
|
||||
git checkout render/metal/SDL_shaders_metal_*.h
|
||||
|
||||
echo "clang-format complete!"
|
59
vendored/sdl/build-scripts/codechecker-buildbot.sh
Normal file
59
vendored/sdl/build-scripts/codechecker-buildbot.sh
Normal file
@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This is a script used by some Buildbot build workers to push the project
|
||||
# through Clang's static analyzer and prepare the output to be uploaded
|
||||
# back to the buildmaster. You might find it useful too.
|
||||
|
||||
# Install Clang (you already have it on macOS, apt-get install clang
|
||||
# on Ubuntu, etc), install CMake, and pip3 install codechecker.
|
||||
|
||||
FINALDIR="$1"
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
cd `dirname "$0"`
|
||||
cd ..
|
||||
|
||||
rm -rf codechecker-buildbot
|
||||
if [ ! -z "$FINALDIR" ]; then
|
||||
rm -rf "$FINALDIR"
|
||||
fi
|
||||
|
||||
mkdir codechecker-buildbot
|
||||
cd codechecker-buildbot
|
||||
|
||||
# We turn off deprecated declarations, because we don't care about these warnings during static analysis.
|
||||
cmake -Wno-dev -DSDL_STATIC=OFF -DCMAKE_BUILD_TYPE=Debug -DSDL_ASSERTIONS=enabled -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ..
|
||||
|
||||
# CMake on macOS adds "-arch arm64" or whatever is appropriate, but this confuses CodeChecker, so strip it out.
|
||||
perl -w -pi -e 's/\-arch\s+.*?\s+//g;' compile_commands.json
|
||||
|
||||
rm -rf ../analysis
|
||||
CodeChecker analyze compile_commands.json -o ./reports
|
||||
|
||||
# "parse" returns 2 if there was a static analysis issue to report, but this
|
||||
# does not signify an error in the parsing (that would be error code 1). Turn
|
||||
# off the abort-on-error flag.
|
||||
set +e
|
||||
CodeChecker parse ./reports -e html -o ../analysis
|
||||
set -e
|
||||
|
||||
cd ..
|
||||
chmod -R a+r analysis
|
||||
chmod -R go-w analysis
|
||||
find analysis -type d -exec chmod a+x {} \;
|
||||
if [ -x /usr/bin/xattr ]; then find analysis -exec /usr/bin/xattr -d com.apple.quarantine {} \; 2>/dev/null ; fi
|
||||
|
||||
if [ ! -z "$FINALDIR" ]; then
|
||||
mv analysis "$FINALDIR"
|
||||
else
|
||||
FINALDIR=analysis
|
||||
fi
|
||||
|
||||
rm -rf codechecker-buildbot
|
||||
|
||||
echo "Done. Final output is in '$FINALDIR' ..."
|
||||
|
||||
# end of codechecker-buildbot.sh ...
|
||||
|
1812
vendored/sdl/build-scripts/config.guess
vendored
Normal file
1812
vendored/sdl/build-scripts/config.guess
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1971
vendored/sdl/build-scripts/config.sub
vendored
Normal file
1971
vendored/sdl/build-scripts/config.sub
vendored
Normal file
File diff suppressed because it is too large
Load Diff
76
vendored/sdl/build-scripts/emscripten-buildbot.sh
Normal file
76
vendored/sdl/build-scripts/emscripten-buildbot.sh
Normal file
@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$SDKDIR" ]; then
|
||||
SDKDIR="/emsdk"
|
||||
fi
|
||||
|
||||
ENVSCRIPT="$SDKDIR/emsdk_env.sh"
|
||||
if [ ! -f "$ENVSCRIPT" ]; then
|
||||
echo "ERROR: This script expects the Emscripten SDK to be in '$SDKDIR'." 1>&2
|
||||
echo "ERROR: Set the \$SDKDIR environment variable to override this." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TARBALL="$1"
|
||||
if [ -z $1 ]; then
|
||||
TARBALL=sdl-emscripten.tar.xz
|
||||
fi
|
||||
|
||||
cd `dirname "$0"`
|
||||
cd ..
|
||||
SDLBASE=`pwd`
|
||||
|
||||
if [ -z "$MAKE" ]; then
|
||||
OSTYPE=`uname -s`
|
||||
if [ "$OSTYPE" == "Linux" ]; then
|
||||
NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
|
||||
let NCPU=$NCPU+1
|
||||
elif [ "$OSTYPE" = "Darwin" ]; then
|
||||
NCPU=`sysctl -n hw.ncpu`
|
||||
elif [ "$OSTYPE" = "SunOS" ]; then
|
||||
NCPU=`/usr/sbin/psrinfo |wc -l |sed -e 's/^ *//g;s/ *$//g'`
|
||||
else
|
||||
NCPU=1
|
||||
fi
|
||||
|
||||
if [ -z "$NCPU" ]; then
|
||||
NCPU=1
|
||||
elif [ "$NCPU" = "0" ]; then
|
||||
NCPU=1
|
||||
fi
|
||||
|
||||
MAKE="make -j$NCPU"
|
||||
fi
|
||||
|
||||
echo "\$MAKE is '$MAKE'"
|
||||
|
||||
echo "Setting up Emscripten SDK environment..."
|
||||
source "$ENVSCRIPT"
|
||||
|
||||
echo "Setting up..."
|
||||
set -x
|
||||
cd "$SDLBASE"
|
||||
rm -rf buildbot
|
||||
mkdir buildbot
|
||||
pushd buildbot
|
||||
|
||||
echo "Configuring..."
|
||||
emconfigure ../configure --host=wasm32-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-s USE_SDL=0 -O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed" || exit $?
|
||||
|
||||
echo "Building..."
|
||||
emmake $MAKE || exit $?
|
||||
|
||||
echo "Moving things around..."
|
||||
emmake $MAKE install || exit $?
|
||||
|
||||
# Fix up a few things to a real install path
|
||||
perl -w -pi -e "s#$PWD/emscripten-sdl2-installed#/usr/local#g;" ./emscripten-sdl2-installed/lib/libSDL2.la ./emscripten-sdl2-installed/lib/pkgconfig/sdl2.pc ./emscripten-sdl2-installed/bin/sdl2-config
|
||||
mkdir -p ./usr
|
||||
mv ./emscripten-sdl2-installed ./usr/local
|
||||
tar -cJvvf $TARBALL usr
|
||||
popd
|
||||
|
||||
exit 0
|
||||
|
||||
# end of emscripten-buildbot.sh ...
|
||||
|
188
vendored/sdl/build-scripts/fnsince.pl
Normal file
188
vendored/sdl/build-scripts/fnsince.pl
Normal file
@ -0,0 +1,188 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
use File::Basename;
|
||||
use Cwd qw(abs_path);
|
||||
|
||||
my $wikipath = undef;
|
||||
foreach (@ARGV) {
|
||||
$wikipath = abs_path($_), next if not defined $wikipath;
|
||||
}
|
||||
|
||||
chdir(dirname(__FILE__));
|
||||
chdir('..');
|
||||
|
||||
my @unsorted_releases = ();
|
||||
open(PIPEFH, '-|', 'git tag -l') or die "Failed to read git release tags: $!\n";
|
||||
|
||||
while (<PIPEFH>) {
|
||||
chomp;
|
||||
if (/\Arelease\-(.*?)\Z/) {
|
||||
# After 2.24.x, ignore anything that isn't a x.y.0 release.
|
||||
# We moved to bugfix-only point releases there, so make sure new APIs
|
||||
# are assigned to the next minor version and ignore the patch versions.
|
||||
my $ver = $1;
|
||||
my @versplit = split /\./, $ver;
|
||||
next if (scalar(@versplit) > 2) && (($versplit[0] > 2) || (($versplit[0] == 2) && ($versplit[1] >= 24))) && ($versplit[2] != 0);
|
||||
|
||||
# Consider this release version.
|
||||
push @unsorted_releases, $ver;
|
||||
}
|
||||
|
||||
}
|
||||
close(PIPEFH);
|
||||
|
||||
#print("\n\nUNSORTED\n");
|
||||
#foreach (@unsorted_releases) {
|
||||
# print "$_\n";
|
||||
#}
|
||||
|
||||
my @releases = sort {
|
||||
my @asplit = split /\./, $a;
|
||||
my @bsplit = split /\./, $b;
|
||||
my $rc;
|
||||
for (my $i = 0; $i < scalar(@asplit); $i++) {
|
||||
return 1 if (scalar(@bsplit) <= $i); # a is "2.0.1" and b is "2.0", or whatever.
|
||||
my $aseg = $asplit[$i];
|
||||
my $bseg = $bsplit[$i];
|
||||
$rc = int($aseg) <=> int($bseg);
|
||||
return $rc if ($rc != 0); # found the difference.
|
||||
}
|
||||
return 0; # still here? They matched completely?!
|
||||
} @unsorted_releases;
|
||||
|
||||
# this happens to work for how SDL versions things at the moment.
|
||||
my $current_release = $releases[-1];
|
||||
my $next_release;
|
||||
|
||||
if ($current_release eq '2.0.22') { # Hack for our jump from 2.0.22 to 2.24.0...
|
||||
$next_release = '2.24.0';
|
||||
} else {
|
||||
my @current_release_segments = split /\./, $current_release;
|
||||
@current_release_segments[1] = '' . ($current_release_segments[1] + 2);
|
||||
$next_release = join('.', @current_release_segments);
|
||||
}
|
||||
|
||||
#print("\n\nSORTED\n");
|
||||
#foreach (@releases) {
|
||||
# print "$_\n";
|
||||
#}
|
||||
#print("\nCURRENT RELEASE: $current_release\n");
|
||||
#print("NEXT RELEASE: $next_release\n\n");
|
||||
|
||||
push @releases, 'HEAD';
|
||||
|
||||
my %funcs = ();
|
||||
foreach my $release (@releases) {
|
||||
#print("Checking $release...\n");
|
||||
next if ($release eq '2.0.0') || ($release eq '2.0.1'); # no dynapi before 2.0.2
|
||||
my $assigned_release = ($release eq '2.0.2') ? '2.0.0' : $release; # assume everything in 2.0.2--first with dynapi--was there since 2.0.0. We'll fix it up later.
|
||||
my $tag = ($release eq 'HEAD') ? $release : "release-$release";
|
||||
my $blobname = "$tag:src/dynapi/SDL_dynapi_overrides.h";
|
||||
open(PIPEFH, '-|', "git show '$blobname'") or die "Failed to read git blob '$blobname': $!\n";
|
||||
while (<PIPEFH>) {
|
||||
chomp;
|
||||
if (/\A\#define\s+(SDL_.*?)\s+SDL_.*?_REAL\Z/) {
|
||||
my $fn = $1;
|
||||
$funcs{$fn} = $assigned_release if not defined $funcs{$fn};
|
||||
}
|
||||
}
|
||||
close(PIPEFH);
|
||||
}
|
||||
|
||||
# Fixup the handful of functions that were added in 2.0.1 and 2.0.2 that we
|
||||
# didn't have dynapi revision data about...
|
||||
$funcs{'SDL_GetSystemRAM'} = '2.0.1';
|
||||
$funcs{'SDL_GetBasePath'} = '2.0.1';
|
||||
$funcs{'SDL_GetPrefPath'} = '2.0.1';
|
||||
$funcs{'SDL_UpdateYUVTexture'} = '2.0.1';
|
||||
$funcs{'SDL_GL_GetDrawableSize'} = '2.0.1';
|
||||
$funcs{'SDL_Direct3D9GetAdapterIndex'} = '2.0.1';
|
||||
$funcs{'SDL_RenderGetD3D9Device'} = '2.0.1';
|
||||
|
||||
$funcs{'SDL_RegisterApp'} = '2.0.2';
|
||||
$funcs{'SDL_UnregisterApp'} = '2.0.2';
|
||||
$funcs{'SDL_GetAssertionHandler'} = '2.0.2';
|
||||
$funcs{'SDL_GetDefaultAssertionHandler'} = '2.0.2';
|
||||
$funcs{'SDL_AtomicAdd'} = '2.0.2';
|
||||
$funcs{'SDL_AtomicGet'} = '2.0.2';
|
||||
$funcs{'SDL_AtomicGetPtr'} = '2.0.2';
|
||||
$funcs{'SDL_AtomicSet'} = '2.0.2';
|
||||
$funcs{'SDL_AtomicSetPtr'} = '2.0.2';
|
||||
$funcs{'SDL_HasAVX'} = '2.0.2';
|
||||
$funcs{'SDL_GameControllerAddMappingsFromRW'} = '2.0.2';
|
||||
$funcs{'SDL_acos'} = '2.0.2';
|
||||
$funcs{'SDL_asin'} = '2.0.2';
|
||||
$funcs{'SDL_vsscanf'} = '2.0.2';
|
||||
$funcs{'SDL_DetachThread'} = '2.0.2';
|
||||
$funcs{'SDL_GL_ResetAttributes'} = '2.0.2';
|
||||
$funcs{'SDL_DXGIGetOutputInfo'} = '2.0.2';
|
||||
|
||||
# these are incorrect in the dynapi header, because we forgot to add them
|
||||
# until a later release, but are available in the older release.
|
||||
$funcs{'SDL_WinRTGetFSPathUNICODE'} = '2.0.3';
|
||||
$funcs{'SDL_WinRTGetFSPathUTF8'} = '2.0.3';
|
||||
$funcs{'SDL_WinRTRunApp'} = '2.0.3';
|
||||
|
||||
if (not defined $wikipath) {
|
||||
foreach my $release (@releases) {
|
||||
foreach my $fn (sort keys %funcs) {
|
||||
print("$fn: $funcs{$fn}\n") if $funcs{$fn} eq $release;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (defined $wikipath) {
|
||||
chdir($wikipath);
|
||||
foreach my $fn (keys %funcs) {
|
||||
my $revision = $funcs{$fn};
|
||||
$revision = $next_release if $revision eq 'HEAD';
|
||||
my $fname = "$fn.mediawiki";
|
||||
if ( ! -f $fname ) {
|
||||
#print STDERR "No such file: $fname\n";
|
||||
next;
|
||||
}
|
||||
|
||||
my @lines = ();
|
||||
open(FH, '<', $fname) or die("Can't open $fname for read: $!\n");
|
||||
my $added = 0;
|
||||
while (<FH>) {
|
||||
chomp;
|
||||
if ((/\A\-\-\-\-/) && (!$added)) {
|
||||
push @lines, "== Version ==";
|
||||
push @lines, "";
|
||||
push @lines, "This function is available since SDL $revision.";
|
||||
push @lines, "";
|
||||
$added = 1;
|
||||
}
|
||||
push @lines, $_;
|
||||
next if not /\A\=\=\s+Version\s+\=\=/;
|
||||
$added = 1;
|
||||
push @lines, "";
|
||||
push @lines, "This function is available since SDL $revision.";
|
||||
push @lines, "";
|
||||
while (<FH>) {
|
||||
chomp;
|
||||
next if not (/\A\=\=\s+/ || /\A\-\-\-\-/);
|
||||
push @lines, $_;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close(FH);
|
||||
|
||||
if (!$added) {
|
||||
push @lines, "== Version ==";
|
||||
push @lines, "";
|
||||
push @lines, "This function is available since SDL $revision.";
|
||||
push @lines, "";
|
||||
}
|
||||
|
||||
open(FH, '>', $fname) or die("Can't open $fname for write: $!\n");
|
||||
foreach (@lines) {
|
||||
print FH "$_\n";
|
||||
}
|
||||
close(FH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
450
vendored/sdl/build-scripts/gen_audio_channel_conversion.c
Normal file
450
vendored/sdl/build-scripts/gen_audio_channel_conversion.c
Normal file
@ -0,0 +1,450 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2024 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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
|
||||
Built with:
|
||||
|
||||
gcc -o genchancvt build-scripts/gen_audio_channel_conversion.c -lm && ./genchancvt > src/audio/SDL_audio_channel_converters.h
|
||||
|
||||
*/
|
||||
|
||||
#define NUM_CHANNELS 8
|
||||
|
||||
static const char *layout_names[NUM_CHANNELS] = {
|
||||
"Mono", "Stereo", "2.1", "Quad", "4.1", "5.1", "6.1", "7.1"
|
||||
};
|
||||
|
||||
static const char *channel_names[NUM_CHANNELS][NUM_CHANNELS] = {
|
||||
/* mono */ { "FC" },
|
||||
/* stereo */ { "FL", "FR" },
|
||||
/* 2.1 */ { "FL", "FR", "LFE" },
|
||||
/* quad */ { "FL", "FR", "BL", "BR" },
|
||||
/* 4.1 */ { "FL", "FR", "LFE", "BL", "BR" },
|
||||
/* 5.1 */ { "FL", "FR", "FC", "LFE", "BL", "BR" },
|
||||
/* 6.1 */ { "FL", "FR", "FC", "LFE", "BC", "SL", "SR" },
|
||||
/* 7.1 */ { "FL", "FR", "FC", "LFE", "BL", "BR", "SL", "SR" },
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* This table is from FAudio:
|
||||
*
|
||||
* https://raw.githubusercontent.com/FNA-XNA/FAudio/master/src/matrix_defaults.inl
|
||||
*/
|
||||
static const float channel_conversion_matrix[8][8][64] = {
|
||||
{
|
||||
/* 1 x 1 */
|
||||
{ 1.000000000f },
|
||||
/* 1 x 2 */
|
||||
{ 1.000000000f, 1.000000000f },
|
||||
/* 1 x 3 */
|
||||
{ 1.000000000f, 1.000000000f, 0.000000000f },
|
||||
/* 1 x 4 */
|
||||
{ 1.000000000f, 1.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 1 x 5 */
|
||||
{ 1.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 1 x 6 */
|
||||
{ 1.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 1 x 7 */
|
||||
{ 1.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 1 x 8 */
|
||||
{ 1.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }
|
||||
},
|
||||
{
|
||||
/* 2 x 1 */
|
||||
{ 0.500000000f, 0.500000000f },
|
||||
/* 2 x 2 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 2 x 3 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 2 x 4 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 2 x 5 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 2 x 6 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 2 x 7 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 2 x 8 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }
|
||||
},
|
||||
{
|
||||
/* 3 x 1 */
|
||||
{ 0.333333343f, 0.333333343f, 0.333333343f },
|
||||
/* 3 x 2 */
|
||||
{ 0.800000012f, 0.000000000f, 0.200000003f, 0.000000000f, 0.800000012f, 0.200000003f },
|
||||
/* 3 x 3 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 3 x 4 */
|
||||
{ 0.888888896f, 0.000000000f, 0.111111112f, 0.000000000f, 0.888888896f, 0.111111112f, 0.000000000f, 0.000000000f, 0.111111112f, 0.000000000f, 0.000000000f, 0.111111112f },
|
||||
/* 3 x 5 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 3 x 6 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 3 x 7 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 3 x 8 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }
|
||||
},
|
||||
{
|
||||
/* 4 x 1 */
|
||||
{ 0.250000000f, 0.250000000f, 0.250000000f, 0.250000000f },
|
||||
/* 4 x 2 */
|
||||
{ 0.421000004f, 0.000000000f, 0.358999997f, 0.219999999f, 0.000000000f, 0.421000004f, 0.219999999f, 0.358999997f },
|
||||
/* 4 x 3 */
|
||||
{ 0.421000004f, 0.000000000f, 0.358999997f, 0.219999999f, 0.000000000f, 0.421000004f, 0.219999999f, 0.358999997f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 4 x 4 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 4 x 5 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 4 x 6 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 4 x 7 */
|
||||
{ 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.500000000f, 0.500000000f, 0.000000000f, 0.000000000f, 0.796000004f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.796000004f },
|
||||
/* 4 x 8 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }
|
||||
},
|
||||
{
|
||||
/* 5 x 1 */
|
||||
{ 0.200000003f, 0.200000003f, 0.200000003f, 0.200000003f, 0.200000003f },
|
||||
/* 5 x 2 */
|
||||
{ 0.374222219f, 0.000000000f, 0.111111112f, 0.319111109f, 0.195555553f, 0.000000000f, 0.374222219f, 0.111111112f, 0.195555553f, 0.319111109f },
|
||||
/* 5 x 3 */
|
||||
{ 0.421000004f, 0.000000000f, 0.000000000f, 0.358999997f, 0.219999999f, 0.000000000f, 0.421000004f, 0.000000000f, 0.219999999f, 0.358999997f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 5 x 4 */
|
||||
{ 0.941176474f, 0.000000000f, 0.058823530f, 0.000000000f, 0.000000000f, 0.000000000f, 0.941176474f, 0.058823530f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.058823530f, 0.941176474f, 0.000000000f, 0.000000000f, 0.000000000f, 0.058823530f, 0.000000000f, 0.941176474f },
|
||||
/* 5 x 5 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 5 x 6 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 5 x 7 */
|
||||
{ 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.500000000f, 0.500000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.796000004f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.796000004f },
|
||||
/* 5 x 8 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }
|
||||
},
|
||||
{
|
||||
/* 6 x 1 */
|
||||
{ 0.166666672f, 0.166666672f, 0.166666672f, 0.166666672f, 0.166666672f, 0.166666672f },
|
||||
/* 6 x 2 */
|
||||
{ 0.294545442f, 0.000000000f, 0.208181813f, 0.090909094f, 0.251818180f, 0.154545456f, 0.000000000f, 0.294545442f, 0.208181813f, 0.090909094f, 0.154545456f, 0.251818180f },
|
||||
/* 6 x 3 */
|
||||
{ 0.324000001f, 0.000000000f, 0.229000002f, 0.000000000f, 0.277000010f, 0.170000002f, 0.000000000f, 0.324000001f, 0.229000002f, 0.000000000f, 0.170000002f, 0.277000010f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 6 x 4 */
|
||||
{ 0.558095276f, 0.000000000f, 0.394285709f, 0.047619049f, 0.000000000f, 0.000000000f, 0.000000000f, 0.558095276f, 0.394285709f, 0.047619049f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.047619049f, 0.558095276f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.047619049f, 0.000000000f, 0.558095276f },
|
||||
/* 6 x 5 */
|
||||
{ 0.586000025f, 0.000000000f, 0.414000005f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.586000025f, 0.414000005f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.586000025f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.586000025f },
|
||||
/* 6 x 6 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 6 x 7 */
|
||||
{ 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.500000000f, 0.500000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.796000004f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.796000004f },
|
||||
/* 6 x 8 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }
|
||||
},
|
||||
{
|
||||
/* 7 x 1 */
|
||||
{ 0.143142849f, 0.143142849f, 0.143142849f, 0.142857149f, 0.143142849f, 0.143142849f, 0.143142849f },
|
||||
/* 7 x 2 */
|
||||
{ 0.247384623f, 0.000000000f, 0.174461529f, 0.076923080f, 0.174461529f, 0.226153851f, 0.100615382f, 0.000000000f, 0.247384623f, 0.174461529f, 0.076923080f, 0.174461529f, 0.100615382f, 0.226153851f },
|
||||
/* 7 x 3 */
|
||||
{ 0.268000007f, 0.000000000f, 0.188999996f, 0.000000000f, 0.188999996f, 0.245000005f, 0.108999997f, 0.000000000f, 0.268000007f, 0.188999996f, 0.000000000f, 0.188999996f, 0.108999997f, 0.245000005f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 7 x 4 */
|
||||
{ 0.463679999f, 0.000000000f, 0.327360004f, 0.040000003f, 0.000000000f, 0.168960005f, 0.000000000f, 0.000000000f, 0.463679999f, 0.327360004f, 0.040000003f, 0.000000000f, 0.000000000f, 0.168960005f, 0.000000000f, 0.000000000f, 0.000000000f, 0.040000003f, 0.327360004f, 0.431039989f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.040000003f, 0.327360004f, 0.000000000f, 0.431039989f },
|
||||
/* 7 x 5 */
|
||||
{ 0.483000010f, 0.000000000f, 0.340999991f, 0.000000000f, 0.000000000f, 0.175999999f, 0.000000000f, 0.000000000f, 0.483000010f, 0.340999991f, 0.000000000f, 0.000000000f, 0.000000000f, 0.175999999f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.340999991f, 0.449000001f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.340999991f, 0.000000000f, 0.449000001f },
|
||||
/* 7 x 6 */
|
||||
{ 0.611000001f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.223000005f, 0.000000000f, 0.000000000f, 0.611000001f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.223000005f, 0.000000000f, 0.000000000f, 0.611000001f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.432000011f, 0.568000019f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.432000011f, 0.000000000f, 0.568000019f },
|
||||
/* 7 x 7 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 7 x 8 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.707000017f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.707000017f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f }
|
||||
},
|
||||
{
|
||||
/* 8 x 1 */
|
||||
{ 0.125125006f, 0.125125006f, 0.125125006f, 0.125000000f, 0.125125006f, 0.125125006f, 0.125125006f, 0.125125006f },
|
||||
/* 8 x 2 */
|
||||
{ 0.211866662f, 0.000000000f, 0.150266662f, 0.066666670f, 0.181066677f, 0.111066669f, 0.194133341f, 0.085866667f, 0.000000000f, 0.211866662f, 0.150266662f, 0.066666670f, 0.111066669f, 0.181066677f, 0.085866667f, 0.194133341f },
|
||||
/* 8 x 3 */
|
||||
{ 0.226999998f, 0.000000000f, 0.160999998f, 0.000000000f, 0.194000006f, 0.119000003f, 0.208000004f, 0.092000000f, 0.000000000f, 0.226999998f, 0.160999998f, 0.000000000f, 0.119000003f, 0.194000006f, 0.092000000f, 0.208000004f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 8 x 4 */
|
||||
{ 0.466344833f, 0.000000000f, 0.329241365f, 0.034482758f, 0.000000000f, 0.000000000f, 0.169931039f, 0.000000000f, 0.000000000f, 0.466344833f, 0.329241365f, 0.034482758f, 0.000000000f, 0.000000000f, 0.000000000f, 0.169931039f, 0.000000000f, 0.000000000f, 0.000000000f, 0.034482758f, 0.466344833f, 0.000000000f, 0.433517247f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.034482758f, 0.000000000f, 0.466344833f, 0.000000000f, 0.433517247f },
|
||||
/* 8 x 5 */
|
||||
{ 0.483000010f, 0.000000000f, 0.340999991f, 0.000000000f, 0.000000000f, 0.000000000f, 0.175999999f, 0.000000000f, 0.000000000f, 0.483000010f, 0.340999991f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.175999999f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.483000010f, 0.000000000f, 0.449000001f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.483000010f, 0.000000000f, 0.449000001f },
|
||||
/* 8 x 6 */
|
||||
{ 0.518000007f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.188999996f, 0.000000000f, 0.000000000f, 0.518000007f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.188999996f, 0.000000000f, 0.000000000f, 0.518000007f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.518000007f, 0.000000000f, 0.481999993f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.518000007f, 0.000000000f, 0.481999993f },
|
||||
/* 8 x 7 */
|
||||
{ 0.541000009f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.541000009f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.541000009f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.287999988f, 0.287999988f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.458999991f, 0.000000000f, 0.541000009f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.458999991f, 0.000000000f, 0.541000009f },
|
||||
/* 8 x 8 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f }
|
||||
}
|
||||
};
|
||||
|
||||
static char *remove_dots(const char *str) /* this is NOT robust. */
|
||||
{
|
||||
static char retval1[32];
|
||||
static char retval2[32];
|
||||
static int idx = 0;
|
||||
char *retval = (idx++ & 1) ? retval1 : retval2;
|
||||
char *ptr = retval;
|
||||
while (*str) {
|
||||
if (*str != '.') {
|
||||
*(ptr++) = *str;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
*ptr = '\0';
|
||||
return retval;
|
||||
}
|
||||
|
||||
static char *lowercase(const char *str) /* this is NOT robust. */
|
||||
{
|
||||
static char retval1[32];
|
||||
static char retval2[32];
|
||||
static int idx = 0;
|
||||
char *retval = (idx++ & 1) ? retval1 : retval2;
|
||||
char *ptr = retval;
|
||||
while (*str) {
|
||||
const char ch = *(str++);
|
||||
*(ptr++) = ((ch >= 'A') && (ch <= 'Z')) ? (ch - ('A' - 'a')) : ch;
|
||||
}
|
||||
*ptr = '\0';
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void write_converter(const int fromchans, const int tochans)
|
||||
{
|
||||
const char *fromstr = layout_names[fromchans-1];
|
||||
const char *tostr = layout_names[tochans-1];
|
||||
const float *cvtmatrix = channel_conversion_matrix[fromchans-1][tochans-1];
|
||||
const float *fptr;
|
||||
const int convert_backwards = (tochans > fromchans);
|
||||
int input_channel_used[NUM_CHANNELS];
|
||||
int i, j;
|
||||
|
||||
if (tochans == fromchans) {
|
||||
return; /* nothing to convert, don't generate a converter. */
|
||||
}
|
||||
|
||||
for (i = 0; i < fromchans; i++) {
|
||||
input_channel_used[i] = 0;
|
||||
}
|
||||
|
||||
fptr = cvtmatrix;
|
||||
for (j = 0; j < tochans; j++) {
|
||||
for (i = 0; i < fromchans; i++) {
|
||||
#if 0
|
||||
printf("to=%d, from=%d, coeff=%f\n", j, i, *fptr);
|
||||
#endif
|
||||
if (*(fptr++) != 0.0f) {
|
||||
input_channel_used[i]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("static void SDLCALL\n"
|
||||
"SDL_Convert%sTo%s(SDL_AudioCVT *cvt, SDL_AudioFormat format)\n"
|
||||
"{\n", remove_dots(fromstr), remove_dots(tostr));
|
||||
|
||||
if (convert_backwards) { /* must convert backwards when growing the output in-place. */
|
||||
printf(" float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / %d) * %d))) - %d;\n", fromchans, tochans, tochans);
|
||||
printf(" const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - %d;\n", fromchans);
|
||||
} else {
|
||||
printf(" float *dst = (float *) cvt->buf;\n");
|
||||
printf(" const float *src = dst;\n");
|
||||
}
|
||||
|
||||
printf(" int i;\n"
|
||||
"\n"
|
||||
" LOG_DEBUG_CONVERT(\"%s\", \"%s\");\n"
|
||||
" SDL_assert(format == AUDIO_F32SYS);\n"
|
||||
"\n", lowercase(fromstr), lowercase(tostr));
|
||||
|
||||
if (convert_backwards) {
|
||||
printf(" /* convert backwards, since output is growing in-place. */\n");
|
||||
printf(" for (i = cvt->len_cvt / (sizeof (float) * %d); i; i--, src -= %d, dst -= %d) {\n", fromchans, fromchans, tochans);
|
||||
fptr = cvtmatrix;
|
||||
for (i = 0; i < fromchans; i++) {
|
||||
if (input_channel_used[i] > 1) { /* don't read it from src more than once. */
|
||||
printf(" const float src%s = src[%d];\n", channel_names[fromchans-1][i], i);
|
||||
}
|
||||
}
|
||||
|
||||
for (j = tochans - 1; j >= 0; j--) {
|
||||
int has_input = 0;
|
||||
fptr = cvtmatrix + (fromchans * j);
|
||||
printf(" dst[%d] /* %s */ =", j, channel_names[tochans-1][j]);
|
||||
for (i = fromchans - 1; i >= 0; i--) {
|
||||
const float coefficient = fptr[i];
|
||||
char srcname[32];
|
||||
if (coefficient == 0.0f) {
|
||||
continue;
|
||||
} else if (input_channel_used[i] > 1) {
|
||||
snprintf(srcname, sizeof (srcname), "src%s", channel_names[fromchans-1][i]);
|
||||
} else {
|
||||
snprintf(srcname, sizeof (srcname), "src[%d]", i);
|
||||
}
|
||||
|
||||
if (has_input) {
|
||||
printf(" +");
|
||||
}
|
||||
|
||||
has_input = 1;
|
||||
|
||||
if (coefficient == 1.0f) {
|
||||
printf(" %s", srcname);
|
||||
} else {
|
||||
printf(" (%s * %.9ff)", srcname, coefficient);
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_input) {
|
||||
printf(" 0.0f");
|
||||
}
|
||||
|
||||
printf(";\n");
|
||||
}
|
||||
|
||||
printf(" }\n");
|
||||
} else {
|
||||
printf(" for (i = cvt->len_cvt / (sizeof (float) * %d); i; i--, src += %d, dst += %d) {\n", fromchans, fromchans, tochans);
|
||||
|
||||
fptr = cvtmatrix;
|
||||
for (i = 0; i < fromchans; i++) {
|
||||
if (input_channel_used[i] > 1) { /* don't read it from src more than once. */
|
||||
printf(" const float src%s = src[%d];\n", channel_names[fromchans-1][i], i);
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < tochans; j++) {
|
||||
int has_input = 0;
|
||||
fptr = cvtmatrix + (fromchans * j);
|
||||
printf(" dst[%d] /* %s */ =", j, channel_names[tochans-1][j]);
|
||||
for (i = 0; i < fromchans; i++) {
|
||||
const float coefficient = fptr[i];
|
||||
char srcname[32];
|
||||
if (coefficient == 0.0f) {
|
||||
continue;
|
||||
} else if (input_channel_used[i] > 1) {
|
||||
snprintf(srcname, sizeof (srcname), "src%s", channel_names[fromchans-1][i]);
|
||||
} else {
|
||||
snprintf(srcname, sizeof (srcname), "src[%d]", i);
|
||||
}
|
||||
|
||||
if (has_input) {
|
||||
printf(" +");
|
||||
}
|
||||
|
||||
has_input = 1;
|
||||
|
||||
if (coefficient == 1.0f) {
|
||||
printf(" %s", srcname);
|
||||
} else {
|
||||
printf(" (%s * %.9ff)", srcname, coefficient);
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_input) {
|
||||
printf(" 0.0f");
|
||||
}
|
||||
|
||||
printf(";\n");
|
||||
}
|
||||
printf(" }\n");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
if ((fromchans > 1) && (tochans > 1)) {
|
||||
printf(" cvt->len_cvt = (cvt->len_cvt / %d) * %d;\n", fromchans, tochans);
|
||||
} else if (tochans == 1) {
|
||||
printf(" cvt->len_cvt = cvt->len_cvt / %d;\n", fromchans);
|
||||
} else /* if (fromchans == 1) */ {
|
||||
printf(" cvt->len_cvt = cvt->len_cvt * %d;\n", tochans);
|
||||
}
|
||||
|
||||
printf(" if (cvt->filters[++cvt->filter_index]) {\n"
|
||||
" cvt->filters[cvt->filter_index] (cvt, format);\n"
|
||||
" }\n"
|
||||
"}\n\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int ini, outi;
|
||||
|
||||
printf(
|
||||
"/*\n"
|
||||
" Simple DirectMedia Layer\n"
|
||||
" Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>\n"
|
||||
"\n"
|
||||
" This software is provided 'as-is', without any express or implied\n"
|
||||
" warranty. In no event will the authors be held liable for any damages\n"
|
||||
" arising from the use of this software.\n"
|
||||
"\n"
|
||||
" Permission is granted to anyone to use this software for any purpose,\n"
|
||||
" including commercial applications, and to alter it and redistribute it\n"
|
||||
" freely, subject to the following restrictions:\n"
|
||||
"\n"
|
||||
" 1. The origin of this software must not be misrepresented; you must not\n"
|
||||
" claim that you wrote the original software. If you use this software\n"
|
||||
" in a product, an acknowledgment in the product documentation would be\n"
|
||||
" appreciated but is not required.\n"
|
||||
" 2. Altered source versions must be plainly marked as such, and must not be\n"
|
||||
" misrepresented as being the original software.\n"
|
||||
" 3. This notice may not be removed or altered from any source distribution.\n"
|
||||
"*/\n"
|
||||
"\n"
|
||||
"/* DO NOT EDIT, THIS FILE WAS GENERATED BY build-scripts/gen_audio_channel_conversion.c */\n"
|
||||
"\n"
|
||||
);
|
||||
|
||||
for (ini = 1; ini <= NUM_CHANNELS; ini++) {
|
||||
for (outi = 1; outi <= NUM_CHANNELS; outi++) {
|
||||
write_converter(ini, outi);
|
||||
}
|
||||
}
|
||||
|
||||
printf("static const SDL_AudioFilter channel_converters[%d][%d] = { /* [from][to] */\n", NUM_CHANNELS, NUM_CHANNELS);
|
||||
for (ini = 1; ini <= NUM_CHANNELS; ini++) {
|
||||
const char *comma = "";
|
||||
printf(" {");
|
||||
for (outi = 1; outi <= NUM_CHANNELS; outi++) {
|
||||
const char *fromstr = layout_names[ini-1];
|
||||
const char *tostr = layout_names[outi-1];
|
||||
if (ini == outi) {
|
||||
printf("%s NULL", comma);
|
||||
} else {
|
||||
printf("%s SDL_Convert%sTo%s", comma, remove_dots(fromstr), remove_dots(tostr));
|
||||
}
|
||||
comma = ",";
|
||||
}
|
||||
printf(" }%s\n", (ini == NUM_CHANNELS) ? "" : ",");
|
||||
}
|
||||
|
||||
printf("};\n\n");
|
||||
printf("/* vi: set ts=4 sw=4 expandtab: */\n\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
163
vendored/sdl/build-scripts/gen_audio_resampler_filter.c
Normal file
163
vendored/sdl/build-scripts/gen_audio_resampler_filter.c
Normal file
@ -0,0 +1,163 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2024 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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Built with:
|
||||
|
||||
gcc -o genfilter build-scripts/gen_audio_resampler_filter.c -lm && ./genfilter > src/audio/SDL_audio_resampler_filter.h
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
SDL's resampler uses a "bandlimited interpolation" algorithm:
|
||||
https://ccrma.stanford.edu/~jos/resample/
|
||||
|
||||
This code pre-generates the kaiser tables so we don't have to do this at
|
||||
run time, at a cost of about 20 kilobytes of static data in SDL. This code
|
||||
used to be part of SDL itself and generated the tables on the first use,
|
||||
but that was expensive to produce on platforms without floating point
|
||||
hardware.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#define RESAMPLER_ZERO_CROSSINGS 5
|
||||
#define RESAMPLER_BITS_PER_SAMPLE 16
|
||||
#define RESAMPLER_SAMPLES_PER_ZERO_CROSSING (1 << ((RESAMPLER_BITS_PER_SAMPLE / 2) + 1))
|
||||
#define RESAMPLER_FILTER_SIZE ((RESAMPLER_SAMPLES_PER_ZERO_CROSSING * RESAMPLER_ZERO_CROSSINGS) + 1)
|
||||
|
||||
/* This is a "modified" bessel function, so you can't use POSIX j0() */
|
||||
static double
|
||||
bessel(const double x)
|
||||
{
|
||||
const double xdiv2 = x / 2.0;
|
||||
double i0 = 1.0f;
|
||||
double f = 1.0f;
|
||||
int i = 1;
|
||||
|
||||
while (1) {
|
||||
const double diff = pow(xdiv2, i * 2) / pow(f, 2);
|
||||
if (diff < 1.0e-21f) {
|
||||
break;
|
||||
}
|
||||
i0 += diff;
|
||||
i++;
|
||||
f *= (double) i;
|
||||
}
|
||||
|
||||
return i0;
|
||||
}
|
||||
|
||||
/* build kaiser table with cardinal sine applied to it, and array of differences between elements. */
|
||||
static void
|
||||
kaiser_and_sinc(float *table, float *diffs, const int tablelen, const double beta)
|
||||
{
|
||||
const int lenm1 = tablelen - 1;
|
||||
const int lenm1div2 = lenm1 / 2;
|
||||
const double bessel_beta = bessel(beta);
|
||||
int i;
|
||||
|
||||
table[0] = 1.0f;
|
||||
for (i = 1; i < tablelen; i++) {
|
||||
const double kaiser = bessel(beta * sqrt(1.0 - pow(((i - lenm1) / 2.0) / lenm1div2, 2.0))) / bessel_beta;
|
||||
table[tablelen - i] = (float) kaiser;
|
||||
}
|
||||
|
||||
for (i = 1; i < tablelen; i++) {
|
||||
const float x = (((float) i) / ((float) RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) * ((float) M_PI);
|
||||
table[i] *= sinf(x) / x;
|
||||
diffs[i - 1] = table[i] - table[i - 1];
|
||||
}
|
||||
diffs[lenm1] = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
static float ResamplerFilter[RESAMPLER_FILTER_SIZE];
|
||||
static float ResamplerFilterDifference[RESAMPLER_FILTER_SIZE];
|
||||
|
||||
static void
|
||||
PrepareResampleFilter(void)
|
||||
{
|
||||
/* if dB > 50, beta=(0.1102 * (dB - 8.7)), according to Matlab. */
|
||||
const double dB = 80.0;
|
||||
const double beta = 0.1102 * (dB - 8.7);
|
||||
kaiser_and_sinc(ResamplerFilter, ResamplerFilterDifference, RESAMPLER_FILTER_SIZE, beta);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
PrepareResampleFilter();
|
||||
|
||||
printf(
|
||||
"/*\n"
|
||||
" Simple DirectMedia Layer\n"
|
||||
" Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>\n"
|
||||
"\n"
|
||||
" This software is provided 'as-is', without any express or implied\n"
|
||||
" warranty. In no event will the authors be held liable for any damages\n"
|
||||
" arising from the use of this software.\n"
|
||||
"\n"
|
||||
" Permission is granted to anyone to use this software for any purpose,\n"
|
||||
" including commercial applications, and to alter it and redistribute it\n"
|
||||
" freely, subject to the following restrictions:\n"
|
||||
"\n"
|
||||
" 1. The origin of this software must not be misrepresented; you must not\n"
|
||||
" claim that you wrote the original software. If you use this software\n"
|
||||
" in a product, an acknowledgment in the product documentation would be\n"
|
||||
" appreciated but is not required.\n"
|
||||
" 2. Altered source versions must be plainly marked as such, and must not be\n"
|
||||
" misrepresented as being the original software.\n"
|
||||
" 3. This notice may not be removed or altered from any source distribution.\n"
|
||||
"*/\n"
|
||||
"\n"
|
||||
"/* DO NOT EDIT, THIS FILE WAS GENERATED BY build-scripts/gen_audio_resampler_filter.c */\n"
|
||||
"\n"
|
||||
"#define RESAMPLER_ZERO_CROSSINGS %d\n"
|
||||
"#define RESAMPLER_BITS_PER_SAMPLE %d\n"
|
||||
"#define RESAMPLER_SAMPLES_PER_ZERO_CROSSING (1 << ((RESAMPLER_BITS_PER_SAMPLE / 2) + 1))\n"
|
||||
"#define RESAMPLER_FILTER_SIZE ((RESAMPLER_SAMPLES_PER_ZERO_CROSSING * RESAMPLER_ZERO_CROSSINGS) + 1)\n"
|
||||
"\n", RESAMPLER_ZERO_CROSSINGS, RESAMPLER_BITS_PER_SAMPLE
|
||||
);
|
||||
|
||||
printf("static const float ResamplerFilter[RESAMPLER_FILTER_SIZE] = {\n");
|
||||
printf(" %.9ff", ResamplerFilter[0]);
|
||||
for (i = 0; i < RESAMPLER_FILTER_SIZE-1; i++) {
|
||||
printf("%s%.9ff", ((i % 5) == 4) ? ",\n " : ", ", ResamplerFilter[i+1]);
|
||||
}
|
||||
printf("\n};\n\n");
|
||||
|
||||
printf("static const float ResamplerFilterDifference[RESAMPLER_FILTER_SIZE] = {\n");
|
||||
printf(" %.9ff", ResamplerFilterDifference[0]);
|
||||
for (i = 0; i < RESAMPLER_FILTER_SIZE-1; i++) {
|
||||
printf("%s%.9ff", ((i % 5) == 4) ? ",\n " : ", ", ResamplerFilterDifference[i+1]);
|
||||
}
|
||||
printf("\n};\n\n");
|
||||
printf("/* vi: set ts=4 sw=4 expandtab: */\n\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
80
vendored/sdl/build-scripts/git-pre-push-hook.pl
Normal file
80
vendored/sdl/build-scripts/git-pre-push-hook.pl
Normal file
@ -0,0 +1,80 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
# To use this script: symlink it to .git/hooks/pre-push, then "git push"
|
||||
#
|
||||
# This script is called by "git push" after it has checked the remote status,
|
||||
# but before anything has been pushed. If this script exits with a non-zero
|
||||
# status nothing will be pushed.
|
||||
#
|
||||
# This hook is called with the following parameters:
|
||||
#
|
||||
# $1 -- Name of the remote to which the push is being done
|
||||
# $2 -- URL to which the push is being done
|
||||
#
|
||||
# If pushing without using a named remote those arguments will be equal.
|
||||
#
|
||||
# Information about the commits which are being pushed is supplied as lines to
|
||||
# the standard input in the form:
|
||||
#
|
||||
# <local ref> <local sha1> <remote ref> <remote sha1>
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
my $remote = $ARGV[0];
|
||||
my $url = $ARGV[1];
|
||||
|
||||
#print("remote: $remote\n");
|
||||
#print("url: $url\n");
|
||||
|
||||
$url =~ s/\.git$//; # change myorg/myproject.git to myorg/myproject
|
||||
$url =~ s#^git\@github\.com\:#https://github.com/#i;
|
||||
my $commiturl = $url =~ /\Ahttps?:\/\/github.com\// ? "$url/commit/" : '';
|
||||
|
||||
my $z40 = '0000000000000000000000000000000000000000';
|
||||
my $reported = 0;
|
||||
|
||||
while (<STDIN>) {
|
||||
chomp;
|
||||
my ($local_ref, $local_sha, $remote_ref, $remote_sha) = split / /;
|
||||
#print("local_ref: $local_ref\n");
|
||||
#print("local_sha: $local_sha\n");
|
||||
#print("remote_ref: $remote_ref\n");
|
||||
#print("remote_sha: $remote_sha\n");
|
||||
|
||||
my $range = '';
|
||||
if ($remote_sha eq $z40) { # New branch, examine all commits
|
||||
$range = $local_sha;
|
||||
} else { # Update to existing branch, examine new commits
|
||||
$range = "$remote_sha..$local_sha";
|
||||
}
|
||||
|
||||
my $gitcmd = "git log --reverse --oneline --no-abbrev-commit '$range'";
|
||||
open(GITPIPE, '-|', $gitcmd) or die("\n\n$0: Failed to run '$gitcmd': $!\n\nAbort push!\n\n");
|
||||
while (<GITPIPE>) {
|
||||
chomp;
|
||||
if (/\A([a-fA-F0-9]+)\s+(.*?)\Z/) {
|
||||
my $hash = $1;
|
||||
my $msg = $2;
|
||||
|
||||
if (!$reported) {
|
||||
print("\nCommits expected to be pushed:\n");
|
||||
$reported = 1;
|
||||
}
|
||||
|
||||
#print("hash: $hash\n");
|
||||
#print("msg: $msg\n");
|
||||
|
||||
print("$commiturl$hash -- $msg\n");
|
||||
} else {
|
||||
die("$0: Unexpected output from '$gitcmd'!\n\nAbort push!\n\n");
|
||||
}
|
||||
}
|
||||
die("\n\n$0: Failing exit code from running '$gitcmd'!\n\nAbort push!\n\n") if !close(GITPIPE);
|
||||
}
|
||||
|
||||
print("\n") if $reported;
|
||||
|
||||
exit(0); # Let the push go forward.
|
||||
|
||||
# vi: set ts=4 sw=4 expandtab:
|
541
vendored/sdl/build-scripts/install-sh
Normal file
541
vendored/sdl/build-scripts/install-sh
Normal file
@ -0,0 +1,541 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2020-11-14.01; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
# Create dirs (including intermediate dirs) using mode 755.
|
||||
# This is like GNU 'install' as of coreutils 8.32 (2020).
|
||||
mkdir_umask=22
|
||||
|
||||
backupsuffix=
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-p pass -p to $cpprog.
|
||||
-s $stripprog installed files.
|
||||
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
|
||||
By default, rm is invoked with -f; when overridden with RMPROG,
|
||||
it's up to you to specify -f if you want it.
|
||||
|
||||
If -S is not specified, no backups are attempted.
|
||||
|
||||
Email bug reports to bug-automake@gnu.org.
|
||||
Automake home page: https://www.gnu.org/software/automake/
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-p) cpprog="$cpprog -p";;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-S) backupsuffix="$2"
|
||||
shift;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
# Don't chown directories that already exist.
|
||||
if test $dstdir_status = 0; then
|
||||
chowncmd=""
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dstbase=`basename "$src"`
|
||||
case $dst in
|
||||
*/) dst=$dst$dstbase;;
|
||||
*) dst=$dst/$dstbase;;
|
||||
esac
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
case $dstdir in
|
||||
*/) dstdirslash=$dstdir;;
|
||||
*) dstdirslash=$dstdir/;;
|
||||
esac
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
# The $RANDOM variable is not portable (e.g., dash). Use it
|
||||
# here however when possible just to lower collision chance.
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
|
||||
trap '
|
||||
ret=$?
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
|
||||
exit $ret
|
||||
' 0
|
||||
|
||||
# Because "mkdir -p" follows existing symlinks and we likely work
|
||||
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
||||
# directory is successfully created first before we actually test
|
||||
# 'mkdir -p'.
|
||||
if (umask $mkdir_umask &&
|
||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
test_tmpdir="$tmpdir/a"
|
||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=${dstdirslash}_inst.$$_
|
||||
rmtmp=${dstdirslash}_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask &&
|
||||
{ test -z "$stripcmd" || {
|
||||
# Create $dsttmp read-write so that cp doesn't create it read-only,
|
||||
# which would cause strip to fail.
|
||||
if test -z "$doit"; then
|
||||
: >"$dsttmp" # No need to fork-exec 'touch'.
|
||||
else
|
||||
$doit touch "$dsttmp"
|
||||
fi
|
||||
}
|
||||
} &&
|
||||
$doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# If $backupsuffix is set, and the file being installed
|
||||
# already exists, attempt a backup. Don't worry if it fails,
|
||||
# e.g., if mv doesn't support -f.
|
||||
if test -n "$backupsuffix" && test -f "$dst"; then
|
||||
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
|
||||
fi
|
||||
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
11195
vendored/sdl/build-scripts/ltmain.sh
Normal file
11195
vendored/sdl/build-scripts/ltmain.sh
Normal file
File diff suppressed because it is too large
Load Diff
162
vendored/sdl/build-scripts/mkinstalldirs
Normal file
162
vendored/sdl/build-scripts/mkinstalldirs
Normal file
@ -0,0 +1,162 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
|
||||
scriptversion=2020-07-26.22; # UTC
|
||||
|
||||
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain.
|
||||
#
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
errstatus=0
|
||||
dirmode=
|
||||
|
||||
usage="\
|
||||
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
|
||||
|
||||
Create each directory DIR (with mode MODE, if specified), including all
|
||||
leading file name components.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>."
|
||||
|
||||
# process command line arguments
|
||||
while test $# -gt 0 ; do
|
||||
case $1 in
|
||||
-h | --help | --h*) # -h for help
|
||||
echo "$usage"
|
||||
exit $?
|
||||
;;
|
||||
-m) # -m PERM arg
|
||||
shift
|
||||
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
|
||||
dirmode=$1
|
||||
shift
|
||||
;;
|
||||
--version)
|
||||
echo "$0 $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
--) # stop option processing
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*) # unknown option
|
||||
echo "$usage" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
*) # first non-opt arg
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
for file
|
||||
do
|
||||
if test -d "$file"; then
|
||||
shift
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
case $# in
|
||||
0) exit 0 ;;
|
||||
esac
|
||||
|
||||
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
|
||||
# mkdir -p a/c at the same time, both will detect that a is missing,
|
||||
# one will create a, then the other will try to create a and die with
|
||||
# a "File exists" error. This is a problem when calling mkinstalldirs
|
||||
# from a parallel make. We use --version in the probe to restrict
|
||||
# ourselves to GNU mkdir, which is thread-safe.
|
||||
case $dirmode in
|
||||
'')
|
||||
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
|
||||
echo "mkdir -p -- $*"
|
||||
exec mkdir -p -- "$@"
|
||||
else
|
||||
# On NextStep and OpenStep, the 'mkdir' command does not
|
||||
# recognize any option. It will interpret all options as
|
||||
# directories to create, and then abort because '.' already
|
||||
# exists.
|
||||
test -d ./-p && rmdir ./-p
|
||||
test -d ./--version && rmdir ./--version
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
|
||||
test ! -d ./--version; then
|
||||
echo "umask 22"
|
||||
umask 22
|
||||
echo "mkdir -m $dirmode -p -- $*"
|
||||
exec mkdir -m "$dirmode" -p -- "$@"
|
||||
else
|
||||
# Clean up after NextStep and OpenStep mkdir.
|
||||
for d in ./-m ./-p ./--version "./$dirmode";
|
||||
do
|
||||
test -d $d && rmdir $d
|
||||
done
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "umask 22"
|
||||
umask 22
|
||||
|
||||
for file
|
||||
do
|
||||
case $file in
|
||||
/*) pathcomp=/ ;;
|
||||
*) pathcomp= ;;
|
||||
esac
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set fnord $file
|
||||
shift
|
||||
IFS=$oIFS
|
||||
|
||||
for d
|
||||
do
|
||||
test "x$d" = x && continue
|
||||
|
||||
pathcomp=$pathcomp$d
|
||||
case $pathcomp in
|
||||
-*) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp"
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp=$pathcomp/
|
||||
done
|
||||
|
||||
if test ! -z "$dirmode"; then
|
||||
echo "chmod $dirmode $file"
|
||||
chmod "$dirmode" "$file" || errstatus=$?
|
||||
fi
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
61
vendored/sdl/build-scripts/nacl-buildbot.sh
Normal file
61
vendored/sdl/build-scripts/nacl-buildbot.sh
Normal file
@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This is the script buildbot.libsdl.org uses to cross-compile SDL2 from
|
||||
# amd64 Linux to NaCl.
|
||||
|
||||
# PLEASE NOTE that we have reports that SDL built with pepper_49 (current
|
||||
# stable release as of November 10th, 2016) is broken. Please retest
|
||||
# when something newer becomes stable and then decide if this was SDL's
|
||||
# bug or NaCl's bug. --ryan.
|
||||
export NACL_SDK_ROOT="/nacl_sdk/pepper_47"
|
||||
|
||||
TARBALL="$1"
|
||||
if [ -z $1 ]; then
|
||||
TARBALL=sdl-nacl.tar.xz
|
||||
fi
|
||||
|
||||
OSTYPE=`uname -s`
|
||||
if [ "$OSTYPE" != "Linux" ]; then
|
||||
# !!! FIXME
|
||||
echo "This only works on x86 or x64-64 Linux at the moment." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "x$MAKE" == "x" ]; then
|
||||
NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
|
||||
let NCPU=$NCPU+1
|
||||
MAKE="make -j$NCPU"
|
||||
fi
|
||||
|
||||
BUILDBOTDIR="nacl-buildbot"
|
||||
PARENTDIR="$PWD"
|
||||
|
||||
set -e
|
||||
set -x
|
||||
rm -f $TARBALL
|
||||
rm -rf $BUILDBOTDIR
|
||||
mkdir -p $BUILDBOTDIR
|
||||
pushd $BUILDBOTDIR
|
||||
|
||||
# !!! FIXME: ccache?
|
||||
export CC="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-clang"
|
||||
export CFLAGS="$CFLAGS -I$NACL_SDK_ROOT/include -I$NACL_SDK_ROOT/include/pnacl"
|
||||
export AR="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar"
|
||||
export LD="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar"
|
||||
export RANLIB="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ranlib"
|
||||
|
||||
../configure --host=pnacl --prefix=$PWD/nacl-sdl2-installed
|
||||
$MAKE
|
||||
$MAKE install
|
||||
# Fix up a few things to a real install path
|
||||
perl -w -pi -e "s#$PWD/nacl-sdl2-installed#/usr/local#g;" ./nacl-sdl2-installed/lib/libSDL2.la ./nacl-sdl2-installed/lib/pkgconfig/sdl2.pc ./nacl-sdl2-installed/bin/sdl2-config
|
||||
mkdir -p ./usr
|
||||
mv ./nacl-sdl2-installed ./usr/local
|
||||
|
||||
popd
|
||||
tar -cJvvf $TARBALL -C $BUILDBOTDIR usr
|
||||
rm -rf $BUILDBOTDIR
|
||||
|
||||
set +x
|
||||
echo "All done. Final installable is in $TARBALL ...";
|
||||
|
105
vendored/sdl/build-scripts/naclbuild.sh
Normal file
105
vendored/sdl/build-scripts/naclbuild.sh
Normal file
@ -0,0 +1,105 @@
|
||||
#!/bin/bash
|
||||
if [ -z "$1" ] && [ -z "$NACL_SDK_ROOT" ]; then
|
||||
echo "Usage: ./naclbuild ~/nacl/pepper_35"
|
||||
echo "This will build SDL for Native Client, and testgles2.c as a demo"
|
||||
echo "You can set env vars CC, AR, LD and RANLIB to override the default PNaCl toolchain used"
|
||||
echo "You can set env var SOURCES to select a different source file than testgles2.c"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
NACL_SDK_ROOT="$1"
|
||||
fi
|
||||
|
||||
CC=""
|
||||
|
||||
if [ -n "$2" ]; then
|
||||
CC="$2"
|
||||
fi
|
||||
|
||||
echo "Using SDK at $NACL_SDK_ROOT"
|
||||
|
||||
export NACL_SDK_ROOT="$NACL_SDK_ROOT"
|
||||
export CFLAGS="$CFLAGS -I$NACL_SDK_ROOT/include -I$NACL_SDK_ROOT/include/pnacl"
|
||||
|
||||
NCPUS="1"
|
||||
case "$OSTYPE" in
|
||||
darwin*)
|
||||
NCPU=`sysctl -n hw.ncpu`
|
||||
;;
|
||||
linux*)
|
||||
if [ -n `which nproc` ]; then
|
||||
NCPUS=`nproc`
|
||||
fi
|
||||
;;
|
||||
*);;
|
||||
esac
|
||||
|
||||
CURDIR=`pwd -P`
|
||||
SDLPATH="$( cd "$(dirname "$0")/.." ; pwd -P )"
|
||||
BUILDPATH="$SDLPATH/build/nacl"
|
||||
TESTBUILDPATH="$BUILDPATH/test"
|
||||
SDL2_STATIC="$BUILDPATH/build/.libs/libSDL2.a"
|
||||
mkdir -p $BUILDPATH
|
||||
mkdir -p $TESTBUILDPATH
|
||||
|
||||
if [ -z "$CC" ]; then
|
||||
export CC="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-clang"
|
||||
fi
|
||||
if [ -z "$AR" ]; then
|
||||
export AR="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar"
|
||||
fi
|
||||
if [ -z "$LD" ]; then
|
||||
export LD="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar"
|
||||
fi
|
||||
if [ -z "$RANLIB" ]; then
|
||||
export RANLIB="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ranlib"
|
||||
fi
|
||||
|
||||
if [ -z "$SOURCES" ]; then
|
||||
export SOURCES="$SDLPATH/test/testgles2.c"
|
||||
fi
|
||||
|
||||
if [ ! -f "$CC" ]; then
|
||||
echo "Could not find compiler at $CC"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
cd $BUILDPATH
|
||||
$SDLPATH/configure --host=pnacl --prefix $TESTBUILDPATH
|
||||
make -j$NCPUS CFLAGS="$CFLAGS -I./include"
|
||||
make install
|
||||
|
||||
if [ ! -f "$SDL2_STATIC" ]; then
|
||||
echo "Build failed! $SDL2_STATIC"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Building test"
|
||||
cp -f $SDLPATH/test/nacl/* $TESTBUILDPATH
|
||||
# Some tests need these resource files
|
||||
cp -f $SDLPATH/test/*.bmp $TESTBUILDPATH
|
||||
cp -f $SDLPATH/test/*.wav $TESTBUILDPATH
|
||||
cp -f $SDL2_STATIC $TESTBUILDPATH
|
||||
|
||||
# Copy user sources
|
||||
_SOURCES=($SOURCES)
|
||||
for src in "${_SOURCES[@]}"
|
||||
do
|
||||
cp $src $TESTBUILDPATH
|
||||
done
|
||||
export SOURCES="$SOURCES"
|
||||
|
||||
cd $TESTBUILDPATH
|
||||
make -j$NCPUS CONFIG="Release" CFLAGS="$CFLAGS -I$TESTBUILDPATH/include/SDL2 -I$SDLPATH/include"
|
||||
make -j$NCPUS CONFIG="Debug" CFLAGS="$CFLAGS -I$TESTBUILDPATH/include/SDL2 -I$SDLPATH/include"
|
||||
|
||||
echo
|
||||
echo "Run the test with: "
|
||||
echo "cd $TESTBUILDPATH;python -m SimpleHTTPServer"
|
||||
echo "Then visit http://localhost:8000 with Chrome"
|
||||
|
||||
cd $CURDIR
|
58
vendored/sdl/build-scripts/raspberrypi-buildbot.sh
Normal file
58
vendored/sdl/build-scripts/raspberrypi-buildbot.sh
Normal file
@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This is the script buildbot.libsdl.org uses to cross-compile SDL2 from
|
||||
# x86 Linux to Raspberry Pi.
|
||||
|
||||
# The final tarball can be unpacked in the root directory of a RPi,
|
||||
# so the SDL2 install lands in /usr/local. Run ldconfig, and then
|
||||
# you should be able to build and run SDL2-based software on your
|
||||
# Pi. Standard configure scripts should be able to find SDL and
|
||||
# build against it, and sdl2-config should work correctly on the
|
||||
# actual device.
|
||||
|
||||
TARBALL="$1"
|
||||
if [ -z $1 ]; then
|
||||
TARBALL=sdl-raspberrypi.tar.xz
|
||||
fi
|
||||
|
||||
OSTYPE=`uname -s`
|
||||
if [ "$OSTYPE" != "Linux" ]; then
|
||||
# !!! FIXME
|
||||
echo "This only works on x86 or x64-64 Linux at the moment." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "x$MAKE" == "x" ]; then
|
||||
NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
|
||||
let NCPU=$NCPU+1
|
||||
MAKE="make -j$NCPU"
|
||||
fi
|
||||
|
||||
BUILDBOTDIR="buildbot"
|
||||
PARENTDIR="$PWD"
|
||||
|
||||
set -e
|
||||
set -x
|
||||
rm -f $TARBALL
|
||||
rm -rf $BUILDBOTDIR
|
||||
mkdir -p $BUILDBOTDIR
|
||||
pushd $BUILDBOTDIR
|
||||
|
||||
SYSROOT="/opt/rpi-sysroot"
|
||||
export CC="ccache /opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux -L$SYSROOT/opt/vc/lib"
|
||||
# -L$SYSROOT/usr/lib/arm-linux-gnueabihf"
|
||||
# !!! FIXME: shouldn't have to --disable-* things here.
|
||||
../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl2-installed --disable-pulseaudio --disable-esd --disable-video-wayland
|
||||
$MAKE
|
||||
$MAKE install
|
||||
# Fix up a few things to a real install path on a real Raspberry Pi...
|
||||
perl -w -pi -e "s#$PWD/rpi-sdl2-installed#/usr/local#g;" ./rpi-sdl2-installed/lib/libSDL2.la ./rpi-sdl2-installed/lib/pkgconfig/sdl2.pc ./rpi-sdl2-installed/bin/sdl2-config
|
||||
mkdir -p ./usr
|
||||
mv ./rpi-sdl2-installed ./usr/local
|
||||
tar -cJvvf $TARBALL usr
|
||||
popd
|
||||
|
||||
set +x
|
||||
echo "All done. Final installable is in $TARBALL ...";
|
||||
|
||||
|
48
vendored/sdl/build-scripts/showrev.sh
Normal file
48
vendored/sdl/build-scripts/showrev.sh
Normal file
@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Print the current source revision, if available
|
||||
|
||||
SDL_ROOT=$(dirname $0)/..
|
||||
cd $SDL_ROOT
|
||||
|
||||
if [ -e ./VERSION.txt ]; then
|
||||
cat ./VERSION.txt
|
||||
exit 0
|
||||
fi
|
||||
|
||||
major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' include/SDL_version.h)
|
||||
minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' include/SDL_version.h)
|
||||
micro=$(sed -ne 's/^#define SDL_PATCHLEVEL *//p' include/SDL_version.h)
|
||||
version="${major}.${minor}.${micro}"
|
||||
|
||||
if [ -x "$(command -v git)" ]; then
|
||||
rev="$(git describe --tags --long 2>/dev/null)"
|
||||
if [ -n "$rev" ]; then
|
||||
# e.g. release-2.24.0-542-g96361fc47
|
||||
# or release-2.24.1-5-g36b987dab
|
||||
# or prerelease-2.23.2-0-gcb46e1b3f
|
||||
echo "$rev"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
rev="$(git describe --always --tags --long 2>/dev/null)"
|
||||
if [ -n "$rev" ]; then
|
||||
# Just a truncated sha1, e.g. 96361fc47.
|
||||
# Turn it into e.g. 2.25.0-g96361fc47
|
||||
echo "${version}-g${rev}"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -x "$(command -v p4)" ]; then
|
||||
rev="$(p4 changes -m1 ./...\#have 2>/dev/null| awk '{print $2}')"
|
||||
if [ $? = 0 ]; then
|
||||
# e.g. 2.25.0-p7511446
|
||||
echo "${version}-p${rev}"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# best we can do
|
||||
echo "${version}-no-vcs"
|
||||
exit 0
|
21
vendored/sdl/build-scripts/strip_fPIC.sh
Normal file
21
vendored/sdl/build-scripts/strip_fPIC.sh
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# libtool assumes that the compiler can handle the -fPIC flag
|
||||
# This isn't always true (for example, nasm can't handle it)
|
||||
command=""
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-?PIC)
|
||||
# Ignore -fPIC and -DPIC options
|
||||
;;
|
||||
-fno-common)
|
||||
# Ignore -fPIC and -DPIC options
|
||||
;;
|
||||
*)
|
||||
command="$command $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
echo $command
|
||||
exec $command
|
213
vendored/sdl/build-scripts/test-versioning.sh
Normal file
213
vendored/sdl/build-scripts/test-versioning.sh
Normal file
@ -0,0 +1,213 @@
|
||||
#!/bin/sh
|
||||
# Copyright 2022 Collabora Ltd.
|
||||
# SPDX-License-Identifier: Zlib
|
||||
|
||||
set -eu
|
||||
|
||||
cd `dirname $0`/..
|
||||
|
||||
ref_major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' include/SDL_version.h)
|
||||
ref_minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' include/SDL_version.h)
|
||||
ref_micro=$(sed -ne 's/^#define SDL_PATCHLEVEL *//p' include/SDL_version.h)
|
||||
ref_version="${ref_major}.${ref_minor}.${ref_micro}"
|
||||
|
||||
tests=0
|
||||
failed=0
|
||||
|
||||
ok () {
|
||||
tests=$(( tests + 1 ))
|
||||
echo "ok - $*"
|
||||
}
|
||||
|
||||
not_ok () {
|
||||
tests=$(( tests + 1 ))
|
||||
echo "not ok - $*"
|
||||
failed=1
|
||||
}
|
||||
|
||||
major=$(sed -ne 's/^SDL_MAJOR_VERSION=//p' configure.ac)
|
||||
minor=$(sed -ne 's/^SDL_MINOR_VERSION=//p' configure.ac)
|
||||
micro=$(sed -ne 's/^SDL_MICRO_VERSION=//p' configure.ac)
|
||||
version="${major}.${minor}.${micro}"
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "configure.ac $version"
|
||||
else
|
||||
not_ok "configure.ac $version disagrees with SDL_version.h $ref_version"
|
||||
fi
|
||||
|
||||
major=$(sed -ne 's/^SDL_MAJOR_VERSION=//p' configure)
|
||||
minor=$(sed -ne 's/^SDL_MINOR_VERSION=//p' configure)
|
||||
micro=$(sed -ne 's/^SDL_MICRO_VERSION=//p' configure)
|
||||
version="${major}.${minor}.${micro}"
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "configure $version"
|
||||
else
|
||||
not_ok "configure $version disagrees with SDL_version.h $ref_version"
|
||||
fi
|
||||
|
||||
major=$(sed -ne 's/^set(SDL_MAJOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
|
||||
minor=$(sed -ne 's/^set(SDL_MINOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
|
||||
micro=$(sed -ne 's/^set(SDL_MICRO_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
|
||||
version="${major}.${minor}.${micro}"
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "CMakeLists.txt $version"
|
||||
else
|
||||
not_ok "CMakeLists.txt $version disagrees with SDL_version.h $ref_version"
|
||||
fi
|
||||
|
||||
major=$(sed -ne 's/.*SDL_MAJOR_VERSION = \([0-9]*\);/\1/p' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java)
|
||||
minor=$(sed -ne 's/.*SDL_MINOR_VERSION = \([0-9]*\);/\1/p' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java)
|
||||
micro=$(sed -ne 's/.*SDL_MICRO_VERSION = \([0-9]*\);/\1/p' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java)
|
||||
version="${major}.${minor}.${micro}"
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "SDLActivity.java $version"
|
||||
else
|
||||
not_ok "android-project/app/src/main/java/org/libsdl/app/SDLActivity.java $version disagrees with SDL_version.h $ref_version"
|
||||
fi
|
||||
|
||||
major=$(sed -ne 's/^MAJOR_VERSION *= *//p' Makefile.os2)
|
||||
minor=$(sed -ne 's/^MINOR_VERSION *= *//p' Makefile.os2)
|
||||
micro=$(sed -ne 's/^MICRO_VERSION *= *//p' Makefile.os2)
|
||||
version="${major}.${minor}.${micro}"
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "Makefile.os2 $version"
|
||||
else
|
||||
not_ok "Makefile.os2 $version disagrees with SDL_version.h $ref_version"
|
||||
fi
|
||||
|
||||
major=$(sed -ne 's/^MAJOR_VERSION *= *//p' Makefile.w32)
|
||||
minor=$(sed -ne 's/^MINOR_VERSION *= *//p' Makefile.w32)
|
||||
micro=$(sed -ne 's/^MICRO_VERSION *= *//p' Makefile.w32)
|
||||
version="${major}.${minor}.${micro}"
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "Makefile.w32 $version"
|
||||
else
|
||||
not_ok "Makefile.w32 $version disagrees with SDL_version.h $ref_version"
|
||||
fi
|
||||
|
||||
tuple=$(sed -ne 's/^ *FILEVERSION *//p' src/main/windows/version.rc | tr -d '\r')
|
||||
ref_tuple="${ref_major},${ref_minor},${ref_micro},0"
|
||||
|
||||
if [ "$ref_tuple" = "$tuple" ]; then
|
||||
ok "version.rc FILEVERSION $tuple"
|
||||
else
|
||||
not_ok "version.rc FILEVERSION $tuple disagrees with SDL_version.h $ref_tuple"
|
||||
fi
|
||||
|
||||
tuple=$(sed -ne 's/^ *PRODUCTVERSION *//p' src/main/windows/version.rc | tr -d '\r')
|
||||
|
||||
if [ "$ref_tuple" = "$tuple" ]; then
|
||||
ok "version.rc PRODUCTVERSION $tuple"
|
||||
else
|
||||
not_ok "version.rc PRODUCTVERSION $tuple disagrees with SDL_version.h $ref_tuple"
|
||||
fi
|
||||
|
||||
tuple=$(sed -Ene 's/^ *VALUE "FileVersion", "([0-9, ]*)\\0"\r?$/\1/p' src/main/windows/version.rc | tr -d '\r')
|
||||
ref_tuple="${ref_major}, ${ref_minor}, ${ref_micro}, 0"
|
||||
|
||||
if [ "$ref_tuple" = "$tuple" ]; then
|
||||
ok "version.rc FileVersion $tuple"
|
||||
else
|
||||
not_ok "version.rc FileVersion $tuple disagrees with SDL_version.h $ref_tuple"
|
||||
fi
|
||||
|
||||
tuple=$(sed -Ene 's/^ *VALUE "ProductVersion", "([0-9, ]*)\\0"\r?$/\1/p' src/main/windows/version.rc | tr -d '\r')
|
||||
|
||||
if [ "$ref_tuple" = "$tuple" ]; then
|
||||
ok "version.rc ProductVersion $tuple"
|
||||
else
|
||||
not_ok "version.rc ProductVersion $tuple disagrees with SDL_version.h $ref_tuple"
|
||||
fi
|
||||
|
||||
version=$(sed -Ene '/CFBundleShortVersionString/,+1 s/.*<string>(.*)<\/string>.*/\1/p' Xcode/SDL/Info-Framework.plist)
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "Info-Framework.plist CFBundleShortVersionString $version"
|
||||
else
|
||||
not_ok "Info-Framework.plist CFBundleShortVersionString $version disagrees with SDL_version.h $ref_version"
|
||||
fi
|
||||
|
||||
version=$(sed -Ene '/CFBundleVersion/,+1 s/.*<string>(.*)<\/string>.*/\1/p' Xcode/SDL/Info-Framework.plist)
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "Info-Framework.plist CFBundleVersion $version"
|
||||
else
|
||||
not_ok "Info-Framework.plist CFBundleVersion $version disagrees with SDL_version.h $ref_version"
|
||||
fi
|
||||
|
||||
version=$(sed -Ene 's/Title SDL (.*)/\1/p' Xcode/SDL/pkg-support/SDL.info)
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "SDL.info Title $version"
|
||||
else
|
||||
not_ok "SDL.info Title $version disagrees with SDL_version.h $ref_version"
|
||||
fi
|
||||
|
||||
marketing=$(sed -Ene 's/.*MARKETING_VERSION = (.*);/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj)
|
||||
|
||||
ref="$ref_version
|
||||
$ref_version"
|
||||
|
||||
if [ "$ref" = "$marketing" ]; then
|
||||
ok "project.pbxproj MARKETING_VERSION is consistent"
|
||||
else
|
||||
not_ok "project.pbxproj MARKETING_VERSION is inconsistent, expected $ref, got $marketing"
|
||||
fi
|
||||
|
||||
# For simplicity this assumes we'll never break ABI before SDL 3.
|
||||
dylib_compat=$(sed -Ene 's/.*DYLIB_COMPATIBILITY_VERSION = (.*);$/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj)
|
||||
|
||||
case "$ref_minor" in
|
||||
(*[02468])
|
||||
major="$(( ref_minor * 100 + 1 ))"
|
||||
minor="0"
|
||||
;;
|
||||
(*)
|
||||
major="$(( ref_minor * 100 + ref_micro + 1 ))"
|
||||
minor="0"
|
||||
;;
|
||||
esac
|
||||
|
||||
ref="${major}.${minor}.0
|
||||
${major}.${minor}.0
|
||||
${major}.${minor}.0
|
||||
${major}.${minor}.0"
|
||||
|
||||
if [ "$ref" = "$dylib_compat" ]; then
|
||||
ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is consistent"
|
||||
else
|
||||
not_ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is inconsistent, expected $ref, got $dylib_compat"
|
||||
fi
|
||||
|
||||
dylib_cur=$(sed -Ene 's/.*DYLIB_CURRENT_VERSION = (.*);$/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj)
|
||||
|
||||
case "$ref_minor" in
|
||||
(*[02468])
|
||||
major="$(( ref_minor * 100 + 1 ))"
|
||||
minor="$ref_micro"
|
||||
;;
|
||||
(*)
|
||||
major="$(( ref_minor * 100 + ref_micro + 1 ))"
|
||||
minor="0"
|
||||
;;
|
||||
esac
|
||||
|
||||
ref="${major}.${minor}.0
|
||||
${major}.${minor}.0
|
||||
${major}.${minor}.0
|
||||
${major}.${minor}.0"
|
||||
|
||||
if [ "$ref" = "$dylib_cur" ]; then
|
||||
ok "project.pbxproj DYLIB_CURRENT_VERSION is consistent"
|
||||
else
|
||||
not_ok "project.pbxproj DYLIB_CURRENT_VERSION is inconsistent, expected $ref, got $dylib_cur"
|
||||
fi
|
||||
|
||||
echo "1..$tests"
|
||||
exit "$failed"
|
15
vendored/sdl/build-scripts/update-copyright.sh
Normal file
15
vendored/sdl/build-scripts/update-copyright.sh
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$SED" = "" ]; then
|
||||
if type gsed >/dev/null; then
|
||||
SED=gsed
|
||||
else
|
||||
SED=sed
|
||||
fi
|
||||
fi
|
||||
|
||||
find . -type f \
|
||||
| grep -v \.git \
|
||||
| while read file; do \
|
||||
LC_ALL=C $SED -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \
|
||||
done
|
96
vendored/sdl/build-scripts/update-version.sh
Normal file
96
vendored/sdl/build-scripts/update-version.sh
Normal file
@ -0,0 +1,96 @@
|
||||
#!/bin/sh
|
||||
|
||||
#set -x
|
||||
|
||||
cd `dirname $0`/..
|
||||
|
||||
ARGSOKAY=1
|
||||
if [ -z $1 ]; then
|
||||
ARGSOKAY=0
|
||||
fi
|
||||
if [ -z $2 ]; then
|
||||
ARGSOKAY=0
|
||||
fi
|
||||
if [ -z $3 ]; then
|
||||
ARGSOKAY=0
|
||||
fi
|
||||
|
||||
if [ "x$ARGSOKAY" = "x0" ]; then
|
||||
echo "USAGE: $0 <major> <minor> <patch>" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MAJOR="$1"
|
||||
MINOR="$2"
|
||||
PATCH="$3"
|
||||
NEWVERSION="$MAJOR.$MINOR.$PATCH"
|
||||
|
||||
echo "Updating version to '$NEWVERSION' ..."
|
||||
|
||||
# !!! FIXME: This first one is a kinda scary search/replace that might fail later if another X.Y.Z version is added to the file.
|
||||
perl -w -pi -e 's/(\<string\>)\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/Info-Framework.plist
|
||||
|
||||
perl -w -pi -e 's/(Title SDL )\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/pkg-support/SDL.info
|
||||
|
||||
perl -w -pi -e 's/(MARKETING_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
|
||||
|
||||
DYVER=`expr $MINOR \* 100 + 1`
|
||||
perl -w -pi -e 's/(DYLIB_CURRENT_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
|
||||
|
||||
# Set compat to major.minor.0 by default.
|
||||
perl -w -pi -e 's/(DYLIB_COMPATIBILITY_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
|
||||
|
||||
# non-zero patch?
|
||||
if [ "x$PATCH" != "x0" ]; then
|
||||
if [ `expr $MINOR % 2` = "0" ]; then
|
||||
# If patch is not zero, but minor is even, it's a bugfix release.
|
||||
perl -w -pi -e 's/(DYLIB_CURRENT_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.'$PATCH'.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
|
||||
|
||||
else
|
||||
# If patch is not zero, but minor is odd, it's a development prerelease.
|
||||
DYVER=`expr $MINOR \* 100 + $PATCH + 1`
|
||||
perl -w -pi -e 's/(DYLIB_CURRENT_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
|
||||
perl -w -pi -e 's/(DYLIB_COMPATIBILITY_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
|
||||
fi
|
||||
fi
|
||||
|
||||
perl -w -pi -e 's/\A(SDL_MAJOR_VERSION=)\d+/${1}'$MAJOR'/;' configure.ac
|
||||
perl -w -pi -e 's/\A(SDL_MINOR_VERSION=)\d+/${1}'$MINOR'/;' configure.ac
|
||||
perl -w -pi -e 's/\A(SDL_MICRO_VERSION=)\d+/${1}'$PATCH'/;' configure.ac
|
||||
|
||||
perl -w -pi -e 's/\A(set\(SDL_MAJOR_VERSION\s+)\d+/${1}'$MAJOR'/;' CMakeLists.txt
|
||||
perl -w -pi -e 's/\A(set\(SDL_MINOR_VERSION\s+)\d+/${1}'$MINOR'/;' CMakeLists.txt
|
||||
perl -w -pi -e 's/\A(set\(SDL_MICRO_VERSION\s+)\d+/${1}'$PATCH'/;' CMakeLists.txt
|
||||
|
||||
perl -w -pi -e 's/\A(.* SDL_MAJOR_VERSION = )\d+/${1}'$MAJOR'/;' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
|
||||
perl -w -pi -e 's/\A(.* SDL_MINOR_VERSION = )\d+/${1}'$MINOR'/;' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
|
||||
perl -w -pi -e 's/\A(.* SDL_MICRO_VERSION = )\d+/${1}'$PATCH'/;' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
|
||||
|
||||
perl -w -pi -e 's/\A(MAJOR_VERSION\s*=\s*)\d+/${1}'$MAJOR'/;' Makefile.os2
|
||||
perl -w -pi -e 's/\A(MINOR_VERSION\s*=\s*)\d+/${1}'$MINOR'/;' Makefile.os2
|
||||
perl -w -pi -e 's/\A(MICRO_VERSION\s*=\s*)\d+/${1}'$PATCH'/;' Makefile.os2
|
||||
|
||||
perl -w -pi -e 's/\A(MAJOR_VERSION\s*=\s*)\d+/${1}'$MAJOR'/;' Makefile.w32
|
||||
perl -w -pi -e 's/\A(MINOR_VERSION\s*=\s*)\d+/${1}'$MINOR'/;' Makefile.w32
|
||||
perl -w -pi -e 's/\A(MICRO_VERSION\s*=\s*)\d+/${1}'$PATCH'/;' Makefile.w32
|
||||
|
||||
perl -w -pi -e 's/(\#define SDL_MAJOR_VERSION\s+)\d+/${1}'$MAJOR'/;' include/SDL_version.h
|
||||
perl -w -pi -e 's/(\#define SDL_MINOR_VERSION\s+)\d+/${1}'$MINOR'/;' include/SDL_version.h
|
||||
perl -w -pi -e 's/(\#define SDL_PATCHLEVEL\s+)\d+/${1}'$PATCH'/;' include/SDL_version.h
|
||||
|
||||
perl -w -pi -e 's/(FILEVERSION\s+)\d+,\d+,\d+/${1}'$MAJOR','$MINOR','$PATCH'/;' src/main/windows/version.rc
|
||||
perl -w -pi -e 's/(PRODUCTVERSION\s+)\d+,\d+,\d+/${1}'$MAJOR','$MINOR','$PATCH'/;' src/main/windows/version.rc
|
||||
perl -w -pi -e 's/(VALUE "FileVersion", ")\d+, \d+, \d+/${1}'$MAJOR', '$MINOR', '$PATCH'/;' src/main/windows/version.rc
|
||||
perl -w -pi -e 's/(VALUE "ProductVersion", ")\d+, \d+, \d+/${1}'$MAJOR', '$MINOR', '$PATCH'/;' src/main/windows/version.rc
|
||||
|
||||
echo "Regenerating configure script with new version..."
|
||||
./autogen.sh |grep -v 'Now you are ready to run ./configure'
|
||||
|
||||
echo "Running build-scripts/test-versioning.sh to verify changes..."
|
||||
./build-scripts/test-versioning.sh
|
||||
|
||||
echo "All done."
|
||||
echo "Run 'git diff' and make sure this looks correct, before 'git commit'."
|
||||
|
||||
exit 0
|
||||
|
49
vendored/sdl/build-scripts/updaterev.sh
Normal file
49
vendored/sdl/build-scripts/updaterev.sh
Normal file
@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Generate a header file with the current source revision
|
||||
|
||||
outdir=`pwd`
|
||||
cd `dirname $0`
|
||||
srcdir=..
|
||||
header=$outdir/include/SDL_revision.h
|
||||
dist=
|
||||
vendor=
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
(--dist)
|
||||
dist=yes
|
||||
shift
|
||||
;;
|
||||
(--vendor)
|
||||
vendor="$2"
|
||||
shift 2
|
||||
;;
|
||||
(*)
|
||||
echo "$0: Unknown option: $1" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
rev=`sh showrev.sh 2>/dev/null`
|
||||
if [ "$rev" != "" ]; then
|
||||
if [ -n "$dist" ]; then
|
||||
echo "$rev" > "$outdir/VERSION.txt"
|
||||
fi
|
||||
echo "/* Generated by updaterev.sh, do not edit */" >"$header.new"
|
||||
if [ -n "$vendor" ]; then
|
||||
echo "#define SDL_VENDOR_INFO \"$vendor\"" >>"$header.new"
|
||||
fi
|
||||
echo "#ifdef SDL_VENDOR_INFO" >>"$header.new"
|
||||
echo "#define SDL_REVISION \"SDL-$rev (\" SDL_VENDOR_INFO \")\"" >>"$header.new"
|
||||
echo "#else" >>"$header.new"
|
||||
echo "#define SDL_REVISION \"SDL-$rev\"" >>"$header.new"
|
||||
echo "#endif" >>"$header.new"
|
||||
echo "#define SDL_REVISION_NUMBER 0" >>"$header.new"
|
||||
if diff $header $header.new >/dev/null 2>&1; then
|
||||
rm "$header.new"
|
||||
else
|
||||
mv "$header.new" "$header"
|
||||
fi
|
||||
fi
|
1656
vendored/sdl/build-scripts/wikiheaders.pl
Normal file
1656
vendored/sdl/build-scripts/wikiheaders.pl
Normal file
File diff suppressed because it is too large
Load Diff
28
vendored/sdl/build-scripts/windows-buildbot-zipper.bat
Normal file
28
vendored/sdl/build-scripts/windows-buildbot-zipper.bat
Normal file
@ -0,0 +1,28 @@
|
||||
@echo off
|
||||
rem just a helper batch file for collecting up files and zipping them.
|
||||
rem usage: windows-buildbot-zipper.bat <target> <slndir> <zipfilename>
|
||||
rem must be run from root of SDL source tree.
|
||||
|
||||
IF EXIST %2\%1\Release GOTO okaydir
|
||||
echo Please run from root of source tree after doing a Release build.
|
||||
GOTO done
|
||||
|
||||
:okaydir
|
||||
erase /q /f /s zipper
|
||||
IF EXIST zipper GOTO zippermade
|
||||
mkdir zipper
|
||||
:zippermade
|
||||
mkdir zipper\SDL
|
||||
mkdir zipper\SDL\include
|
||||
mkdir zipper\SDL\lib
|
||||
copy include\*.h include\
|
||||
copy %2\%1\Release\SDL2.dll zipper\SDL\lib\
|
||||
copy %2\%1\Release\SDL2.lib zipper\SDL\lib\
|
||||
copy %2\%1\Release\SDL2main.lib zipper\SDL\lib\
|
||||
cd zipper
|
||||
zip -9r ..\%3 SDL
|
||||
cd ..
|
||||
erase /q /f /s zipper
|
||||
|
||||
:done
|
||||
|
Reference in New Issue
Block a user