forked from il-steffen/QEMU-Nyx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile_qemu_nyx.sh
executable file
·143 lines (120 loc) · 3.74 KB
/
compile_qemu_nyx.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
#!/bin/bash
set -e
# Copyright (C) 2021 Sergej Schumilo
#
# This file is part of NYX.
#
# QEMU-PT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# QEMU-PT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with QEMU-PT. If not, see <http://www.gnu.org/licenses/>.
if [ -z "$BASH_VERSION" ]; then
exit 0
fi
error () {
echo "$0: <option>"
echo ""
echo "Available compile options: "
echo " - dynamic dynamically link libxdc and capstone4"
echo " - static statically link libxdc and capstone4"
echo " - lto statically link libxdc and capstone4 and enable LTO (up to 10% better performance)"
echo " - debug enable several debug options"
echo " - debug_static enable several debug options and statically link libxdc and capstone4"
echo ""
exit 3
}
compile_libraries (){
echo "[!] compiling capstone4..."
cd capstone_v4
make -j
cd ..
echo "[!] capstone4 is ready!"
echo "[!] compiling libxdc..."
cd libxdc
CFLAGS="-I../capstone_v4/include/" V=1 make libxdc.a
cd ..
echo "[!] libxdc is ready!"
}
compile_and_install_libraries () {
if [ ! -f "/usr/lib/libcapstone.so" ] || [ ! -d "/usr/include/capstone/" ]; then
echo "[!] capstone not found! Installing..."
cd capstone_v4
make -j
echo "[ ] requesting permissions to install capstone4 ..."
sudo make install
echo "[!] done ..."
cd ..
fi
if [ ! -f "/usr/lib/libxdc.so" ] || [ ! -f "/usr/include/libxdc.h" ]; then
echo "[!] libxdc not found! Installing..."
cd libxdc
make -j
echo "[ ] requesting permissions to install libxdc ..."
sudo make install
echo "[!] done ..."
cd ..
fi
}
compile () {
if [ -f GNUmakefile ]; then
rm GNUmakefile 2> /dev/null
fi
make -j
echo "[!] QEMU-Nyx is ready!"
}
git submodule init
git submodule update libxdc
git submodule update capstone_v4
if [ "$#" == 0 ] ; then
error
fi
if [ "$1" == "dynamic" ];
then
make clean
compile_and_install_libraries
./configure --target-list=x86_64-softmmu --disable-gtk --disable-docs --enable-gtk --disable-werror --disable-capstone --disable-libssh --enable-nyx --disable-tools
compile
exit 0
fi
if [ "$1" == "debug" ];
then
make clean
compile_and_install_libraries
./configure --target-list=x86_64-softmmu --disable-gtk --disable-docs --enable-gtk --disable-werror --disable-capstone --disable-libssh --enable-nyx --enable-sanitizers --enable-debug --disable-tools
compile
exit 0
fi
if [ "$1" == "debug_static" ];
then
make clean
compile_libraries
./configure --target-list=x86_64-softmmu --disable-gtk --disable-docs --enable-gtk --disable-werror --disable-capstone --disable-libssh --enable-nyx --enable-sanitizers --enable-debug --enable-nyx-static --disable-tools
compile
exit 0
fi
if [ "$1" == "static" ];
then
make clean
compile_libraries
./configure --target-list=x86_64-softmmu --disable-gtk --disable-docs --enable-gtk --disable-werror --disable-capstone --disable-libssh --enable-nyx --enable-nyx-static --disable-tools
compile
exit 0
fi
if [ "$1" == "lto" ];
then
make clean
compile_libraries
./configure --target-list=x86_64-softmmu --disable-gtk --disable-docs --enable-gtk --disable-werror --disable-capstone --disable-libssh --enable-nyx --enable-nyx-static --enable-nyx-flto --disable-tools
compile
exit 0
fi
error
exit 1