-
Notifications
You must be signed in to change notification settings - Fork 283
Expand file tree
/
Copy pathupdate_libssh2_ios
More file actions
executable file
·53 lines (39 loc) · 1.64 KB
/
update_libssh2_ios
File metadata and controls
executable file
·53 lines (39 loc) · 1.64 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
#!/bin/bash
set -e
# source the common build functions
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
source "${SCRIPT_DIR}/ios_build_functions.sh"
function setup ()
{
if [ -f "${INSTALL_PATH}/lib/libssh2.a" ]
then
echo "No update needed."
exit 0
fi
LIBRARY_NAME="libssh2"
}
function build_ssh2 ()
{
cp -R "${ROOT_PATH}/External/libssh2" "${ARCH_INSTALL_PATH}/libssh2"
pushd "${ARCH_INSTALL_PATH}/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}"
./buildconf >> "${LOG}" 2>&1
./configure --host=${HOST} --prefix="${ARCH_INSTALL_PATH}" --with-openssl --with-libssl-prefix="${INSTALL_PATH}" --disable-shared --enable-static >> "${LOG}" 2>&1
make >> "${LOG}" 2>&1
make install >> "${LOG}" 2>&1
popd > /dev/null
rm -rf "${ARCH_INSTALL_PATH}/libssh2"
BUILT_LIBS+=("${ARCH_INSTALL_PATH}/lib/libssh2.a")
}
function fat_binary ()
{
echo "Copying headers & pkg-config files"
cp -r "${ARCH_INSTALL_PATH}"/include/libssh*.h "${INSTALL_PATH}/include/"
cp "${ARCH_INSTALL_PATH}/lib/pkgconfig/libssh2.pc" "${INSTALL_PATH}/lib/pkgconfig/"
perl -i -pe "s|^(prefix=${INSTALL_PATH}).*$|\$1|g" "${INSTALL_PATH}/lib/pkgconfig/libssh2.pc" >> "${LOG}" 2>&1
echo "Building fat binary..."
lipo -create "${BUILT_LIBS[@]}" -output "${INSTALL_PATH}/lib/libssh2.a"
echo "Building done."
}
build_all_archs setup build_ssh2 fat_binary