Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
bin
src
bin/
build/
src/
*.gz
libssh2-*/
libssh2-for-iOS.xcodeproj/project.xcworkspace/xcuserdata
libssh2-for-iOS.xcodeproj/xcuserdata
lib
lib/
*.xccheckout
openssl.framework
include/
Expand Down
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
osx_image: xcode9.2
osx_image: xcode11.3
language: objective-c

before_install:
before_install:

script:
- ./build-all.sh openssl
- xcrun -sdk iphoneos lipo -info libssh2.framework/libssh2
- xcrun -sdk iphoneos lipo -info openssl.framework/openssl
script:
- ./build-all.sh openssl
- xcrun -sdk iphoneos lipo -info libssh2.framework/libssh2
- xcrun -sdk iphoneos lipo -info openssl.framework/openssl
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ You can build the libssh2 library with openssl or with libgcrypt!
- Xcode 7.1
- Xcode Command Line Tools

brew install automake autoconf libssh2

Be sure to include libssh2 headers. Brew recommends steps to do so:

If you need to have openssl@1.1 first in your PATH run:

echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:

export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"


## Readme
### Checkout the submodules:
```bash
Expand Down
18 changes: 9 additions & 9 deletions build-all.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/bash -x -e

# Automatic build script for libssh2
# Automatic build script for libssh2
# for iPhoneOS and iPhoneSimulator
#
# Created by Felix Schulze on 01.02.11.
Expand All @@ -20,30 +20,30 @@
#
if [ "$1" == "openssl" ];
then
echo "Building openssl:"
# ./openssl/build-libssl.sh --version=1.1.0j --deprecated $2
./openssl/build-libssl.sh $2
echo "Building openssl: $2"
./build-libssl.sh --archs="x86_64 arm64" --targets="ios-sim-cross-x86_64 ios64-cross-arm64" $2
# Make dynamic framework, with embed-bitcode, iOS + Simulator:
rm -rf build
rm -rf openssl.framework
xcodebuild -project libssh2-for-iOS.xcodeproj -target openssl -sdk iphoneos -configuration Debug
xcodebuild -project libssh2-for-iOS.xcodeproj -UseModernBuildSystem=NO -target openssl -sdk iphoneos -configuration Debug
mkdir -p build/Debug-iphoneos/openssl.framework/Headers/
cp include/openssl/* build/Debug-iphoneos/openssl.framework/Headers/
xcodebuild -project libssh2-for-iOS.xcodeproj -target openssl -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=10.0' -arch x86_64 -arch i386 -configuration Debug
xcodebuild -project libssh2-for-iOS.xcodeproj -UseModernBuildSystem=NO -target openssl -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=13.4' -arch x86_64 -arch arm64 -configuration Debug
mkdir -p build/Debug-iphonesimulator/openssl.framework/Headers/
cp include/openssl/* build/Debug-iphonesimulator/openssl.framework/Headers/
cp -r build/Debug-iphoneos/openssl.framework .
lipo -create -output openssl.framework/openssl build/Debug-iphonesimulator/openssl.framework/openssl build/Debug-iphoneos/openssl.framework/openssl
# if you don't need bitcode, use this line instead:
# ./openssl/create-openssl-framework.sh dynamic

echo "Build libssh2:"
./build-libssh2.sh openssl
# Make dynamic framework, with embed-bitcode, iOS + Simulator:
rm -rf libssh2.framework
xcodebuild -project libssh2-for-iOS.xcodeproj -target libssh2 -sdk iphoneos -configuration Debug
xcodebuild -UseModernBuildSystem=NO -project libssh2-for-iOS.xcodeproj -target libssh2 -sdk iphoneos -configuration Debug
mkdir -p build/Debug-iphoneos/libssh2.framework/Headers/
cp include/libssh2/* build/Debug-iphoneos/libssh2.framework/Headers/
xcodebuild -project libssh2-for-iOS.xcodeproj -target libssh2 -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=10.0' -arch x86_64 -arch i386 -configuration Debug
xcodebuild -UseModernBuildSystem=NO -project libssh2-for-iOS.xcodeproj -target libssh2 -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=13.4' -arch x86_64 -arch i386 -configuration Debug
mkdir -p build/Debug-iphonesimulator/libssh2.framework/Headers/
cp include/libssh2/* build/Debug-iphonesimulator/libssh2.framework/Headers/
cp -r build/Debug-iphoneos/libssh2.framework .
Expand Down
43 changes: 18 additions & 25 deletions build-libssh2.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/bash -x -e

# Automatic build script for libssh2
# Automatic build script for libssh2
# for iPhoneOS and iPhoneSimulator
#
# Created by Felix Schulze on 02.02.11.
Expand All @@ -21,27 +21,27 @@
###########################################################################
# Change values here
#
VERSION="1.8.0"
VERSION="1.9.0"
#
###########################################################################
#
# Don't change anything here
SDKVERSION=`xcrun -sdk iphoneos --show-sdk-version`
SDKVERSION=`xcrun -sdk iphoneos --show-sdk-version`
CURRENTPATH=`pwd`
ARCHS="i386 x86_64 armv7 armv7s arm64"
ARCHS="x86_64 arm64"
DEVELOPER=`xcode-select -print-path`
##########
set -e
if [ ! -e libssh2-${VERSION}.tar.gz ]; then
echo "Downloading libssh2-${VERSION}.tar.gz"
curl -O https://www.libssh2.org/download/libssh2-${VERSION}.tar.gz
curl --fail -O https://www.libssh2.org/download/libssh2-${VERSION}.tar.gz
else
echo "Using libssh2-${VERSION}.tar.gz"
fi

echo "Checking file: libssh2-${VERSION}.tar.gz"
md5=`md5 -q libssh2-${VERSION}.tar.gz`
if [ $md5 != "3d1147cae66e2959ea5441b183de1b1c" ]
if [ $md5 != "1beefafe8963982adc84b408b2959927" ]
then
echo "File corrupt, please download again."
exit 1
Expand All @@ -62,12 +62,8 @@ do
PLATFORM="iPhoneOS"
fi
echo "Building libssh2 for ${PLATFORM} ${SDKVERSION} ${ARCH}"
echo "Please stand by..."
tar zxf libssh2-${VERSION}.tar.gz -C src
cd src/libssh2-${VERSION}
echo "Please stand by...!"

PATCHFILE=`find ../.. | grep with-libgcrypt-prefix.patch`
patch -p2 < $PATCHFILE

export M4="${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/gm4"
export DEVROOT="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
Expand All @@ -87,33 +83,30 @@ do

LOG="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/build-libssh2-${VERSION}.log"
echo ${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk



HOST="${ARCH}"
if [ "${ARCH}" == "arm64" ];
then
HOST="aarch64"
fi

autoconf

if [ "$1" == "openssl" ];
then
./configure --host=${HOST}-apple-darwin --prefix="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" --with-openssl --with-libssl-prefix=${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk --disable-shared --enable-static >> "${LOG}" 2>&1
pwd
./configure --host=${HOST}-apple-darwin --prefix="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" --with-crypto=openssl --with-libssl-prefix=${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk --disable-shared --enable-static >> "${LOG}"
else
./configure --host=${HOST}-apple-darwin --prefix="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" --with-libgcrypt --with-libgcrypt-prefix=${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk --disable-shared --enable-static >> "${LOG}" 2>&1
./configure --host=${HOST}-apple-darwin --prefix="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" --with-crypto=libgcrypt --with-libgcrypt-prefix=${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk --disable-shared --enable-static >> "${LOG}"
fi

make >> "${LOG}" 2>&1
make install >> "${LOG}" 2>&1
cd ${CURRENTPATH}
rm -rf src/libssh2-${VERSION}


done

echo "Build library..."
#
lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/lib/libssh2.a ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-x86_64.sdk/lib/libssh2.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7s.sdk/lib/libssh2.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/lib/libssh2.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-arm64.sdk/lib/libssh2.a -output ${CURRENTPATH}/lib/libssh2.a

lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-x86_64.sdk/lib/libssh2.a -output ${CURRENTPATH}/lib/libssh2-x86_64.a
lipo -create ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-arm64.sdk/lib/libssh2.a -output ${CURRENTPATH}/lib/libssh2.a
mkdir -p ${CURRENTPATH}/include/libssh2
cp -R ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/include/libssh2* ${CURRENTPATH}/include/libssh2/
#cp -vR ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-arm64.sdk/include/libssh2* ${CURRENTPATH}/include/libssh2/
echo "Building done."
Loading