early-access version 1611
This commit is contained in:
100
externals/SDL/build-scripts/androidbuild.sh
vendored
Executable file
100
externals/SDL/build-scripts/androidbuild.sh
vendored
Executable 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"
|
74
externals/SDL/build-scripts/androidbuildlibs.sh
vendored
Executable file
74
externals/SDL/build-scripts/androidbuildlibs.sh
vendored
Executable file
@@ -0,0 +1,74 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# 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
|
103
externals/SDL/build-scripts/checker-buildbot.sh
vendored
Executable file
103
externals/SDL/build-scripts/checker-buildbot.sh
vendored
Executable file
@@ -0,0 +1,103 @@
|
||||
#!/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),
|
||||
# or download checker at http://clang-analyzer.llvm.org/ and unpack it in
|
||||
# /usr/local ... update CHECKERDIR as appropriate.
|
||||
|
||||
FINALDIR="$1"
|
||||
|
||||
CHECKERDIR="/usr/local/checker-279"
|
||||
if [ ! -d "$CHECKERDIR" ]; then
|
||||
echo "$CHECKERDIR not found. Trying /usr/share/clang ..." 1>&2
|
||||
CHECKERDIR="/usr/share/clang/scan-build"
|
||||
fi
|
||||
|
||||
if [ ! -d "$CHECKERDIR" ]; then
|
||||
echo "$CHECKERDIR not found. Giving up." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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'"
|
||||
|
||||
# Unset $MAKE so submakes don't use it.
|
||||
MAKECOMMAND="$MAKE"
|
||||
unset MAKE
|
||||
|
||||
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...
|
||||
PATH="$CHECKERDIR/bin:$PATH" scan-build -o analysis cmake -Wno-dev -DSDL_STATIC=OFF -DCMAKE_BUILD_TYPE=Debug -DASSERTIONS=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
|
||||
PATH="$CHECKERDIR/bin:$PATH" scan-build -o analysis $MAKECOMMAND
|
||||
|
||||
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 ...
|
||||
|
1476
externals/SDL/build-scripts/config.guess
vendored
Executable file
1476
externals/SDL/build-scripts/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1868
externals/SDL/build-scripts/config.sub
vendored
Executable file
1868
externals/SDL/build-scripts/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
72
externals/SDL/build-scripts/config.sub.patch
vendored
Executable file
72
externals/SDL/build-scripts/config.sub.patch
vendored
Executable file
@@ -0,0 +1,72 @@
|
||||
--- config.sub.orig 2017-09-09 08:01:02.139023205 -0700
|
||||
+++ config.sub 2017-09-09 07:59:35.798264474 -0700
|
||||
@@ -364,6 +364,19 @@
|
||||
i*86 | x86_64)
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
+ nacl64*)
|
||||
+ basic_machine=x86_64-pc
|
||||
+ os=-nacl
|
||||
+ ;;
|
||||
+ nacl*)
|
||||
+ basic_machine=i686-pc
|
||||
+ os=-nacl
|
||||
+ ;;
|
||||
+ pnacl*)
|
||||
+ # le32-unknown-pnacl comes from http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi
|
||||
+ basic_machine=le32-unknown
|
||||
+ os=-pnacl
|
||||
+ ;;
|
||||
# Object if more than one company name word.
|
||||
*-*-*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
@@ -877,6 +890,10 @@
|
||||
basic_machine=le32-unknown
|
||||
os=-nacl
|
||||
;;
|
||||
+ pnacl)
|
||||
+ basic_machine=le32-unknown
|
||||
+ os=-pnacl
|
||||
+ ;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
@@ -1429,6 +1446,12 @@
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
+ -nacl*)
|
||||
+ os=-nacl
|
||||
+ ;;
|
||||
+ -pnacl*)
|
||||
+ os=-pnacl
|
||||
+ ;;
|
||||
-nto-qnx*)
|
||||
;;
|
||||
-nto*)
|
||||
@@ -1459,6 +1482,9 @@
|
||||
-os400*)
|
||||
os=-os400
|
||||
;;
|
||||
+ -cegcc*)
|
||||
+ os=-cegcc
|
||||
+ ;;
|
||||
-wince*)
|
||||
os=-wince
|
||||
;;
|
||||
@@ -1548,9 +1574,15 @@
|
||||
os=-dicos
|
||||
;;
|
||||
-nacl*)
|
||||
+ os=-nacl
|
||||
+ ;;
|
||||
+ -pnacl*)
|
||||
+ os=-pnacl
|
||||
;;
|
||||
-ios)
|
||||
;;
|
||||
+ -emscripten*)
|
||||
+ ;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
77
externals/SDL/build-scripts/emscripten-buildbot.sh
vendored
Executable file
77
externals/SDL/build-scripts/emscripten-buildbot.sh
vendored
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$SDKDIR" ]; then
|
||||
SDKDIR="/emsdk_portable"
|
||||
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=asmjs-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-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
|
||||
popd
|
||||
tar -cJvvf $TARBALL -C buildbot usr
|
||||
rm -rf buildbot
|
||||
|
||||
exit 0
|
||||
|
||||
# end of emscripten-buildbot.sh ...
|
||||
|
101
externals/SDL/build-scripts/g++-fat.sh
vendored
Executable file
101
externals/SDL/build-scripts/g++-fat.sh
vendored
Executable file
@@ -0,0 +1,101 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Build Universal binaries on Mac OS X, thanks Ryan!
|
||||
#
|
||||
# Usage: ./configure CXX="sh g++-fat.sh" && make && rm -rf x86 x64
|
||||
|
||||
DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
|
||||
|
||||
# Intel 32-bit compiler flags (10.6 runtime compatibility)
|
||||
GCC_COMPILE_X86="g++ -arch i386 -mmacosx-version-min=10.6 \
|
||||
-I/usr/local/include"
|
||||
|
||||
GCC_LINK_X86="-mmacosx-version-min=10.6"
|
||||
|
||||
# Intel 64-bit compiler flags (10.6 runtime compatibility)
|
||||
GCC_COMPILE_X64="g++ -arch x86_64 -mmacosx-version-min=10.6 \
|
||||
-I/usr/local/include"
|
||||
|
||||
GCC_LINK_X64="-mmacosx-version-min=10.6"
|
||||
|
||||
# Output both PowerPC and Intel object files
|
||||
args="$*"
|
||||
compile=yes
|
||||
link=yes
|
||||
while test x$1 != x; do
|
||||
case $1 in
|
||||
--version) exec g++ $1;;
|
||||
-v) exec g++ $1;;
|
||||
-V) exec g++ $1;;
|
||||
-print-prog-name=*) exec g++ $1;;
|
||||
-print-search-dirs) exec g++ $1;;
|
||||
-E) GCC_COMPILE_X86="$GCC_COMPILE_X86 -E"
|
||||
GCC_COMPILE_X64="$GCC_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
|
||||
GCC_COMPILE_X86="$GCC_COMPILE_X86 $GCC_LINK_X86"
|
||||
GCC_COMPILE_X64="$GCC_COMPILE_X64 $GCC_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 X86 32-bit
|
||||
if test x"$output" != x; then
|
||||
dir=x86/`dirname $output`
|
||||
if test -d $dir; then
|
||||
:
|
||||
else
|
||||
mkdir -p $dir
|
||||
fi
|
||||
fi
|
||||
set -- $args
|
||||
while test x$1 != x; do
|
||||
if test -f "x86/$1" && test "$1" != "$output"; then
|
||||
x86_args="$x86_args x86/$1"
|
||||
else
|
||||
x86_args="$x86_args $1"
|
||||
fi
|
||||
shift
|
||||
done
|
||||
$GCC_COMPILE_X86 $x86_args || exit $?
|
||||
if test x"$output" != x; then
|
||||
cp $output x86/$output
|
||||
fi
|
||||
|
||||
# Compile X86 32-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
|
||||
$GCC_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 x86/$output x64/$output
|
||||
fi
|
102
externals/SDL/build-scripts/gcc-fat.sh
vendored
Executable file
102
externals/SDL/build-scripts/gcc-fat.sh
vendored
Executable file
@@ -0,0 +1,102 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Build Universal binaries on Mac OS X, thanks Ryan!
|
||||
#
|
||||
# Usage: ./configure CC="sh gcc-fat.sh" && make && rm -rf x86 x64
|
||||
|
||||
DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
|
||||
|
||||
# Intel 32-bit compiler flags (10.6 runtime compatibility)
|
||||
GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.6 \
|
||||
-I/usr/local/include"
|
||||
|
||||
GCC_LINK_X86="-mmacosx-version-min=10.6"
|
||||
|
||||
# Intel 64-bit compiler flags (10.6 runtime compatibility)
|
||||
GCC_COMPILE_X64="gcc -arch x86_64 -mmacosx-version-min=10.6 \
|
||||
-DMAC_OS_X_VERSION_MIN_REQUIRED=1060 \
|
||||
-I/usr/local/include"
|
||||
|
||||
GCC_LINK_X64="-mmacosx-version-min=10.6"
|
||||
|
||||
# Output both PowerPC and Intel object files
|
||||
args="$*"
|
||||
compile=yes
|
||||
link=yes
|
||||
while test x$1 != x; do
|
||||
case $1 in
|
||||
--version) exec gcc $1;;
|
||||
-v) exec gcc $1;;
|
||||
-V) exec gcc $1;;
|
||||
-print-prog-name=*) exec gcc $1;;
|
||||
-print-search-dirs) exec gcc $1;;
|
||||
-E) GCC_COMPILE_X86="$GCC_COMPILE_X86 -E"
|
||||
GCC_COMPILE_X64="$GCC_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
|
||||
GCC_COMPILE_X86="$GCC_COMPILE_X86 $GCC_LINK_X86"
|
||||
GCC_COMPILE_X64="$GCC_COMPILE_X64 $GCC_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 X86 32-bit
|
||||
if test x"$output" != x; then
|
||||
dir=x86/`dirname $output`
|
||||
if test -d $dir; then
|
||||
:
|
||||
else
|
||||
mkdir -p $dir
|
||||
fi
|
||||
fi
|
||||
set -- $args
|
||||
while test x$1 != x; do
|
||||
if test -f "x86/$1" && test "$1" != "$output"; then
|
||||
x86_args="$x86_args x86/$1"
|
||||
else
|
||||
x86_args="$x86_args $1"
|
||||
fi
|
||||
shift
|
||||
done
|
||||
$GCC_COMPILE_X86 $x86_args || exit $?
|
||||
if test x"$output" != x; then
|
||||
cp $output x86/$output
|
||||
fi
|
||||
|
||||
# Compile X86 32-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
|
||||
$GCC_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 x86/$output x64/$output
|
||||
fi
|
527
externals/SDL/build-scripts/install-sh
vendored
Executable file
527
externals/SDL/build-scripts/install-sh
vendored
Executable file
@@ -0,0 +1,527 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2011-11-20.07; # 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.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
# 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_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
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 the last 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.
|
||||
-s $stripprog installed files.
|
||||
-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
|
||||
"
|
||||
|
||||
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
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
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
|
||||
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=$?
|
||||
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; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# 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
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/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.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or 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
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob 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=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_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 && $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` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# 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 -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$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 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
188
externals/SDL/build-scripts/iosbuild.sh
vendored
Executable file
188
externals/SDL/build-scripts/iosbuild.sh
vendored
Executable file
@@ -0,0 +1,188 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Build a fat binary for iOS
|
||||
|
||||
# Number of CPUs (for make -j)
|
||||
NCPU=`sysctl -n hw.ncpu`
|
||||
if test x$NJOB = x; then
|
||||
NJOB=$NCPU
|
||||
fi
|
||||
|
||||
SRC_DIR=$(cd `dirname $0`/..; pwd)
|
||||
if [ "$PWD" = "$SRC_DIR" ]; then
|
||||
PREFIX=$SRC_DIR/ios-build
|
||||
mkdir $PREFIX
|
||||
else
|
||||
PREFIX=$PWD
|
||||
fi
|
||||
|
||||
BUILD_I386_IOSSIM=YES
|
||||
BUILD_X86_64_IOSSIM=YES
|
||||
|
||||
BUILD_IOS_ARMV7=YES
|
||||
BUILD_IOS_ARMV7S=YES
|
||||
BUILD_IOS_ARM64=YES
|
||||
|
||||
# 13.4.0 - Mavericks
|
||||
# 14.0.0 - Yosemite
|
||||
# 15.0.0 - El Capitan
|
||||
DARWIN=darwin15.0.0
|
||||
|
||||
XCODEDIR=`xcode-select --print-path`
|
||||
IOS_SDK_VERSION=`xcrun --sdk iphoneos --show-sdk-version`
|
||||
MIN_SDK_VERSION=6.0
|
||||
|
||||
IPHONEOS_PLATFORM=`xcrun --sdk iphoneos --show-sdk-platform-path`
|
||||
IPHONEOS_SYSROOT=`xcrun --sdk iphoneos --show-sdk-path`
|
||||
|
||||
IPHONESIMULATOR_PLATFORM=`xcrun --sdk iphonesimulator --show-sdk-platform-path`
|
||||
IPHONESIMULATOR_SYSROOT=`xcrun --sdk iphonesimulator --show-sdk-path`
|
||||
|
||||
# Uncomment if you want to see more information about each invocation
|
||||
# of clang as the builds proceed.
|
||||
# CLANG_VERBOSE="--verbose"
|
||||
|
||||
CC=clang
|
||||
CXX=clang
|
||||
|
||||
SILENCED_WARNINGS="-Wno-unused-local-typedef -Wno-unused-function"
|
||||
|
||||
CFLAGS="${CLANG_VERBOSE} ${SILENCED_WARNINGS} -DNDEBUG -g -O0 -pipe -fPIC -fobjc-arc"
|
||||
|
||||
echo "PREFIX ..................... ${PREFIX}"
|
||||
echo "BUILD_MACOSX_X86_64 ........ ${BUILD_MACOSX_X86_64}"
|
||||
echo "BUILD_I386_IOSSIM .......... ${BUILD_I386_IOSSIM}"
|
||||
echo "BUILD_X86_64_IOSSIM ........ ${BUILD_X86_64_IOSSIM}"
|
||||
echo "BUILD_IOS_ARMV7 ............ ${BUILD_IOS_ARMV7}"
|
||||
echo "BUILD_IOS_ARMV7S ........... ${BUILD_IOS_ARMV7S}"
|
||||
echo "BUILD_IOS_ARM64 ............ ${BUILD_IOS_ARM64}"
|
||||
echo "DARWIN ..................... ${DARWIN}"
|
||||
echo "XCODEDIR ................... ${XCODEDIR}"
|
||||
echo "IOS_SDK_VERSION ............ ${IOS_SDK_VERSION}"
|
||||
echo "MIN_SDK_VERSION ............ ${MIN_SDK_VERSION}"
|
||||
echo "IPHONEOS_PLATFORM .......... ${IPHONEOS_PLATFORM}"
|
||||
echo "IPHONEOS_SYSROOT ........... ${IPHONEOS_SYSROOT}"
|
||||
echo "IPHONESIMULATOR_PLATFORM ... ${IPHONESIMULATOR_PLATFORM}"
|
||||
echo "IPHONESIMULATOR_SYSROOT .... ${IPHONESIMULATOR_SYSROOT}"
|
||||
echo "CC ......................... ${CC}"
|
||||
echo "CFLAGS ..................... ${CFLAGS}"
|
||||
echo "CXX ........................ ${CXX}"
|
||||
echo "CXXFLAGS ................... ${CXXFLAGS}"
|
||||
echo "LDFLAGS .................... ${LDFLAGS}"
|
||||
|
||||
###################################################################
|
||||
# This section contains the build commands for each of the
|
||||
# architectures that will be included in the universal binaries.
|
||||
###################################################################
|
||||
|
||||
echo "$(tput setaf 2)"
|
||||
echo "###########################"
|
||||
echo "# i386 for iPhone Simulator"
|
||||
echo "###########################"
|
||||
echo "$(tput sgr0)"
|
||||
|
||||
if [ "${BUILD_I386_IOSSIM}" == "YES" ]
|
||||
then
|
||||
(
|
||||
cd ${PREFIX}
|
||||
make clean
|
||||
../configure --build=x86_64-apple-${DARWIN} --host=i386-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/i386-sim "CC=${CC}" "CFLAGS=${CFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch i386 -isysroot ${IPHONESIMULATOR_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch i386 -isysroot ${IPHONESIMULATOR_SYSROOT}" LDFLAGS="-arch i386 -mios-simulator-version-min=${MIN_SDK_VERSION} ${LDFLAGS} -L${IPHONESIMULATOR_SYSROOT}/usr/lib/ -L${IPHONESIMULATOR_SYSROOT}/usr/lib/system" || exit 2
|
||||
cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h
|
||||
make -j10 || exit 3
|
||||
make install
|
||||
) || exit $?
|
||||
fi
|
||||
|
||||
echo "$(tput setaf 2)"
|
||||
echo "#############################"
|
||||
echo "# x86_64 for iPhone Simulator"
|
||||
echo "#############################"
|
||||
echo "$(tput sgr0)"
|
||||
|
||||
if [ "${BUILD_X86_64_IOSSIM}" == "YES" ]
|
||||
then
|
||||
(
|
||||
cd ${PREFIX}
|
||||
make clean
|
||||
../configure --build=x86_64-apple-${DARWIN} --host=x86_64-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/x86_64-sim "CC=${CC}" "CFLAGS=${CFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch x86_64 -isysroot ${IPHONESIMULATOR_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch x86_64 -isysroot ${IPHONESIMULATOR_SYSROOT}" LDFLAGS="-arch x86_64 -mios-simulator-version-min=${MIN_SDK_VERSION} ${LDFLAGS} -L${IPHONESIMULATOR_SYSROOT}/usr/lib/ -L${IPHONESIMULATOR_SYSROOT}/usr/lib/system" || exit 2
|
||||
cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h
|
||||
make -j$NJOB || exit 3
|
||||
make install
|
||||
) || exit $?
|
||||
fi
|
||||
|
||||
echo "$(tput setaf 2)"
|
||||
echo "##################"
|
||||
echo "# armv7 for iPhone"
|
||||
echo "##################"
|
||||
echo "$(tput sgr0)"
|
||||
|
||||
if [ "${BUILD_IOS_ARMV7}" == "YES" ]
|
||||
then
|
||||
(
|
||||
cd ${PREFIX}
|
||||
make clean
|
||||
../configure --build=x86_64-apple-${DARWIN} --host=armv7-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/armv7-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7 -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -arch armv7 -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch armv7 -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" || exit 2
|
||||
cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h
|
||||
make -j$NJOB || exit 3
|
||||
make install
|
||||
) || exit $?
|
||||
fi
|
||||
|
||||
echo "$(tput setaf 2)"
|
||||
echo "###################"
|
||||
echo "# armv7s for iPhone"
|
||||
echo "###################"
|
||||
echo "$(tput sgr0)"
|
||||
|
||||
if [ "${BUILD_IOS_ARMV7S}" == "YES" ]
|
||||
then
|
||||
(
|
||||
cd ${PREFIX}
|
||||
make clean
|
||||
../configure --build=x86_64-apple-${DARWIN} --host=armv7s-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/armv7s-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7s -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7s -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch armv7s -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" || exit 2
|
||||
cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h
|
||||
make -j$NJOB || exit 3
|
||||
make install
|
||||
) || exit $?
|
||||
fi
|
||||
|
||||
echo "$(tput setaf 2)"
|
||||
echo "##################"
|
||||
echo "# arm64 for iPhone"
|
||||
echo "##################"
|
||||
echo "$(tput sgr0)"
|
||||
|
||||
if [ "${BUILD_IOS_ARM64}" == "YES" ]
|
||||
then
|
||||
(
|
||||
cd ${PREFIX}
|
||||
make clean
|
||||
../configure --build=x86_64-apple-${DARWIN} --host=arm-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/arm64-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch arm64 -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch arm64 -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch arm64 -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" || exit 2
|
||||
cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h
|
||||
make -j$NJOB || exit 3
|
||||
make install
|
||||
) || exit $?
|
||||
fi
|
||||
|
||||
echo "$(tput setaf 2)"
|
||||
echo "###################################################################"
|
||||
echo "# Create Universal Libraries and Finalize the packaging"
|
||||
echo "###################################################################"
|
||||
echo "$(tput sgr0)"
|
||||
|
||||
(
|
||||
cd ${PREFIX}/platform
|
||||
mkdir -p universal
|
||||
lipo x86_64-sim/lib/libSDL2.a i386-sim/lib/libSDL2.a arm64-ios/lib/libSDL2.a armv7s-ios/lib/libSDL2.a armv7-ios/lib/libSDL2.a -create -output universal/libSDL2.a
|
||||
)
|
||||
|
||||
(
|
||||
cd ${PREFIX}
|
||||
mkdir -p lib
|
||||
cp -r platform/universal/* lib
|
||||
#rm -rf platform
|
||||
lipo -info lib/libSDL2.a
|
||||
)
|
||||
|
||||
echo Done!
|
9655
externals/SDL/build-scripts/ltmain.sh
vendored
Executable file
9655
externals/SDL/build-scripts/ltmain.sh
vendored
Executable file
File diff suppressed because it is too large
Load Diff
162
externals/SDL/build-scripts/mkinstalldirs
vendored
Executable file
162
externals/SDL/build-scripts/mkinstalldirs
vendored
Executable file
@@ -0,0 +1,162 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
|
||||
scriptversion=2009-04-28.21; # 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 "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
|
||||
|
||||
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
|
||||
else
|
||||
if test ! -z "$dirmode"; then
|
||||
echo "chmod $dirmode $pathcomp"
|
||||
lasterr=
|
||||
chmod "$dirmode" "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -z "$lasterr"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp=$pathcomp/
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
61
externals/SDL/build-scripts/nacl-buildbot.sh
vendored
Executable file
61
externals/SDL/build-scripts/nacl-buildbot.sh
vendored
Executable 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
externals/SDL/build-scripts/naclbuild.sh
vendored
Executable file
105
externals/SDL/build-scripts/naclbuild.sh
vendored
Executable 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
|
42
externals/SDL/build-scripts/os2-buildbot.sh
vendored
Executable file
42
externals/SDL/build-scripts/os2-buildbot.sh
vendored
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This is the script buildbot.libsdl.org uses to cross-compile SDL2 from
|
||||
# x86 Linux to OS/2, using OpenWatcom.
|
||||
|
||||
# The final zipfile can be unpacked on any machine that supports OpenWatcom
|
||||
# (Windows, Linux, OS/2, etc). Point the compiler at the include directory
|
||||
# and link against the SDL2.lib file. Ship the SDL2.dll with your app.
|
||||
|
||||
if [ -z "$WATCOM" ]; then
|
||||
echo "This script expects \$WATCOM to be set to the OpenWatcom install dir." 1>&2
|
||||
echo "This is often something like '/usr/local/share/watcom'" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export PATH="$WATCOM/binl:$PATH"
|
||||
|
||||
ZIPFILE="$1"
|
||||
if [ -z $1 ]; then
|
||||
ZIPFILE=sdl-os2.zip
|
||||
fi
|
||||
ZIPDIR=SDL2-os2
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
cd `dirname "$0"`
|
||||
cd ..
|
||||
|
||||
rm -f $ZIPFILE
|
||||
wmake -f Makefile.os2
|
||||
rm -rf $ZIPDIR
|
||||
mkdir $ZIPDIR
|
||||
chmod a+r SDL2.lib SDL2.dll
|
||||
mv SDL2.lib SDL2.dll $ZIPDIR/
|
||||
cp -R include $ZIPDIR/
|
||||
zip -9r "$ZIPFILE" $ZIPDIR
|
||||
|
||||
wmake -f Makefile.os2 distclean
|
||||
|
||||
set +x
|
||||
echo "All done. Final installable is in $ZIPFILE ...";
|
60
externals/SDL/build-scripts/raspberrypi-buildbot.sh
vendored
Executable file
60
externals/SDL/build-scripts/raspberrypi-buildbot.sh
vendored
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/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="raspberrypi-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
|
||||
|
||||
popd
|
||||
tar -cJvvf $TARBALL -C $BUILDBOTDIR usr
|
||||
rm -rf $BUILDBOTDIR
|
||||
|
||||
set +x
|
||||
echo "All done. Final installable is in $TARBALL ...";
|
||||
|
||||
|
5
externals/SDL/build-scripts/showrev.sh
vendored
Executable file
5
externals/SDL/build-scripts/showrev.sh
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Print the current source revision, if available
|
||||
|
||||
hg parents --template 'hg-{rev}:{node|short}' || (echo "hg-0:baadf00d"; exit 1)
|
21
externals/SDL/build-scripts/strip_fPIC.sh
vendored
Executable file
21
externals/SDL/build-scripts/strip_fPIC.sh
vendored
Executable 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
|
8
externals/SDL/build-scripts/update-copyright.sh
vendored
Executable file
8
externals/SDL/build-scripts/update-copyright.sh
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
find . -type f -exec grep -Il "Copyright" {} \; \
|
||||
| grep -v \.hg \
|
||||
| while read file; \
|
||||
do \
|
||||
LC_ALL=C sed -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \
|
||||
done
|
20
externals/SDL/build-scripts/updaterev.sh
vendored
Executable file
20
externals/SDL/build-scripts/updaterev.sh
vendored
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Generate a header file with the current source revision
|
||||
|
||||
outdir=`pwd`
|
||||
cd `dirname $0`
|
||||
srcdir=..
|
||||
header=$outdir/include/SDL_revision.h
|
||||
|
||||
rev=`sh showrev.sh 2>/dev/null`
|
||||
if [ "$rev" != "" -a "$rev" != "hg-0:baadf00d" ]; then
|
||||
revnum=`echo $rev | sed 's,hg-\([0-9]*\).*,\1,'`
|
||||
echo "#define SDL_REVISION \"$rev\"" >"$header.new"
|
||||
echo "#define SDL_REVISION_NUMBER $revnum" >>"$header.new"
|
||||
if diff $header $header.new >/dev/null 2>&1; then
|
||||
rm "$header.new"
|
||||
else
|
||||
mv "$header.new" "$header"
|
||||
fi
|
||||
fi
|
40
externals/SDL/build-scripts/windows-buildbot-zipper.bat
vendored
Executable file
40
externals/SDL/build-scripts/windows-buildbot-zipper.bat
vendored
Executable file
@@ -0,0 +1,40 @@
|
||||
@echo off
|
||||
rem just a helper batch file for collecting up files and zipping them.
|
||||
rem usage: windows-buildbot-zipper.bat <zipfilename>
|
||||
rem must be run from root of SDL source tree.
|
||||
|
||||
IF EXIST VisualC\Win32\Release GOTO okaywin32dir
|
||||
echo Please run from root of source tree after doing a Release build.
|
||||
GOTO done
|
||||
|
||||
:okaywin32dir
|
||||
IF EXIST VisualC\x64\Release GOTO okaydirs
|
||||
echo Please run from root of source tree after doing a Release build.
|
||||
GOTO done
|
||||
|
||||
:okaydirs
|
||||
erase /q /f /s zipper
|
||||
IF EXIST zipper GOTO zippermade
|
||||
mkdir zipper
|
||||
:zippermade
|
||||
cd zipper
|
||||
mkdir SDL
|
||||
cd SDL
|
||||
mkdir include
|
||||
mkdir lib
|
||||
mkdir lib\win32
|
||||
mkdir lib\win64
|
||||
copy ..\..\include\*.h include\
|
||||
copy ..\..\VisualC\Win32\Release\SDL2.dll lib\win32\
|
||||
copy ..\..\VisualC\Win32\Release\SDL2.lib lib\win32\
|
||||
copy ..\..\VisualC\Win32\Release\SDL2main.lib lib\win32\
|
||||
copy ..\..\VisualC\x64\Release\SDL2.dll lib\win64\
|
||||
copy ..\..\VisualC\x64\Release\SDL2.lib lib\win64\
|
||||
copy ..\..\VisualC\x64\Release\SDL2main.lib lib\win64\
|
||||
cd ..
|
||||
zip -9r ..\%1 SDL
|
||||
cd ..
|
||||
erase /q /f /s zipper
|
||||
|
||||
:done
|
||||
|
8
externals/SDL/build-scripts/winrtbuild.bat
vendored
Executable file
8
externals/SDL/build-scripts/winrtbuild.bat
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
@ECHO OFF
|
||||
REM
|
||||
REM winrtbuild.bat: a batch file to help launch the winrtbuild.ps1
|
||||
REM Powershell script, either from Windows Explorer, or through Buildbot.
|
||||
REM
|
||||
SET ThisScriptsDirectory=%~dp0
|
||||
SET PowerShellScriptPath=%ThisScriptsDirectory%winrtbuild.ps1
|
||||
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%PowerShellScriptPath%'";
|
302
externals/SDL/build-scripts/winrtbuild.ps1
vendored
Executable file
302
externals/SDL/build-scripts/winrtbuild.ps1
vendored
Executable file
@@ -0,0 +1,302 @@
|
||||
#
|
||||
# winrtbuild.ps1 -- A Powershell script to build all SDL/WinRT variants,
|
||||
# across all WinRT platforms, in all of their supported, CPU architectures.
|
||||
#
|
||||
# Initial version written by David Ludwig <dludwig@pobox.com>
|
||||
#
|
||||
# This script can be launched from Windows Explorer by double-clicking
|
||||
# on winrtbuild.bat
|
||||
#
|
||||
# Output will be placed in the following subdirectories of the SDL source
|
||||
# tree:
|
||||
# * VisualC-WinRT\lib\ -- final .dll, .lib, and .pdb files
|
||||
# * VisualC-WinRT\obj\ -- intermediate build files
|
||||
#
|
||||
# Recommended Dependencies:
|
||||
# * Windows 8.1 or higher
|
||||
# * Powershell 4.0 or higher (included as part of Windows 8.1)
|
||||
# * Visual C++ 2012, for building Windows 8.0 and Windows Phone 8.0 binaries.
|
||||
# * Visual C++ 2013, for building Windows 8.1 and Windows Phone 8.1 binaries
|
||||
# * SDKs for Windows 8.0, Windows 8.1, Windows Phone 8.0, and
|
||||
# Windows Phone 8.1, as needed
|
||||
#
|
||||
# Commom parameters/variables may include, but aren't strictly limited to:
|
||||
# * PlatformToolset: the name of one of Visual Studio's build platforms.
|
||||
# Different PlatformToolsets output different binaries. One
|
||||
# PlatformToolset exists for each WinRT platform. Possible values
|
||||
# may include:
|
||||
# - "v110": Visual Studio 2012 build tools, plus the Windows 8.0 SDK
|
||||
# - "v110_wp80": Visual Studio 2012 build tools, plus the Windows Phone 8.0 SDK
|
||||
# - "v120": Visual Studio 2013 build tools, plus the Windows 8.1 SDK
|
||||
# - "v120_wp81": Visual Studio 2013 build tools, plus the Windows Phone 8.1 SDK
|
||||
# * VSProjectPath: the full path to a Visual Studio or Visual C++ project file
|
||||
# * VSProjectName: the internal name of a Visual Studio or Visual C++ project
|
||||
# file. Some of Visual Studio's own build tools use this name when
|
||||
# calculating paths for build-output.
|
||||
# * Platform: a Visual Studio platform name, which often maps to a CPU
|
||||
# CPU architecture. Possible values may include: "Win32" (for 32-bit x86),
|
||||
# "ARM", or "x64" (for 64-bit x86).
|
||||
#
|
||||
|
||||
# Base version of SDL, used for packaging purposes
|
||||
$SDLVersion = "2.0.12"
|
||||
|
||||
# Gets the .bat file that sets up an MSBuild environment, given one of
|
||||
# Visual Studio's, "PlatformToolset"s.
|
||||
function Get-MSBuild-Env-Launcher
|
||||
{
|
||||
param(
|
||||
[Parameter(Mandatory=$true,Position=1)][string]$PlatformToolset
|
||||
)
|
||||
|
||||
if ($PlatformToolset -eq "v110") { # Windows 8.0 (not Windows Phone), via VS 2012
|
||||
return "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
|
||||
}
|
||||
if ($PlatformToolset -eq "v110_wp80") { # Windows Phone 8.0, via VS 2012
|
||||
return "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\WPSDK\WP80\vcvarsphoneall.bat"
|
||||
}
|
||||
if ($PlatformToolset -eq "v120") { # Windows 8.1 (not Windows Phone), via VS 2013
|
||||
return "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
|
||||
}
|
||||
if ($PlatformToolset -eq "v120_wp81") { # Windows Phone 8.1, via VS 2013
|
||||
return "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
|
||||
}
|
||||
if ($PlatformToolset -eq "v140") { # Windows 10, via VS 2015
|
||||
return "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
# Gets a string that identifies the build-variant of SDL/WinRT that is specific
|
||||
# to a particular Visual Studio PlatformToolset.
|
||||
function Get-SDL-WinRT-Variant-Name
|
||||
{
|
||||
param(
|
||||
[Parameter(Mandatory=$true,Position=1)][string]$PlatformToolset,
|
||||
|
||||
# If true, append a string to this function's output, identifying the
|
||||
# build-variant's minimum-supported version of Visual Studio.
|
||||
[switch]$IncludeVSSuffix = $false
|
||||
)
|
||||
|
||||
if ($PlatformToolset -eq "v110") { # Windows 8.0 (not Windows Phone), via VS 2012 project files
|
||||
if ($IncludeVSSuffix) {
|
||||
return "WinRT80_VS2012"
|
||||
} else {
|
||||
return "WinRT80"
|
||||
}
|
||||
}
|
||||
if ($PlatformToolset -eq "v110_wp80") { # Windows Phone 8.0, via VS 2012 project files
|
||||
if ($IncludeVSSuffix) {
|
||||
return "WinPhone80_VS2012"
|
||||
} else {
|
||||
return "WinPhone80"
|
||||
}
|
||||
}
|
||||
if ($PlatformToolset -eq "v120") { # Windows 8.1 (not Windows Phone), via VS 2013 project files
|
||||
if ($IncludeVSSuffix) {
|
||||
return "WinRT81_VS2013"
|
||||
} else {
|
||||
return "WinRT81"
|
||||
}
|
||||
}
|
||||
if ($PlatformToolset -eq "v120_wp81") { # Windows Phone 8.1, via VS 2013 project files
|
||||
if ($IncludeVSSuffix) {
|
||||
return "WinPhone81_VS2013"
|
||||
} else {
|
||||
return "WinPhone81"
|
||||
}
|
||||
}
|
||||
if ($PlatformToolset -eq "v140") { # Windows 10, via VS 2015 project files
|
||||
if ($IncludeVSSuffix) {
|
||||
return "UWP_VS2015"
|
||||
} else {
|
||||
return "UWP"
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
# Returns the internal name of a Visual Studio Project.
|
||||
#
|
||||
# The internal name of a VS Project is encoded inside the project file
|
||||
# itself, inside a set of <ProjectName></ProjectName> XML tags.
|
||||
function Get-VS-ProjectName
|
||||
{
|
||||
param(
|
||||
[Parameter(Mandatory=$true,Position=1)]$VSProjectPath
|
||||
)
|
||||
|
||||
# For now, just do a regex for the project name:
|
||||
$matches = (Get-Content $VSProjectPath | Select-String -Pattern ".*<ProjectName>([^<]+)<.*").Matches
|
||||
foreach ($match in $matches) {
|
||||
if ($match.Groups.Count -ge 1) {
|
||||
return $match.Groups[1].Value
|
||||
}
|
||||
}
|
||||
return $null
|
||||
}
|
||||
|
||||
# Build a specific variant of SDL/WinRT
|
||||
function Build-SDL-WinRT-Variant
|
||||
{
|
||||
#
|
||||
# Read in arguments:
|
||||
#
|
||||
param (
|
||||
# name of an SDL project file, minus extensions and
|
||||
# platform-identifying suffixes
|
||||
[Parameter(Mandatory=$true,Position=1)][string]$SDLProjectName,
|
||||
|
||||
[Parameter(Mandatory=$true,Position=2)][string]$PlatformToolset,
|
||||
|
||||
[Parameter(Mandatory=$true,Position=3)][string]$Platform
|
||||
)
|
||||
|
||||
#
|
||||
# Derive other properties from read-in arguments:
|
||||
#
|
||||
|
||||
# The .bat file to setup a platform-appropriate MSBuild environment:
|
||||
$BatchFileForMSBuildEnv = Get-MSBuild-Env-Launcher $PlatformToolset
|
||||
|
||||
# The full path to the VS Project that'll be built:
|
||||
$VSProjectPath = "$PSScriptRoot\..\VisualC-WinRT\$(Get-SDL-WinRT-Variant-Name $PlatformToolset -IncludeVSSuffix)\$SDLProjectName-$(Get-SDL-WinRT-Variant-Name $PlatformToolset).vcxproj"
|
||||
|
||||
# The internal name of the VS Project, used in some post-build steps:
|
||||
$VSProjectName = Get-VS-ProjectName $VSProjectPath
|
||||
|
||||
# Where to place output binaries (.dll, .lib, and .pdb files):
|
||||
$OutDir = "$PSScriptRoot\..\VisualC-WinRT\lib\$(Get-SDL-WinRT-Variant-Name $PlatformToolset)\$Platform"
|
||||
|
||||
# Where to place intermediate build files:
|
||||
$IntermediateDir = "$PSScriptRoot\..\VisualC-WinRT\obj\$SDLProjectName-$(Get-SDL-WinRT-Variant-Name $PlatformToolset)\$Platform"
|
||||
|
||||
#
|
||||
# Build the VS Project:
|
||||
#
|
||||
cmd.exe /c " ""$BatchFileForMSBuildEnv"" x86 & msbuild ""$VSProjectPath"" /p:Configuration=Release /p:Platform=$Platform /p:OutDir=""$OutDir\\"" /p:IntDir=""$IntermediateDir\\""" | Out-Host
|
||||
$BuildResult = $?
|
||||
|
||||
#
|
||||
# Move .dll files into place. This fixes a problem whereby MSBuild may
|
||||
# put output files into a sub-directory of $OutDir, rather than $OutDir
|
||||
# itself.
|
||||
#
|
||||
if (Test-Path "$OutDir\$VSProjectName\") {
|
||||
Move-Item -Force "$OutDir\$VSProjectName\*" "$OutDir"
|
||||
}
|
||||
|
||||
#
|
||||
# Clean up unneeded files in $OutDir:
|
||||
#
|
||||
if (Test-Path "$OutDir\$VSProjectName\") {
|
||||
Remove-Item -Recurse "$OutDir\$VSProjectName"
|
||||
}
|
||||
Remove-Item "$OutDir\*.exp"
|
||||
Remove-Item "$OutDir\*.ilk"
|
||||
Remove-Item "$OutDir\*.pri"
|
||||
|
||||
#
|
||||
# All done. Indicate success, or failure, to the caller:
|
||||
#
|
||||
#echo "RESULT: $BuildResult" | Out-Host
|
||||
return $BuildResult
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Build each variant, with corresponding .dll, .lib, and .pdb files:
|
||||
#
|
||||
$DidAnyDLLBuildFail = $false
|
||||
$DidAnyNugetBuildFail = $false
|
||||
|
||||
# Ryan disabled WP8.0, because it doesn't appear to have mmdeviceapi.h that SDL_wasapi needs.
|
||||
# My assumption is that no one will miss this, but send patches otherwise! --ryan.
|
||||
# Build for Windows Phone 8.0, via VC++ 2012:
|
||||
#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "ARM")) { $DidAnyDLLBuildFail = $true }
|
||||
#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "Win32")) { $DidAnyDLLBuildFail = $true }
|
||||
|
||||
# Build for Windows Phone 8.1, via VC++ 2013:
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "ARM")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "Win32")) { $DidAnyDLLBuildFail = $true }
|
||||
|
||||
# Build for Windows 8.0 and Windows RT 8.0, via VC++ 2012:
|
||||
#
|
||||
# Win 8.0 auto-building was disabled on 2017-Feb-25, by David Ludwig <dludwig@pobox.com>.
|
||||
# Steam's OS-usage surveys indicate that Windows 8.0 use is pretty much nil, plus
|
||||
# Microsoft hasn't supported Windows 8.0 development for a few years now.
|
||||
# The commented-out lines below may still work on some systems, though.
|
||||
#
|
||||
#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "ARM")) { $DidAnyDLLBuildFail = $true }
|
||||
#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "Win32")) { $DidAnyDLLBuildFail = $true }
|
||||
#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "x64")) { $DidAnyDLLBuildFail = $true }
|
||||
|
||||
# Build for Windows 8.1 and Windows RT 8.1, via VC++ 2013:
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "ARM")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "Win32")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "x64")) { $DidAnyDLLBuildFail = $true }
|
||||
|
||||
# Build for Windows 10, via VC++ 2015
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "ARM")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "Win32")) { $DidAnyDLLBuildFail = $true }
|
||||
if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "x64")) { $DidAnyDLLBuildFail = $true }
|
||||
|
||||
# Build NuGet packages, if possible
|
||||
if ($DidAnyDLLBuildFail -eq $true) {
|
||||
Write-Warning -Message "Unable to build all variants. NuGet packages will not be built."
|
||||
$DidAnyNugetBuildFail = $true
|
||||
} else {
|
||||
$NugetPath = (Get-Command -CommandType Application nuget.exe | %{$_.Path}) 2> $null
|
||||
if ("$NugetPath" -eq "") {
|
||||
Write-Warning -Message "Unable to find nuget.exe. NuGet packages will not be built."
|
||||
$DidAnyNugetBuildFail = $true
|
||||
} else {
|
||||
Write-Host -ForegroundColor Cyan "Building SDL2 NuGet packages..."
|
||||
Write-Host -ForegroundColor Cyan "... via NuGet install: $NugetPath"
|
||||
$NugetOutputDir = "$PSScriptRoot\..\VisualC-WinRT\lib\nuget"
|
||||
Write-Host -ForegroundColor Cyan "... output directory: $NugetOutputDir"
|
||||
$SDLHGRevision = $($(hg log -l 1 --repository "$PSScriptRoot\.." | select-string "changeset") -Replace "changeset:\W*(\d+).*",'$1') 2>$null
|
||||
Write-Host -ForegroundColor Cyan "... HG Revision: $SDLHGRevision"
|
||||
|
||||
# Base options to nuget.exe
|
||||
$NugetOptions = @("pack", "PACKAGE_NAME_WILL_GO_HERE", "-Output", "$NugetOutputDir")
|
||||
|
||||
# Try attaching hg revision to NuGet package:
|
||||
$NugetOptions += "-Version"
|
||||
if ("$SDLHGRevision" -eq "") {
|
||||
Write-Warning -Message "Unable to find the Mercurial revision (maybe hg.exe can't be found?). NuGet packages will not have this attached to their name."
|
||||
$NugetOptions += "$SDLVersion-Unofficial"
|
||||
} else {
|
||||
$NugetOptions += "$SDLVersion.$SDLHGRevision-Unofficial"
|
||||
}
|
||||
|
||||
# Create NuGet output dir, if not yet created:
|
||||
if ($(Test-Path "$NugetOutputDir") -eq $false) {
|
||||
New-Item "$NugetOutputDir" -type directory
|
||||
}
|
||||
|
||||
# Package SDL2:
|
||||
$NugetOptions[1] = "$PSScriptRoot\..\VisualC-WinRT\SDL2-WinRT.nuspec"
|
||||
&"$NugetPath" $NugetOptions -Symbols
|
||||
if ( ! $? ) { $DidAnyNugetBuildFail = $true }
|
||||
|
||||
# Package SDL2main:
|
||||
$NugetOptions[1] = "$PSScriptRoot\..\VisualC-WinRT\SDL2main-WinRT-NonXAML.nuspec"
|
||||
&"$NugetPath" $NugetOptions
|
||||
if ( ! $? ) { $DidAnyNugetBuildFail = $true }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Let the script's caller know whether or not any errors occurred.
|
||||
# Exit codes compatible with Buildbot are used (1 for error, 0 for success).
|
||||
if ($DidAnyDLLBuildFail -eq $true) {
|
||||
Write-Error -Message "Unable to build all known variants of SDL2 for WinRT"
|
||||
exit 1
|
||||
} elseif ($DidAnyNugetBuildFail -eq $true) {
|
||||
Write-Warning -Message "Unable to build NuGet packages"
|
||||
exit 0 # Should NuGet package build failure lead to a non-failing result code instead?
|
||||
} else {
|
||||
exit 0
|
||||
}
|
Reference in New Issue
Block a user