forked from dinhvh/libetpan
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfigure-ios.sh
executable file
·73 lines (60 loc) · 2.18 KB
/
configure-ios.sh
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
#!/bin/sh
set -ex
current_dir="$(dirname "$0")"
temp_dir="/tmp/libetpan"
cd $current_dir
rm -rf $temp_dir
mkdir -p $temp_dir
# Configure libetpan
cp -r ./* $temp_dir
pushd $temp_dir
# Build sasl2
xcodebuild build -scheme sasl2 -sdk iphonesimulator16.2 -destination "OS=16.2,name=iPhone 14" -derivedDataPath ./.build-ios
TARGET="iPhoneOS"
SDK_IOS_MIN_VERSION=10.0
DEVELOPER="$(xcode-select --print-path)"
SDK=$(xcrun --sdk iphoneos --show-sdk-path)
export CROSS_TOP="${SDK%%/SDKs/*}"
export CROSS_SDK="${SDK##*/SDKs/}"
if [ -z "$CROSS_TOP" -o -z "$CROSS_SDK" ]; then
echo "Failed to parse SDK path '${SDK}'!" >&1
exit 2
fi
# # Build OpenSSL with Shared library
# # Unforunetly SASL configure works only with shared library
mkdir -p $temp_dir/openssl
mkdir -p $temp_dir/openssl-install
OPENSSL_VERSION=1.1.1v
DOWNLOAD_URL_OPENSSL=https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
wget $DOWNLOAD_URL_OPENSSL -O openssl.tar.gz
tar -xvf openssl.tar.gz -C openssl --strip-components=1
pushd openssl
./Configure ios64-cross --prefix=$temp_dir/openssl-install
make && make install_sw
popd
TARGET_TRIPLE="arm64-apple-ios$SDK_IOS_MIN_VERSION"
HOST_TRIPLE="aarch64-apple-darwin"
MARCH="arm64"
# Prepare SASL2 install
mkdir -p ./sasl-install/lib
cp -r dependencies/sasl2/include sasl-install/
cp .build-ios/Build/Products/Debug-iphonesimulator/sasl2.o sasl-install/lib/
# Configure libetpan
./autogen.sh --with-curl=no --disable-db --with-expat=no --host=$TARGET_TRIPLE --with-openssl=./openssl-install --with-sasl=./sasl-install --enable-iconv --with-poll
pushd include
make
popd
popd
cp $temp_dir/config.h ./config/ios
cp -r -L $temp_dir/include/libetpan ./include
rm -rf ./include/libetpan/clientid.h
rm -rf ./include/libetpan/imapdriver_tools.h
rm -rf ./include/libetpan/imapdriver_tools_private.h
rm -rf ./include/libetpan/mail.h
rm -rf ./include/libetpan/mailstream_compress.h
rm -rf ./include/libetpan/mailstream_parser.h
rm -rf ./include/libetpan/mailstream_sender.h
rm -rf ./include/libetpan/namespace_parser.h
rm -rf ./include/libetpan/namespace_sender.h
rm -rf ./include/libetpan/quota_parser.h
rm -rf ./include/libetpan/quota_sender.h