Corrected header file documentation comment.

This commit is contained in:
Philipp Wiesemann 2014-11-22 22:20:40 +01:00
commit 9c398852e6
1896 changed files with 489150 additions and 0 deletions

135
build-scripts/androidbuild.sh Executable file
View file

@ -0,0 +1,135 @@
#!/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 ... "
echo "You can pass additional arguments to ndk-build with the NDKARGS variable: NDKARGS=\"-s\" androidbuild.sh ..."
exit 1
fi
SDLPATH="$( cd "$(dirname "$0")/.." ; pwd -P )"
NDKBUILD=`which ndk-build`
if [ -z "$NDKBUILD" ];then
echo "Could not find the ndk-build utility, install Android's NDK and add it to the path"
exit 1
fi
ANDROID=`which android`
if [ -z "$ANDROID" ];then
echo "Could not find the android utility, install Android's SDK and add it to the path"
exit 1
fi
ANT=`which ant`
if [ -z "$ANT" ];then
echo "Could not find the ant utility, install Android's SDK and add it to the path"
exit 1
fi
NCPUS="1"
case "$OSTYPE" in
darwin*)
NCPU=`sysctl -n hw.ncpu`
;;
linux*)
if [ -n `which nproc` ]; then
NCPUS=`nproc`
fi
;;
*);;
esac
APP="$1"
APPARR=(${APP//./ })
BUILDPATH="$SDLPATH/build/$APP"
# Start Building
rm -rf $BUILDPATH
mkdir -p $BUILDPATH
cp -r $SDLPATH/android-project/* $BUILDPATH
# Copy SDL sources
mkdir -p $BUILDPATH/jni/SDL
if [ -z "$COPYSOURCE" ]; then
ln -s $SDLPATH/src $BUILDPATH/jni/SDL
ln -s $SDLPATH/include $BUILDPATH/jni/SDL
else
cp -r $SDLPATH/src $BUILDPATH/jni/SDL
cp -r $SDLPATH/include $BUILDPATH/jni/SDL
fi
cp -r $SDLPATH/Android.mk $BUILDPATH/jni/SDL
sed -i "s|YourSourceHere.c|$MKSOURCES|g" $BUILDPATH/jni/src/Android.mk
sed -i "s|org\.libsdl\.app|$APP|g" $BUILDPATH/AndroidManifest.xml
# Copy user sources
for src in "${SOURCES[@]}"
do
cp $src $BUILDPATH/jni/src
done
# Create an inherited Activity
cd $BUILDPATH/src
for folder in "${APPARR[@]}"
do
mkdir -p $folder
cd $folder
done
ACTIVITY="${folder}Activity"
sed -i "s|SDLActivity|$ACTIVITY|g" $BUILDPATH/AndroidManifest.xml
sed -i "s|SDLActivity|$APP|g" $BUILDPATH/build.xml
# Fill in a default Activity
echo "package $APP;" > "$ACTIVITY.java"
echo "import org.libsdl.app.SDLActivity;" >> "$ACTIVITY.java"
echo "public class $ACTIVITY extends SDLActivity {}" >> "$ACTIVITY.java"
# Update project and build
cd $BUILDPATH
android update project --path $BUILDPATH
$NDKBUILD -j $NCPUS $NDKARGS
$ANT debug
cd $CURDIR
APK="$BUILDPATH/bin/$APP-debug.apk"
if [ -f "$APK" ]; then
echo "Your APK is ready at $APK"
echo "To install to your device: "
echo "cd $BUILDPATH"
echo "ant debug install"
exit 0
fi
echo "There was an error building the APK"
exit 1

View file

@ -0,0 +1,93 @@
#!/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-276"
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'"
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
# You might want to do this for CMake-backed builds instead...
PATH="$CHECKERDIR:$PATH" scan-build -o analysis cmake -DCMAKE_BUILD_TYPE=Debug ..
# ...or run configure without the scan-build wrapper...
#CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0" ../configure
# ...but this works for our buildbots just fine (EXCEPT ON LATEST MAC OS X).
#CFLAGS="-O0" PATH="$CHECKERDIR:$PATH" scan-build -o analysis ../configure
rm -rf analysis
PATH="$CHECKERDIR:$PATH" scan-build -o analysis $MAKE
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 ...

1541
build-scripts/config.guess vendored Normal file

File diff suppressed because it is too large Load diff

1813
build-scripts/config.sub vendored Normal file

File diff suppressed because it is too large Load diff

101
build-scripts/g++-fat.sh Executable file
View 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.5 \
-I/usr/local/include"
GCC_LINK_X86="-mmacosx-version-min=10.5"
# 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
build-scripts/gcc-fat.sh Executable file
View 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.5 runtime compatibility)
GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.5 \
-I/usr/local/include"
GCC_LINK_X86="-mmacosx-version-min=10.5"
# 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=1050 \
-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

323
build-scripts/install-sh Executable file
View file

@ -0,0 +1,323 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2005-02-02.21
# 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. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
chmodcmd="$chmodprog 0755"
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
dstarg=
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:
-c (ignored)
-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.
--help display this help and exit.
--version display version info and exit.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test -n "$1"; do
case $1 in
-c) shift
continue;;
-d) dir_arg=true
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
--help) echo "$usage"; exit $?;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t) dstarg=$2
shift
shift
continue;;
-T) no_target_directory=true
shift
continue;;
--version) echo "$0 $scriptversion"; exit $?;;
*) # When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
test -n "$dir_arg$dstarg" && break
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
break;;
esac
done
if test -z "$1"; 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
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
src=
if test -d "$dst"; then
mkdircmd=:
chmodcmd=
else
mkdircmd=$mkdirprog
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 "$dstarg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dstarg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# 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: $dstarg: Is a directory" >&2
exit 1
fi
dst=$dst/`basename "$src"`
fi
fi
# This sed command emulates the dirname command.
dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# Skip lots of stat calls in the usual case.
if test ! -d "$dstdir"; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
shift
IFS=$oIFS
pathcomp=
while test $# -ne 0 ; do
pathcomp=$pathcomp$1
shift
if test ! -d "$pathcomp"; then
$mkdirprog "$pathcomp"
# mkdir can fail with a `File exist' error in case several
# install-sh are creating the directory concurrently. This
# is OK.
test -d "$pathcomp" || exit
fi
pathcomp=$pathcomp/
done
fi
if test -n "$dir_arg"; then
$doit $mkdircmd "$dst" \
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
else
dstfile=`basename "$dst"`
# 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
trap '(exit $?); exit' 1 2 13 15
# Copy the file name to the temp name.
$doit $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 "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 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.
{
if test -f "$dstdir/$dstfile"; then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit 1
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
}
}
fi || { (exit 1); exit 1; }
done
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit 0
}
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

277
build-scripts/iosbuild.sh Executable file
View file

@ -0,0 +1,277 @@
#!/bin/sh
#
# Build a fat binary for iOS
# Based on fatbuild.sh and code from the Ignifuga Game Engine
# Number of CPUs (for make -j)
NCPU=`sysctl -n hw.ncpu`
if test x$NJOB = x; then
NJOB=$NCPU
fi
# SDK path
XCODE_PATH=`xcode-select --print-path`
if [ -z "$XCODE_PATH" ]; then
echo "Could not find XCode location (use xcode-select -switch to set the correct path)"
exit 1
fi
prepare_environment() {
ARCH=$1
if test x$SDK_VERSION = x; then
export SDK_VERSION=`xcodebuild -showsdks | grep iphoneos | sed "s|.*iphoneos||"`
if [ -z "$XCODE_PATH" ]; then
echo "Could not find a valid iOS SDK"
exit 1
fi
fi
case $ARCH in
armv6)
DEV_PATH="$XCODE_PATH/Platforms/iPhoneOS.platform/Developer"
SDK_PATH="$DEV_PATH/SDKs/iPhoneOS$SDK_VERSION.sdk"
;;
armv7)
DEV_PATH="$XCODE_PATH/Platforms/iPhoneOS.platform/Developer"
SDK_PATH="$DEV_PATH/SDKs/iPhoneOS$SDK_VERSION.sdk"
;;
i386)
DEV_PATH="$XCODE_PATH/Platforms/iPhoneSimulator.platform/Developer"
SDK_PATH="$DEV_PATH/SDKs/iPhoneSimulator$SDK_VERSION.sdk"
;;
*)
echo "Unknown Architecture $ARCH"
exit 1
;;
esac
if [ ! -d "$SDK_PATH" ]; then
echo "Could not find iOS SDK at $SDK_PATH"
exit 1
fi
if test x$MIN_OS_VERSION = x; then
export MIN_OS_VERSION="3.0"
fi
# Environment flags
CFLAGS="-g -O2 -pipe -no-cpp-precomp -isysroot $SDK_PATH \
-miphoneos-version-min=$MIN_OS_VERSION -I$SDK_PATH/usr/include/"
LDFLAGS="-L$SDK_PATH/usr/lib/ -isysroot $SDK_PATH \
-miphoneos-version-min=$MIN_OS_VERSION -static-libgcc"
export CXXFLAGS="$CFLAGS"
export CXXCPP="$DEV_PATH/usr/bin/llvm-cpp-4.2"
export CPP="$CXXCPP"
export CXX="$DEV_PATH/usr/bin/llvm-g++-4.2"
export CC="$DEV_PATH/usr/bin/llvm-gcc-4.2"
export LD="$DEV_PATH/usr/bin/ld"
export AR="$DEV_PATH/usr/bin/ar"
export AS="$DEV_PATH/usr/bin/ls"
export NM="$DEV_PATH/usr/bin/nm"
export RANLIB="$DEV_PATH/usr/bin/ranlib"
export STRIP="$DEV_PATH/usr/bin/strip"
# We dynamically load X11, so using the system X11 headers is fine.
CONFIG_FLAGS="--disable-shared --enable-static"
case $ARCH in
armv6)
export CONFIG_FLAGS="$CONFIG_FLAGS --host=armv6-apple-darwin"
export CFLAGS="$CFLAGS -arch armv6"
export LDFLAGS="$LDFLAGS -arch armv6"
;;
armv7)
export CONFIG_FLAGS="$CONFIG_FLAGS --host=armv7-apple-darwin"
export CFLAGS="$CFLAGS -arch armv7"
export LDFLAGS="$LDFLAGS -arch armv7"
;;
i386)
export CONFIG_FLAGS="$CONFIG_FLAGS --host=i386-apple-darwin"
export CFLAGS="$CFLAGS -arch i386"
export LDFLAGS="$LDFLAGS -arch i386"
;;
*)
echo "Unknown Architecture $ARCH"
exit 1
;;
esac
}
prepare_environment "armv6"
echo "Building with iOS SDK v$SDK_VERSION for iOS >= $MIN_OS_VERSION"
#
# Find the configure script
#
srcdir=`dirname $0`/..
srcdir=`cd $srcdir && pwd`
auxdir=$srcdir/build-scripts
cd $srcdir
#
# Figure out which phase to build:
# all,
# configure, configure-armv6, configure-armv7, configure-i386
# make, make-armv6, make-armv7, make-i386, merge
# clean
if test x"$1" = x; then
phase=all
else
phase="$1"
fi
case $phase in
all)
configure_armv6="yes"
configure_armv7="yes"
configure_i386="yes"
make_armv6="yes"
make_armv7="yes"
make_i386="yes"
merge="yes"
;;
configure)
configure_armv6="yes"
configure_armv7="yes"
configure_i386="yes"
;;
configure-armv6)
configure_armv6="yes"
;;
configure-armv7)
configure_armv7="yes"
;;
configure-i386)
configure_i386="yes"
;;
make)
make_armv6="yes"
make_armv7="yes"
make_i386="yes"
merge="yes"
;;
make-armv6)
make_armv6="yes"
;;
make-armv7)
make_armv7="yes"
;;
make-i386)
make_i386="yes"
;;
merge)
merge="yes"
;;
clean)
clean_armv6="yes"
clean_armv7="yes"
clean_i386="yes"
;;
clean-armv6)
clean_armv6="yes"
;;
clean-armv7)
clean_armv7="yes"
;;
clean-i386)
clean_i386="yes"
;;
*)
echo "Usage: $0 [all|configure[-armv6|-armv7|-i386]|make[-armv6|-armv7|-i386]|merge|clean[-armv6|-armv7|-i386]]"
exit 1
;;
esac
#
# Create the build directories
#
for dir in build build/armv6 build/armv7 build/i386; do
if test -d $dir; then
:
else
mkdir $dir || exit 1
fi
done
#
# Build the armv6 binary
#
prepare_environment "armv6"
if test x$configure_armv6 = xyes; then
(cd build/armv6 && \
sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2
# configure is not yet fully ready for iOS, some manual patching is required
cp include/* build/armv6/include
cp include/SDL_config_iphoneos.h build/armv6/include/SDL_config.h || exit 2
sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/armv6/Makefile || exit 2
sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/armv6/Makefile || exit 2
fi
if test x$make_armv6 = xyes; then
(cd build/armv6 && make -j$NJOB) || exit 3
fi
#
# Build the armv7 binary
#
prepare_environment "armv7"
if test x$configure_armv7 = xyes; then
(cd build/armv7 && \
sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2
# configure is not yet fully ready for iOS, some manual patching is required
cp include/* build/armv7/include
cp include/SDL_config_iphoneos.h build/armv7/include/SDL_config.h || exit 2
sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/armv7/Makefile || exit 2
sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/armv7/Makefile || exit 2
fi
if test x$make_armv7 = xyes; then
(cd build/armv7 && make -j$NJOB) || exit 3
fi
#
# Build the i386 binary
#
prepare_environment "i386"
if test x$configure_i386 = xyes; then
(cd build/i386 && \
sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2
# configure is not yet fully ready for iOS, some manual patching is required
cp include/* build/i386/include
cp include/SDL_config_iphoneos.h build/i386/include/SDL_config.h || exit 2
sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/i386/Makefile || exit 2
sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/i386/Makefile || exit 2
fi
if test x$make_i386 = xyes; then
(cd build/i386 && make -j$NJOB) || exit 3
fi
#
# Combine into fat binary
#
if test x$merge = xyes; then
output=ios/lib
sh $auxdir/mkinstalldirs build/$output
cd build
target=`find . -mindepth 4 -maxdepth 4 -type f -name '*.dylib' | head -1 | sed 's|.*/||'`
(lipo -create -o $output/libSDL2.a armv6/build/.libs/libSDL2.a armv7/build/.libs/libSDL2.a i386/build/.libs/libSDL2.a &&
lipo -create -o $output/libSDL2main.a armv6/build/libSDL2main.a armv7/build/libSDL2main.a i386/build/libSDL2main.a &&
cp -r armv6/include ios
echo "Build complete!" &&
echo "Files can be found under the build/ios directory.") || exit 4
cd ..
fi
#
# Clean up
#
do_clean()
{
echo $*
$* || exit 6
}
if test x$clean_armv6 = xyes; then
do_clean rm -r build/armv6
fi
if test x$clean_armv7 = xyes; then
do_clean rm -r build/armv7
fi
if test x$clean_i386 = xyes; then
do_clean rm -r build/i386
fi

9655
build-scripts/ltmain.sh Executable file

File diff suppressed because it is too large Load diff

99
build-scripts/mkinstalldirs Executable file
View file

@ -0,0 +1,99 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
errstatus=0
dirmode=""
usage="\
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
# process command line arguments
while test $# -gt 0 ; do
case "${1}" in
-h | --help | --h* ) # -h for help
echo "${usage}" 1>&2; exit 0 ;;
-m ) # -m PERM arg
shift
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
dirmode="${1}"
shift ;;
-- ) shift; break ;; # stop option processing
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
* ) break ;; # first non-opt arg
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
case $dirmode in
'')
if mkdir -p -- . 2>/dev/null; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
fi ;;
*)
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
fi ;;
esac
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
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: 3
# End:
# mkinstalldirs ends here

57
build-scripts/nacl-buildbot.sh Executable file
View file

@ -0,0 +1,57 @@
#!/bin/bash
# This is the script buildbot.libsdl.org uses to cross-compile SDL2 from
# amd64 Linux to NaCl.
export NACL_SDK_ROOT="/nacl_sdk/pepper_35"
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
build-scripts/naclbuild.sh Executable file
View 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

View 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-mir --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 ...";

7
build-scripts/showrev.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
#
# Print the current source revision, if available
# FIXME: this prints the tip, which isn't useful if you're on a different
# branch, or just not sync'd to the tip.
hg tip --template 'hg-{rev}:{node|short}' || (echo "hg-0:baadf00d"; exit 1)

21
build-scripts/strip_fPIC.sh Executable file
View 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

20
build-scripts/updaterev.sh Executable file
View 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

View 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%'";

View file

@ -0,0 +1,225 @@
#
# 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).
#
# 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"
}
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"
}
}
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\$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: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:
#
$DidAnyFail = $false
# Build for Windows Phone 8.0, via VC++ 2012:
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "ARM")) { $DidAnyFail = $true }
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "Win32")) { $DidAnyFail = $true }
# Build for Windows Phone 8.1, via VC++ 2013:
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "ARM")) { $DidAnyFail = $true }
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "Win32")) { $DidAnyFail = $true }
# Build for Windows 8.0 and Windows RT 8.0, via VC++ 2012:
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "ARM")) { $DidAnyFail = $true }
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "Win32")) { $DidAnyFail = $true }
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "x64")) { $DidAnyFail = $true }
# Build for Windows 8.1 and Windows RT 8.1, via VC++ 2013:
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "ARM")) { $DidAnyFail = $true }
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "Win32")) { $DidAnyFail = $true }
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "x64")) { $DidAnyFail = $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 ($DidAnyFail -eq $true) {
exit 1
} else {
exit 0
}