forked from GJDuck/e9patch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·94 lines (83 loc) · 2.52 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
#!/bin/bash
if [ -t 1 ]
then
RED="\033[31m"
GREEN="\033[32m"
YELLOW="\033[33m"
BOLD="\033[1m"
OFF="\033[0m"
else
RED=
GREEN=
YELLOW=
BOLD=
OFF=
fi
while [ $# -ge 1 ]
do
case "$1" in
--help|-h)
echo "usage: $0 [OPTIONS]"
echo
echo "OPTIONS:"
echo
echo " --help, -h"
echo " Print this message"
echo
exit 0
;;
*)
echo "unknown argument \"$1\"; try \`$0 --help' for more information"
exit 1
;;
esac
shift
done
TARGET=`readlink zydis`
if [ ! -d zydis ]
then
ZYDIS_VERSION=3f5a3ad8e16658c62d7033e9373232d19480d3cc
ZYCORE_VERSION=5c341bf141fe9274c9037c542274ead19fb645d8
echo -e "${GREEN}$0${OFF}: downloading zydis-$ZYDIS_VERSION.zip..."
wget -O zydis-$ZYDIS_VERSION.zip https://github.com/zyantific/zydis/archive/$ZYDIS_VERSION.zip
echo -e "${GREEN}$0${OFF}: downloading zycore-$ZYCORE_VERSION.zip..."
wget -O zycore-$ZYCORE_VERSION.zip https://github.com/zyantific/zycore-c/archive/$ZYCORE_VERSION.zip
echo -e "${GREEN}$0${OFF}: extracting zydis-$ZYDIS_VERSION.zip..."
unzip zydis-$ZYDIS_VERSION.zip
rm -f zydis-$ZYDIS_VERSION.zip
echo -e "${GREEN}$0${OFF}: extracting zycore-$ZYCORE_VERSION.zip..."
unzip zycore-$ZYCORE_VERSION.zip
rm -f zycore-$ZYCORE_VERSION.zip
echo -e "${GREEN}$0${OFF}: building Zydis..."
mv zydis-$ZYDIS_VERSION zydis/
rm -rf zydis/dependencies/zycore/
mv zycore-c-$ZYCORE_VERSION zydis/dependencies/zycore/
rm -rf zycore-c-$ZYCORE_VERSION
cat << EOF > zydis/include/ZydisExportConfig.h
#ifndef ZYDIS_EXPORT_H
#define ZYDIS_EXPORT_H
#define ZYDIS_EXPORT
#define ZYDIS_NO_EXPORT
#define ZYDIS_DEPRECATED __attribute__ ((__deprecated__))
#define ZYDIS_DEPRECATED_EXPORT ZYDIS_EXPORT ZYDIS_DEPRECATED
#define ZYDIS_DEPRECATED_NO_EXPORT ZYDIS_NO_EXPORT ZYDIS_DEPRECATED
#define ZYDIS_NO_DEPRECATED
#endif
EOF
cat << EOF > zydis/include/ZycoreExportConfig.h
#ifndef ZYCORE_EXPORT_H
#define ZYCORE_EXPORT_H
#define ZYCORE_EXPORT
#define ZYCORE_NO_EXPORT
#define ZYCORE_DEPRECATED __attribute__ ((__deprecated__))
#define ZYCORE_DEPRECATED_EXPORT ZYCORE_EXPORT ZYCORE_DEPRECATED
#define ZYCORE_DEPRECATED_NO_EXPORT ZYCORE_NO_EXPORT ZYCORE_DEPRECATED
#define ZYCORE_NO_DEPRECATED
#endif
EOF
make -f Makefile.zydis -j `nproc`
fi
echo -e "${GREEN}$0${OFF}: building e9patch and e9tool..."
make clean
make -j `nproc` tool release
echo -e "${GREEN}$0${OFF}: done...!"