This repository has been archived by the owner on Aug 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathios-configure
executable file
·141 lines (120 loc) · 4.2 KB
/
ios-configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
# ios-configure runs a "configure" script using the iOS 4.3 SDK, generating a
# static library that will load and run on your choice of iPhone, iPad, and
# their respective simulators.
#
# Simply run in the same directory as a "configure" script.
# You can run this script for multiple targets and use lipo(1) to stitch them
# together into a universal library.
#
# Collected and maintained by Nolan Waite ([email protected])
#
# Magic compiler flags and incantations by Michael Aaron Safyan
# ([email protected]). Generality by Christopher J. Stawarz
# (http://pseudogreen.org/bzr/sandbox/iphone/build_for_iphoneos)
#
default_gcc_version=4.2
default_ios_version=`xcodebuild -showsdks | grep iphoneos | sed -e 's/.*iphoneos//' | tail -n 1`
default_min_ios_version=4.3
default_macosx_version=10.6
DEVELOPER=${DEVELOPER:-`xcode-select -print-path`}
GCC_VERSION="${GCC_VERSION:-$default_gcc_version}"
export IOS_VERSION="${IOS_VERSION:-$default_ios_version}"
export MIN_IOS_VERSION="${MIN_IOS_VERSION:-$default_min_ios_version}"
export MACOSX_VERSION="${MACOSX_VERSION:-$default_macosx_version}"
usage ()
{
cat >&2 << EOF
Usage: ${0##*/} [-h] [-p prefix] target [configure_args]
-h Print help message
-p Installation prefix
(default: `pwd`/build/[target]-[version])
-k The pkgconfig directory.
The target must be one of "iphone", "ipad", or "simulator". Any additional
arguments are passed to configure.
The following environment variables affect the build process:
GCC_VERSION (default: $default_gcc_version)
IOS_VERSION (default: $default_ios_version)
MIN_IOS_VERSION (default: $default_min_ios_version)
MACOSX_VERSION (default: $default_macosx_version)
EOF
}
extra_pkg_config=""
while getopts ":hp:tk:" opt; do
case $opt in
h ) usage ; exit 0 ;;
p ) prefix="$OPTARG" ;;
k ) extra_pkg_config="$OPTARG:" ;;
\? ) usage ; exit 2 ;;
esac
done
shift $(( $OPTIND - 1 ))
if (( $# < 1 )); then
usage
exit 2
fi
target=$1
shift
case $target in
iphone-armv7s )
arch=armv7s
platform=iPhoneOS
host=arm-apple-darwin10
;;
iphone )
arch=armv7
platform=iPhoneOS
host=arm-apple-darwin10
;;
ipad )
arch=armv7
platform=iPhoneOS
host=arm-apple-darwin10
;;
simulator )
arch=i686
platform=iPhoneSimulator
host=i686-apple-darwin9
;;
* )
usage
exit 2
esac
export DEVROOT="${DEVELOPER}/Platforms/${platform}.platform/Developer"
export SDKROOT="$DEVROOT/SDKs/${platform}${IOS_VERSION}.sdk"
prefix="${prefix:-`pwd`/build/${target}-${IOS_VERSION}}"
if [ ! \( -d "$DEVROOT" \) ] ; then
echo "The iPhone SDK could not be found. Folder \"$DEVROOT\" does not exist."
exit 1
fi
if [ ! \( -d "$SDKROOT" \) ] ; then
echo "The iPhone SDK could not be found. Folder \"$SDKROOT\" does not exist."
exit 1
fi
if [ ! \( -x "./configure" \) ] ; then
echo "This script must be run in the folder containing the \"configure\" script."
exit 1
fi
export PKG_CONFIG_PATH="${extra_pkg_config}$SDKROOT/usr/lib/pkgconfig"
export PKG_CONFIG_LIBDIR="$PKG_CONFIG_PATH"
export AS="$DEVROOT/usr/bin/as"
export ASCPP="$DEVROOT/usr/bin/as"
export AR="$DEVROOT/usr/bin/ar"
export RANLIB="$DEVROOT/usr/bin/ranlib"
export CPPFLAGS="-miphoneos-version-min=${MIN_IOS_VERSION} -pipe -no-cpp-precomp -I$SDKROOT/usr/include"
export CFLAGS="$CPPFLAGS -g2 -std=c99 -arch ${arch} -isysroot $SDKROOT -isystem $SDKROOT/usr/include"
export CXXFLAGS="$CPPFLAGS -g2 -arch ${arch} -isysroot $SDKROOT -isystem $SDKROOT/usr/include"
export LDFLAGS="-miphoneos-version-min=${MIN_IOS_VERSION} -arch ${arch} -isysroot $SDKROOT -L$SDKROOT/usr/lib -L$DEVROOT/usr/lib"
export CPP="$DEVROOT/usr/bin/llvm-cpp-${GCC_VERSION}"
export CXXCPP="$DEVROOT/usr/bin/llvm-cpp-${GCC_VERSION}"
export CC="$DEVROOT/usr/bin/llvm-gcc-${GCC_VERSION}"
export CXX="$DEVROOT/usr/bin/llvm-g++-${GCC_VERSION}"
export LD="$DEVROOT/usr/bin/ld"
export STRIP="$DEVROOT/usr/bin/strip"
export ac_cv_func_malloc_0_nonnull=yes
./configure \
--prefix="$prefix" \
--host="${host}" \
--enable-static \
--disable-shared \
"$@" || exit