-
Notifications
You must be signed in to change notification settings - Fork 24
/
build.sh
executable file
·170 lines (147 loc) · 4.09 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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/bin/sh
VER=`grep EVASI0N_VERSION_STRING src/version.h |cut -d " " -f 3 |sed 's/"//g'`
PKGNAME=evasi0n-$VER
MACHINE=`gcc -dumpmachine`
case "$MACHINE" in
*darwin*)
echo Rebuilding kernel/iOS stuff
make -C kernel clean
if ! make -C kernel WATERMARK=$1; then
echo "Rebuilding kernel/iOS stuff failed"
exit 1
fi
;;
esac
echo Creating resources.h
# icons for DemoApp.app:
RES=""
for I in res/DemoApp.app/Icon*.png; do
BN=`basename $I`
CNAME=`echo $BN |tr '[:upper:]' '[:lower:]' |sed -e 's/[\.\@\,\-]/_/g'`
RES="$RES $I $CNAME "
done
# Info.plist for DemoApp.app
if plutil -i > /dev/null 2> /dev/null; then
# libplist plutil
plutil -i res/DemoApp.app/Info.plist -o Info.bplist.tmp
else
# osx plutil
plutil -convert binary1 -o Info.bplist.tmp res/DemoApp.app/Info.plist
fi
RES="$RES Info.bplist.tmp demo_app_info_plist "
# shebang fstab launchd.conf
RES="$RES res/shebang shebang res/fstab etc_fstab res/launchd.conf etc_launchd_conf "
# fake backup_kbag.bin
RES="$RES res/backup_kbag.bin backup_kbag "
if ! test -f kernel/evasi0n; then
echo "ERROR: Please add kernel/evasi0n"
exit 1
fi
if ! test -f kernel/amfi.dylib; then
echo "ERROR: Please add kernel/amfi.dylib"
exit 1
fi
# amfi.dylib evasi0n binary
RES="$RES kernel/amfi.dylib amfi_dylib kernel/evasi0n evasi0n_bin "
if ! test -f kernel/extras.tar; then
echo "ERROR: Please add kernel/extras.tar"
exit 1
fi
# extras.tar
RES="$RES kernel/extras.tar extras_tar"
# languages.plist
python ./generate_languages.py
if plutil -i > /dev/null 2> /dev/null; then
# libplist plutil
plutil -i res/languages.plist -o languages.bplist.tmp
else
# osx plutil
plutil -convert binary1 -o languages.bplist.tmp res/languages.plist
fi
RES="$RES languages.bplist.tmp languages_plist"
# now make a sweet header file
misc/bin2c $RES > src/resources.h
rm -f Info.bplist.tmp
rm -f languages.bplist.tmp
# add gui resources (os specific)
case "$MACHINE" in
*darwin*)
PKGNAME=evasi0n-mac-$VER
misc/bin2c res/gui/osx/background.png gui_bg res/gui/osx/e_logo.png evasi0n_logo > src/guiresources.h
;;
*linux*)
PKGNAME=evasi0n-linux-$VER
;;
*mingw32*|*cygwin*|*msys*)
PKGNAME=evasi0n-win-$VER
;;
*)
echo "Unknown platform $MACHINE"
exit 1
;;
esac
rm -rf build
# now rebuild stuff
make -C src -f Makefile clean
if ! make -C src -f Makefile; then
echo build failed...
exit 1
fi
case "$MACHINE" in
*linux*)
mv src/evasi0n evasi0n.x86_64
mv src/evasi0n_gui evasi0n_gui.x86_64
make -C src -f Makefile clean
if ! PLATFORM=x86 make -C src -f Makefile; then
echo building x86 failed
fi
;;
esac
CLIDEST=build/evasi0n/cli
GUIDEST=build/evasi0n/$PKGNAME
mkdir -p $CLIDEST
mkdir -p $GUIDEST
case "$MACHINE" in
*darwin*)
cp src/evasi0n $CLIDEST/
OSX_BUNDLE_NAME=evasi0n
mkdir -p $GUIDEST/${OSX_BUNDLE_NAME}.app/Contents/MacOS
mkdir -p $GUIDEST/${OSX_BUNDLE_NAME}.app/Contents/Resources
echo "APPL????" > $GUIDEST/${OSX_BUNDLE_NAME}.app/Contents/PkgInfo
cp res/gui/osx/Info.plist $GUIDEST/${OSX_BUNDLE_NAME}.app/Contents/
cp res/gui/osx/Icon.icns $GUIDEST/${OSX_BUNDLE_NAME}.app/Contents/Resources/
APPDEST=$GUIDEST/${OSX_BUNDLE_NAME}.app/Contents/MacOS
cp src/evasi0n_gui $APPDEST/${OSX_BUNDLE_NAME}
chmod 755 $APPDEST/${OSX_BUNDLE_NAME}
codesign -s "Developer ID Application: Xuzz Productions" $APPDEST/${OSX_BUNDLE_NAME}
;;
*linux*)
cp src/evasi0n $CLIDEST/evasi0n.x86
cp src/evasi0n_gui $GUIDEST/evasi0n.x86
mv evasi0n.x86_64 $CLIDEST/evasi0n.x86_64
mv evasi0n_gui.x86_64 $GUIDEST/evasi0n.x86_64
cp res/gui/linux/evasi0n-launcher.sh $CLIDEST/evasi0n
chmod 755 $CLIDEST/evasi0n
cp res/gui/linux/evasi0n-launcher.sh $GUIDEST/evasi0n
chmod 755 $GUIDEST/evasi0n
;;
*mingw32*|*cygwin*|*msys*)
cp src/evasi0n.exe $CLIDEST/
cp src/evasi0n_gui.exe $GUIDEST/evasi0n.exe
;;
esac
cp changelog.txt $CLIDEST/
cp readme.txt $CLIDEST/README.txt
cp changelog.txt $GUIDEST/
cp readme.txt $GUIDEST/README.txt
case "$MACHINE" in
*mingw32*|*cygwin*|*msys*)
conv --u2d $CLIDEST/changelog.txt
conv --u2d $CLIDEST/README.txt
conv --u2d $GUIDEST/changelog.txt
conv --u2d $GUIDEST/README.txt
;;
*)
;;
esac
echo build complete.