commit
ab7ee8223c
@ -1,5 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
|
||||||
|
|
||||||
# Copyright (C) 2021 Sergej Schumilo
|
# Copyright (C) 2021 Sergej Schumilo
|
||||||
#
|
#
|
||||||
@ -18,12 +17,14 @@ set -e
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with QEMU-PT. If not, see <http://www.gnu.org/licenses/>.
|
# along with QEMU-PT. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
if [ -z "$BASH_VERSION" ]; then
|
if [ -z "$BASH_VERSION" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
error () {
|
error()
|
||||||
|
{
|
||||||
echo "$0: <option>"
|
echo "$0: <option>"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Available compile options: "
|
echo "Available compile options: "
|
||||||
@ -33,111 +34,84 @@ error () {
|
|||||||
echo " - debug enable several debug options"
|
echo " - debug enable several debug options"
|
||||||
echo " - debug_static enable several debug options and statically link libxdc and capstone4"
|
echo " - debug_static enable several debug options and statically link libxdc and capstone4"
|
||||||
echo ""
|
echo ""
|
||||||
exit 3
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
compile_libraries (){
|
compile_libraries()
|
||||||
echo "[!] compiling capstone4..."
|
{
|
||||||
cd capstone_v4
|
echo "[!] Compiling capstone4..."
|
||||||
make -j
|
make -C $CAPSTONE_ROOT -j $(nproc)
|
||||||
cd ..
|
|
||||||
echo "[!] capstone4 is ready!"
|
|
||||||
|
|
||||||
echo "[!] compiling libxdc..."
|
echo "[!] Compiling libxdc..."
|
||||||
cd libxdc
|
LDFLAGS="-L$CAPSTONE_ROOT -L$LIBXDC_ROOT" CFLAGS="-I$CAPSTONE_ROOT/include/" make -C $LIBXDC_ROOT -j $(nproc)
|
||||||
CFLAGS="-I../capstone_v4/include/" V=1 make libxdc.a
|
|
||||||
cd ..
|
case $1 in
|
||||||
echo "[!] libxdc is ready!"
|
"dynamic"|"debug")
|
||||||
|
echo "[!] Installing capstone4..."
|
||||||
|
sudo make -C $CAPSTONE_ROOT install
|
||||||
|
echo "[!] Installing libxdc..."
|
||||||
|
sudo make -C $LIBXDC_ROOT install
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
compile_and_install_libraries () {
|
configure_qemu()
|
||||||
if [ ! -f "/usr/lib/libcapstone.so" ] || [ ! -d "/usr/include/capstone/" ]; then
|
{
|
||||||
echo "[!] capstone not found! Installing..."
|
QEMU_CONFIGURE="./configure --target-list=x86_64-softmmu --disable-gtk --disable-docs --enable-gtk --disable-werror --disable-capstone --disable-libssh --disable-tools"
|
||||||
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
|
case $1 in
|
||||||
echo "[!] libxdc not found! Installing..."
|
"debug_static"|"static"|"lto")
|
||||||
cd libxdc
|
export LIBS="-L$CAPSTONE_ROOT -L$LIBXDC_ROOT/ $LIBS"
|
||||||
make -j
|
export QEMU_CFLAGS="-I$CAPSTONE_ROOT/include/ -I$LIBXDC_ROOT/ $QEMU_CFLAGS"
|
||||||
echo "[ ] requesting permissions to install libxdc ..."
|
;;
|
||||||
sudo make install
|
*)
|
||||||
echo "[!] done ..."
|
error
|
||||||
cd ..
|
;;
|
||||||
fi
|
esac
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
"dynamic")
|
||||||
|
$QEMU_CONFIGURE --enable-nyx
|
||||||
|
;;
|
||||||
|
"debug")
|
||||||
|
$QEMU_CONFIGURE --enable-nyx --enable-sanitizers --enable-debug
|
||||||
|
;;
|
||||||
|
"debug_static")
|
||||||
|
$QEMU_CONFIGURE --enable-nyx --enable-sanitizers --enable-debug --enable-nyx-static
|
||||||
|
;;
|
||||||
|
"static")
|
||||||
|
$QEMU_CONFIGURE --enable-nyx --enable-nyx-static
|
||||||
|
;;
|
||||||
|
"lto")
|
||||||
|
$QEMU_CONFIGURE --enable-nyx --enable-nyx-static --enable-nyx-flto
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
compile () {
|
compile_qemu()
|
||||||
if [ -f GNUmakefile ]; then
|
{
|
||||||
rm GNUmakefile 2> /dev/null
|
test -f GNUmakefile && rm GNUmakefile 2> /dev/null
|
||||||
fi
|
make -j $(nproc)
|
||||||
|
|
||||||
make -j
|
|
||||||
echo "[!] QEMU-Nyx is ready!"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
git submodule init
|
|
||||||
git submodule update libxdc
|
|
||||||
git submodule update capstone_v4
|
|
||||||
|
|
||||||
if [ "$#" == 0 ] ; then
|
if [ "$#" -ne 1 ] ; then
|
||||||
error
|
error
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "dynamic" ];
|
if [ -z "$LIBXDC_ROOT" -o -z "$CAPSTONE_ROOT" ]; then
|
||||||
then
|
git submodule init
|
||||||
|
git submodule update libxdc
|
||||||
make clean
|
git submodule update capstone_v4
|
||||||
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
|
LIBXDC_ROOT="$PWD/libxdc"
|
||||||
compile
|
CAPSTONE_ROOT="$PWD/capstone_v4"
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "debug" ];
|
make clean
|
||||||
then
|
compile_libraries $1
|
||||||
|
configure_qemu $1
|
||||||
make clean
|
compile_qemu
|
||||||
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
|
|
||||||
|
3
configure
vendored
3
configure
vendored
@ -6105,8 +6105,7 @@ if test "$nyx" = "yes" ; then
|
|||||||
CFLAGS="-DNESTED_PATCH -Wno-error=maybe-uninitialized -DQEMU_NYX -g -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
|
CFLAGS="-DNESTED_PATCH -Wno-error=maybe-uninitialized -DQEMU_NYX -g -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
|
||||||
|
|
||||||
if test "$nyx_static" = "yes" ; then
|
if test "$nyx_static" = "yes" ; then
|
||||||
LIBS="-L$PWD/capstone_v4/ -l:libcapstone.a -L$PWD/libxdc/ -l:libxdc.a -I$PWD/capstone_v4/include/ -I$PWD/libxdc/ $LIBS"
|
LIBS="-l:libcapstone.a -l:libxdc.a $LIBS"
|
||||||
QEMU_INCLUDES=" -I$PWD/capstone_v4/include/ -I$PWD/libxdc/ $QEMU_INCLUDES"
|
|
||||||
else
|
else
|
||||||
LIBS="-lcapstone -lxdc $LIBS"
|
LIBS="-lcapstone -lxdc $LIBS"
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user