Skip to content

Commit a9650bc

Browse files
committed
Fixed compiling for iphonesimulator in Release
1 parent 25433b6 commit a9650bc

2 files changed

Lines changed: 32 additions & 6 deletions

File tree

Scripts/build_openssl.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
OPENSSL_TARBALL="$SRCROOT/openssl-$OPENSSL_VERSION.tar.gz"
22
OPENSSL_SRC="$TARGET_TEMP_DIR/openssl/"
33
LIB_PRODUCT_NAME="$FULL_PRODUCT_NAME"
4+
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
5+
6+
if [ "$PLATFORM_NAME" == "" ]; then
7+
echo "PLATFORM_NAME not defined"
8+
fi
49

510
# check whether libcrypto.a already exists - we'll only build if it does not
611
if [ -f "$TARGET_BUILD_DIR/$LIB_PRODUCT_NAME" ]; then
@@ -19,17 +24,15 @@ fi
1924
echo "Extracting $OPENSSL_TARBALL..."
2025
mkdir -p "$OPENSSL_SRC"
2126
tar -C "$OPENSSL_SRC" --strip-components=1 -zxf "$OPENSSL_TARBALL" || exit 1
22-
23-
if [ "$PLATFORM_NAME" == "" ]; then
24-
echo "PLATFORM_NAME not defined"
25-
fi
27+
cd "$OPENSSL_SRC"
28+
patch -p1 < "$SCRIPTS_DIR/iossimulator_patch.diff"
2629

2730
CC="xcrun -sdk $PLATFORM_NAME cc"
2831
OPENSSL_OPTIONS="no-shared $OPENSSL_OPTIONS"
2932

3033
echo "Creating $LIB_PRODUCT_NAME with $OPENSSL_OPTIONS for architectures: $ARCHS"
3134

32-
cd "$OPENSSL_SRC"
35+
3336

3437
for BUILDARCH in $ARCHS
3538
do
@@ -50,7 +53,11 @@ do
5053
CONFIGURE_OPTIONS="ios64-xcrun $OPENSSL_OPTIONS"
5154
fi
5255
elif [ "$PLATFORM_NAME" = "iphonesimulator" ]; then
53-
CONFIGURE_OPTIONS="iossimulator-xcrun $OPENSSL_OPTIONS"
56+
if [ "$BUILDARCH" = "i386" ]; then
57+
CONFIGURE_OPTIONS="iossimulator-xcrun $OPENSSL_OPTIONS"
58+
elif [ "$BUILDARCH" = "x86_64" ]; then
59+
CONFIGURE_OPTIONS="iossimulator64-xcrun $OPENSSL_OPTIONS"
60+
fi
5461
else
5562
echo "Unsupported platform $PLATFORM_NAME"
5663
exit 1

Scripts/iossimulator_patch.diff

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
diff --git a/Configurations/15-ios.conf b/Configurations/15-ios.conf
2+
index aff909620f..033d94b8c7 100644
3+
--- a/Configurations/15-ios.conf
4+
+++ b/Configurations/15-ios.conf
5+
@@ -29,6 +29,14 @@ my %targets = (
6+
"iossimulator-xcrun" => {
7+
inherit_from => [ "darwin-common" ],
8+
CC => "xcrun -sdk iphonesimulator cc",
9+
+ cflags => add("-arch i386"),
10+
+ sys_id => "iOS",
11+
+ disable => [ "engine" ],
12+
+ },
13+
+ "iossimulator64-xcrun" => {
14+
+ inherit_from => [ "darwin-common" ],
15+
+ CC => "xcrun -sdk iphonesimulator cc",
16+
+ cflags => add("-arch x86_64"),
17+
sys_id => "iOS",
18+
disable => [ "engine" ],
19+
},

0 commit comments

Comments
 (0)