mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-24 05:29:12 +00:00
Fixes #2022, do not resume on Android when surfaceChanged
If the app is in landscape mode and the user presses the power button, a pause is followed immediately by a surfaceChanged event because the lock screen is shown in portrait mode. This triggers a "false" resume. So, we just pause and resume following the onWindowFocusChanged events. Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before blocking the event pump.
This commit is contained in:
commit
dad420670f
859 changed files with 310893 additions and 0 deletions
1537
build-scripts/config.guess
vendored
Normal file
1537
build-scripts/config.guess
vendored
Normal file
File diff suppressed because it is too large
Load diff
1786
build-scripts/config.sub
vendored
Normal file
1786
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
101
build-scripts/g++-fat.sh
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.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) 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
102
build-scripts/gcc-fat.sh
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.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) 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
323
build-scripts/install-sh
Executable 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
277
build-scripts/iosbuild.sh
Executable 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
9655
build-scripts/ltmain.sh
Executable file
File diff suppressed because it is too large
Load diff
99
build-scripts/mkinstalldirs
Executable file
99
build-scripts/mkinstalldirs
Executable 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
|
7
build-scripts/showrev.sh
Executable file
7
build-scripts/showrev.sh
Executable 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
21
build-scripts/strip_fPIC.sh
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
|
20
build-scripts/updaterev.sh
Executable file
20
build-scripts/updaterev.sh
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
|
Loading…
Add table
Add a link
Reference in a new issue