-
Notifications
You must be signed in to change notification settings - Fork 4
/
idz_configure
executable file
·107 lines (91 loc) · 2.6 KB
/
idz_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
#!/bin/bash
IDZ_SAVE_DIR=`pwd`
IDZ_SCRIPT_NAME=`basename $0`
# Print usage information and exit
idz_usage()
{
cd $IDZ_SAVE_DIR
echo "Usage: $IDZ_SCRIPT_NAME arch sdk_version configure_path"
echo " Where arch is one of i386, x86_64, armv7, armv7s, arm64"
exit 1
}
# Print error message and exit
idz_error()
{
cd $IDZ_SAVE_DIR
echo $1
exit 1
}
# Test if the last command failed and call idz_error if appropriate
idz_check_error()
{
if [ $? -ne 0 ] ; then
idz_error $1
fi
}
# Print usage if too few arguments
if [ $# -lt 3 ] ; then
idz_usage
fi
# Transfer arguments to more meaningful names
IDZ_ARCH=$1
IDZ_SDK_VERSION=$2
IDZ_CONFIGURE=$3
# IDZ_PLATFORM and IDZ_HOST only depend on IDZ_ARCH
case $IDZ_ARCH in
i386 | x86_64 )
IDZ_PLATFORM=iPhoneSimulator
IDZ_HOST=$IDZ_ARCH-apple-darwin10
IDZ_SDK_PLATFORM=iphonesimulator
IDZ_IOS_VERSION=ios-simulator-version-min=7.0
;;
armv6 | armv7 | armv7s | arm64 )
IDZ_PLATFORM=iPhoneOS
IDZ_HOST=arm-apple-darwin10
IDZ_SDK_PLATFORM=iphoneos
IDZ_IOS_VERSION=iphoneos-version-min=7.0
;;
* )
echo "Unrecognised architecture $IDZ_ARCH"
idz_usage
;;
esac
# Convert a possible relative path to configure to an absolute path
case $IDZ_CONFIGURE in
/* )
;;
* )
IDZ_CONFIGURE=`pwd`/$IDZ_CONFIGURE
;;
esac
# Derive the environment variables
IDZ_XCODE_ROOT=`xcode-select -print-path`
IDZ_PLATFORM_PATH=$IDZ_XCODE_ROOT/Platforms/$IDZ_PLATFORM.platform/Developer
IDZ_SDK_PATH=$IDZ_PLATFORM_PATH/SDKs/$IDZ_PLATFORM$IDZ_SDK_VERSION.sdk
IDZ_FLAGS="-isysroot $IDZ_SDK_PATH -arch $IDZ_ARCH -m$IDZ_IOS_VERSION -fembed-bitcode"
IDZ_PLATFORM_BIN_PATH=$IDZ_PLATFORM_PATH/usr/bin
CC=`xcrun -sdk $IDZ_SDK_PLATFORM$IDZ_SDK_VERSION -find clang`
CXX=`xcrun -sdk $IDZ_SDK_PLATFORM$IDZ_SDK_VERSION -find clang++`
CFLAGS=$IDZ_FLAGS
CXXFLAGS=$IDZ_FLAGS
LDFLAGS=$IDZ_FLAGS
export CC CXX CFLAGS CXXFLAGS LDFLAGS
# Derive the command line arguments
IDZ_PREFIX=$IDZ_SAVE_DIR/install-$IDZ_PLATFORM-$IDZ_ARCH
IDZ_CONFIGURE_FLAGS="--host=$IDZ_HOST \
--prefix=$IDZ_PREFIX \
--disable-shared \
$IDZ_EXTRA_CONFIGURE_FLAGS"
IDZ_BUILD=$IDZ_SAVE_DIR/build-$IDZ_PLATFORM-$IDZ_ARCH
mkdir -p $IDZ_BUILD
cd $IDZ_BUILD
IDZ_SAVE_DIR=$IDZ_BUILD
echo "IDZ_CONFIGURE_FLAGS=$IDZ_CONFIGURE_FLAGS"
$IDZ_CONFIGURE $IDZ_CONFIGURE_FLAGS | tee configure_$IDZ_ARCH.log 2>&1
make clean | tee make_clean_$IDZ_ARCH.log 2>&1
idz_check_error "Make clean failed."
make | tee make_$IDZ_ARCH.log 2>&1
idz_check_error "Build failed."
make install | tee make_install_$IDZ_ARCH.log 2>&1
idz_check_error "Install failed."
cd $IDZ_SAVE_DIR