forked from Frugghi/SwiftSH
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sh
66 lines (59 loc) · 2 KB
/
build.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
#/bin/bash
config=Debug
includessh=false
while test x$1 != x; do
case $1 in
--includessh)
includessh=true
;;
--config=*)
config=`echo $1 | sed 's/--config=//'`
;;
--help)
echo "--config=[Debug|Release] Specifies the build configuration"
echo "--includessh To include a fresh build of iSSH2"
exit 0
esac
shift
done
build_dir=local-build
rm -rf $build_dir macoslib SwiftSH.xcframework tvoslib
if $mac; then
mkdir macoslib
fi
mkdir tvoslib
if $includessh; then
cd ../iSSH2
./iSSH2.sh --platform=iphoneos --no-clean --min-version=11.0
./iSSH2.sh --platform=macosx --no-clean --sdk-version=10.15 --min-version=10.15
./iSSH2.sh --platform=appletvos --no-clean --min-version=11.0
fi
cp ../iSSH2/libssh2_iphoneos/include/* libssh2/libssh2
cp ../iSSH2/libssh2_iphoneos/lib/* libssh2/
cp ../iSSH2/*_appletvos/lib/* tvoslib
cp ../iSSH2/*_macosx/lib/* macoslib
# Could be empty, for now use this, since we do not have armv7 builds of libssh2 copied
IOS_ARCHS="-arch arm64 -arch arm64e"
# Parameters
# $1 name used to construct the archivePath (local-build/$1.xcarchive)
# $2 sdk to use
xcode_platform_archive_build()
{
_name=$1; shift
_sdk=$1; shift
xcodebuild archive -scheme SwiftSH \
-project SwiftSH.xcodeproj \
ONLY_ACTIVE_ARCH=NO \
SKIP_INSTALL=NO \
BUILD_LIBRARIES_FOR_DISTRIBUTION=YES \
-sdk $_sdk \
-archivePath local-build/$_name.xcarchive\
-derivedDataPath /tmp/build-$_name \
$*
}
xcode_platform_archive_build tvos appletvos LIBRARY_SEARCH_PATHS=`pwd`/tvoslib
xcode_platform_archive_build ios iphoneos $IOS_ARCHS
xcode_platform_archive_build iossimulator iphonesimulator
xcode_platform_archive_build mac macosx LIBRARY_SEARCH_PATHS=`pwd`/macoslib
frameworks=`for x in $(echo local-build/*xcarchive/Products/Library/Frameworks/SwiftSH.framework); do echo -n "-framework $x "; done`
xcodebuild -create-xcframework $frameworks -output SwiftSH.xcframework