-
Notifications
You must be signed in to change notification settings - Fork 0
/
ipabuild.sh
executable file
·99 lines (80 loc) · 2.45 KB
/
ipabuild.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
set -e
cd "$(dirname "$0")"
WORKING_LOCATION="$(pwd)"
APPLICATION_NAME=SwiftTop
PLATFORM=iOS
SDK=iphoneos
if [[ $* == *--debug* ]]; then
TARGET=Debug
else
TARGET=Release
fi
if [[ $* == *--clean* ]]; then
echo "[*] Deleting previous packages..."
rm -rf "build/$APPLICATION_NAME.ipa"
rm -rf "build/$APPLICATION_NAME.tipa"
fi
if [[ $* == *--deepclean* ]]; then
echo "[*] Deleting build folder..."
rm -rf "build"
fi
echo "[*] Building $APPLICATION_NAME ($TARGET)..."
if [ ! -d "build" ]; then
mkdir build
fi
cd build
xcodebuild -project "$WORKING_LOCATION/$APPLICATION_NAME.xcodeproj" \
-scheme "$APPLICATION_NAME" \
-configuration "$TARGET" \
-derivedDataPath "$WORKING_LOCATION/build/DerivedDataApp" \
-destination "generic/platform=$PLATFORM" \
clean build \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO"
DD_APP_PATH="$WORKING_LOCATION/build/DerivedDataApp/Build/Products/"$TARGET"-$SDK/$APPLICATION_NAME.app"
TARGET_APP="$WORKING_LOCATION/build/$APPLICATION_NAME.app"
cp -r "$DD_APP_PATH" "$TARGET_APP"
echo "[*] Removing code signature"
codesign --remove "$TARGET_APP"
if [ -e "$TARGET_APP/_CodeSignature" ]; then
rm -rf "$TARGET_APP/_CodeSignature"
fi
if [ -e "$TARGET_APP/embedded.mobileprovision" ]; then
rm -rf "$TARGET_APP/embedded.mobileprovision"
fi
# Add entitlements
echo "[*] Adding entitlements"
ldid -S"$WORKING_LOCATION/$APPLICATION_NAME/$APPLICATION_NAME.entitlements" "$TARGET_APP/$APPLICATION_NAME"
echo "[*] Building RootHelper..."
cd $WORKING_LOCATION/RootHelper
if ! type "gmake" > /dev/null; then
echo "[!] gmake not found, using macOS bundled make instead"
make clean
if [[ $* == *--debug* ]]; then
make
else
make FINALPACKAGE=1
fi
else
gmake clean
if [[ $* == *--debug* ]]; then
gmake -j"$(sysctl -n machdep.cpu.thread_count)"
else
gmake -j"$(sysctl -n machdep.cpu.thread_count)" FINALPACKAGE=1
fi
fi
if [[ $* == *--debug* ]]; then
cp "$WORKING_LOCATION/RootHelper/.theos/obj/debug/RootHelper" "$TARGET_APP/roothelper"
else
cp "$WORKING_LOCATION/RootHelper/.theos/obj/RootHelper" "$TARGET_APP/roothelper"
fi
cd -
echo "[*] Packaging..."
mkdir Payload
cp -r $APPLICATION_NAME.app Payload/$APPLICATION_NAME.app
if [[ $* != *--debug* ]]; then
strip Payload/$APPLICATION_NAME.app/$APPLICATION_NAME
fi
zip -vr $APPLICATION_NAME.tipa Payload
rm -rf $APPLICATION_NAME.app
rm -rf Payload