-
Notifications
You must be signed in to change notification settings - Fork 284
Expand file tree
/
Copy pathupdate_libssh2_ios
More file actions
executable file
·55 lines (41 loc) · 2.01 KB
/
update_libssh2_ios
File metadata and controls
executable file
·55 lines (41 loc) · 2.01 KB
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
#!/bin/bash
set -e
# source the common build functions
SCRIPT_DIR=$(dirname "$0")
source "${SCRIPT_DIR}/ios_build_functions.sh"
function setup ()
{
if [ -f "${ROOT_PATH}/External/libssh2-ios/lib/libssh2-ios.a" ]
then
echo "No update needed."
exit 0
fi
LIBRARY_NAME="libssh2"
}
function build_ssh2 ()
{
mkdir -p "${ROOT_PATH}/External/libssh2-ios/lib" "${ROOT_PATH}/External/libssh2-ios/lib" "${ROOT_PATH}/External/libssh2-ios/src"
rm -rf "${ROOT_PATH}/External/libssh2-ios/src/libssh2"
cp -R "${ROOT_PATH}/External/libssh2" "${ROOT_PATH}/External/libssh2-ios/src/"
pushd "${ROOT_PATH}/External/libssh2-ios/src/libssh2" > /dev/null
export CFLAGS="-arch ${ARCH} -fembed-bitcode -pipe -no-cpp-precomp -isysroot ${SDKROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}"
export CPPFLAGS="-arch ${ARCH} -fembed-bitcode -pipe -no-cpp-precomp -isysroot ${SDKROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}"
mkdir -p "${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk"
LOG="${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk/build-libssh2.log"
echo "${LOG}"
./buildconf >> "${LOG}" 2>&1
./configure --host=${HOST} --prefix="${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk" --with-openssl --with-libssl-prefix="${ROOT_PATH}/External/ios-openssl" --disable-shared --enable-static >> "${LOG}" 2>&1
make >> "${LOG}" 2>&1
make install >> "${LOG}" 2>&1
popd > /dev/null
BUILT_LIBS+=("${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk/lib/libssh2.a")
}
function fat_binary ()
{
echo "Building fat binary..."
lipo -create "${BUILT_LIBS[@]}" -output "${ROOT_PATH}/External/libssh2-ios/lib/libssh2-ios.a"
mkdir -p "${ROOT_PATH}/External/libssh2-ios/include/libssh2"
cp -R "${ROOT_PATH}/External/libssh2-ios/bin/iphonesimulator${SDKVERSION}-i386.sdk/include/libssh2.h" "${ROOT_PATH}/External/libssh2-ios/include/libssh2/"
echo "Building done."
}
build_all_archs setup build_ssh2 fat_binary