22
33set -e
44
5- if [ -f " lib/libssh2.a" ]
6- then
5+ if [ -f " lib/libssh2.a" ]; then
76 echo " No update needed."
87 exit 0
98fi
@@ -17,57 +16,59 @@ DEVELOPER="/Applications/Xcode.app/Contents/Developer"
1716
1817mkdir -p libssh2-ios/lib libssh2-ios/lib libssh2-ios/src
1918
20- for ARCH in ${ARCHS}
21- do
22- if [ " ${ARCH} " == " i386" ];
23- then
24- PLATFORM=" iPhoneSimulator"
25- else
26- PLATFORM=" iPhoneOS"
27- fi
28- echo " Building libssh2 for ${PLATFORM} ${SDKVERSION} ${ARCH} "
29- echo " Please stand by..."
30- cp -R libssh2 libssh2-ios/src/
31- cd libssh2-ios/src/libssh2
32-
33- export DEVROOT=" ${DEVELOPER} /Platforms/${PLATFORM} .platform/Developer"
34- export SDKROOT=" ${DEVROOT} /SDKs/${PLATFORM}${SDKVERSION} .sdk"
35- export LD=${DEVROOT} /usr/bin/ld
36- if [ " ${ARCH} " == " i386" ];
37- then
38- export CC=${DEVROOT} /usr/bin/gcc
39- export CPP=${DEVROOT} /usr/bin/cpp
40- export CXX=${DEVROOT} /usr/bin/g++
41- export CXXCPP=$DEVROOT /usr/bin/cpp
42- else
43- export CC=${DEVROOT} /usr/bin/gcc
44- export CXX=${DEVROOT} /usr/bin/g++
45- fi
46- export AR=${DEVROOT} /usr/bin/ar
47- export AS=${DEVROOT} /usr/bin/as
48- export NM=${DEVROOT} /usr/bin/nm
49- export RANLIB=$DEVROOT /usr/bin/ranlib
50- export LDFLAGS=" -arch ${ARCH} -pipe -no-cpp-precomp -isysroot ${SDKROOT} -L${CURRENTPATH} /libssh2-ios/bin/${PLATFORM}${SDKVERSION} -${ARCH} .sdk/lib"
51- export CFLAGS=" -arch ${ARCH} -pipe -no-cpp-precomp -isysroot ${SDKROOT} -I${CURRENTPATH} /libssh2-ios/bin/${PLATFORM}${SDKVERSION} -${ARCH} .sdk/include"
52- export CXXFLAGS=" -arch ${ARCH} -pipe -no-cpp-precomp -isysroot ${SDKROOT} -I${CURRENTPATH} /libssh2-ios/bin/${PLATFORM}${SDKVERSION} -${ARCH} .sdk/include"
19+ for ARCH in ${ARCHS} ; do
20+
21+ if [ " ${ARCH} " == " i386" ]; then
22+ PLATFORM=" iPhoneSimulator"
23+ else
24+ PLATFORM=" iPhoneOS"
25+ fi
26+
27+ echo " Building libssh2 for ${PLATFORM} ${SDKVERSION} ${ARCH} "
28+ echo " Please stand by..."
5329
54- mkdir -p " ${CURRENTPATH} /libssh2-ios/bin/${PLATFORM}${SDKVERSION} -${ARCH} .sdk"
30+ cp -R libssh2 libssh2-ios/src/
31+ cd libssh2-ios/src/libssh2
5532
56- LOG=" ${CURRENTPATH} /libssh2-ios/bin/${PLATFORM}${SDKVERSION} -${ARCH} .sdk/build-libssh2.log"
57- echo ${CURRENTPATH} /libssh2-ios/bin/${PLATFORM}${SDKVERSION} -${ARCH} .sdk
33+ export DEVROOT=" ${DEVELOPER} /Platforms/${PLATFORM} .platform/Developer"
34+ export SDKROOT=" ${DEVROOT} /SDKs/${PLATFORM}${SDKVERSION} .sdk"
35+ export LD=${DEVROOT} /usr/bin/ld
5836
59- ./buildconf >> " ${LOG} " 2>&1
60- ./configure --host=${ARCH} -apple-darwin --prefix=" ${CURRENTPATH} /libssh2-ios/bin/${PLATFORM}${SDKVERSION} -${ARCH} .sdk" -with-openssl --with-libssl-prefix=${CURRENTPATH} /ios-openssl --disable-shared --enable-static >> " ${LOG} " 2>&1
37+ if [ " ${ARCH} " == " i386" ]; then
38+ export CC=${DEVROOT} /usr/bin/gcc
39+ export CPP=${DEVROOT} /usr/bin/cpp
40+ export CXX=${DEVROOT} /usr/bin/g++
41+ export CXXCPP=$DEVROOT /usr/bin/cpp
42+ else
43+ export CC=${DEVROOT} /usr/bin/gcc
44+ export CXX=${DEVROOT} /usr/bin/g++
45+ fi
6146
62- make >> " ${LOG} " 2>&1
63- make install >> " ${LOG} " 2>&1
64- cd ${CURRENTPATH}
65- rm -rf libssh2-ios/src/libssh2
47+ export AR=${DEVROOT} /usr/bin/ar
48+ export AS=${DEVROOT} /usr/bin/as
49+ export NM=${DEVROOT} /usr/bin/nm
50+ export RANLIB=$DEVROOT /usr/bin/ranlib
51+ export LDFLAGS=" -arch ${ARCH} -pipe -no-cpp-precomp -isysroot ${SDKROOT} -L${CURRENTPATH} /libssh2-ios/bin/${PLATFORM}${SDKVERSION} -${ARCH} .sdk/lib"
52+ export CFLAGS=" -arch ${ARCH} -pipe -no-cpp-precomp -isysroot ${SDKROOT} -I${CURRENTPATH} /libssh2-ios/bin/${PLATFORM}${SDKVERSION} -${ARCH} .sdk/include"
53+ export CXXFLAGS=" -arch ${ARCH} -pipe -no-cpp-precomp -isysroot ${SDKROOT} -I${CURRENTPATH} /libssh2-ios/bin/${PLATFORM}${SDKVERSION} -${ARCH} .sdk/include"
6654
55+ echo ${CURRENTPATH} /libssh2-ios/bin/${PLATFORM}${SDKVERSION} -${ARCH} .sdk
56+
57+ mkdir -p " ${CURRENTPATH} /libssh2-ios/bin/${PLATFORM}${SDKVERSION} -${ARCH} .sdk"
58+ LOG=" ${CURRENTPATH} /libssh2-ios/bin/${PLATFORM}${SDKVERSION} -${ARCH} .sdk/build-libssh2.log"
59+ ./buildconf >> " ${LOG} " 2>&1
60+ ./configure --host=${ARCH} -apple-darwin --prefix=" ${CURRENTPATH} /libssh2-ios/bin/${PLATFORM}${SDKVERSION} -${ARCH} .sdk" -with-openssl --with-libssl-prefix=${CURRENTPATH} /ios-openssl --disable-shared --enable-static >> " ${LOG} " 2>&1
61+ make >> " ${LOG} " 2>&1
62+ make install >> " ${LOG} " 2>&1
63+
64+ cd ${CURRENTPATH}
65+ rm -rf libssh2-ios/src/libssh2
6766done
6867
6968echo " Build library..."
69+
7070lipo -create ${CURRENTPATH} /libssh2-ios/bin/iPhoneSimulator${SDKVERSION} -i386.sdk/lib/libssh2.a ${CURRENTPATH} /libssh2-ios/bin/iPhoneOS${SDKVERSION} -armv7.sdk/lib/libssh2.a ${CURRENTPATH} /libssh2-ios/bin/iPhoneOS${SDKVERSION} -armv7s.sdk/lib/libssh2.a -output ${CURRENTPATH} /libssh2-ios/lib/libssh2.a
7171mkdir -p ${CURRENTPATH} /libssh2-ios/include/libssh2
7272cp -R ${CURRENTPATH} /libssh2-ios/bin/iPhoneSimulator${SDKVERSION} -i386.sdk/include/libssh2* ${CURRENTPATH} /libssh2-ios/include/libssh2/
73+
7374echo " Building done."
0 commit comments