From 14f830dd8124323732d3026ac3c9d3ddfd58c0c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Fri, 24 Jan 2020 12:18:18 +0100 Subject: [PATCH] Bundle r2dec into AppImage (#2023) --- .travis.yml | 4 ++++ scripts/r2dec.sh | 19 +++++++++++++++++++ src/CutterApplication.cpp | 10 ++++++++-- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100755 scripts/r2dec.sh diff --git a/.travis.yml b/.travis.yml index 5da37447..93bff30e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,9 @@ matrix: apt: packages: - ninja-build + before_install: + - pyenv global 3.7 + - pip install meson - name: Linux CMake os: linux @@ -224,6 +227,7 @@ after_success: cp ../src/translations/*.qm appdir/usr/bin/translations/ && "$TRAVIS_BUILD_DIR/scripts/appimage_embed_python.sh" appdir && "$TRAVIS_BUILD_DIR/scripts/r2ghidra.sh" -DCMAKE_INSTALL_PREFIX="`pwd`/appdir/usr" -DBUILD_CUTTER_PLUGIN=ON -DCUTTER_SOURCE_DIR="$TRAVIS_BUILD_DIR" && + "$TRAVIS_BUILD_DIR/scripts/r2dec.sh" --prefix=`pwd`/appdir/usr && wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/6/linuxdeployqt-6-x86_64.AppImage" && chmod a+x linuxdeployqt*.AppImage && rm -fv "$TRAVIS_BUILD_DIR/cutter-deps/qt/plugins/imageformats/libqjp2.so" && diff --git a/scripts/r2dec.sh b/scripts/r2dec.sh new file mode 100755 index 00000000..662d72d0 --- /dev/null +++ b/scripts/r2dec.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e + +SCRIPTPATH=$(realpath "$(dirname "${BASH_SOURCE[0]}")") + +cd "$SCRIPTPATH/.." + +if [[ ! -d r2dec-js ]]; then + git clone --depth 1 https://github.com/wargio/r2dec-js.git +fi + +cd r2dec-js +rm -rf build +mkdir build && cd build +meson --buildtype=release --libdir=share/radare2/plugins --datadir=share/radare2/plugins "$@" ../p +ninja +ninja install + diff --git a/src/CutterApplication.cpp b/src/CutterApplication.cpp index 92a21351..76fa0abd 100644 --- a/src/CutterApplication.cpp +++ b/src/CutterApplication.cpp @@ -208,10 +208,16 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc #ifdef APPIMAGE { - auto sleighHome = QDir(QCoreApplication::applicationDirPath()); // appdir/bin - sleighHome.cdUp(); // appdir + auto appdir = QDir(QCoreApplication::applicationDirPath()); // appdir/bin + appdir.cdUp(); // appdir + + auto sleighHome = appdir; sleighHome.cd("share/radare2/plugins/r2ghidra_sleigh"); // appdir/share/radare2/plugins/r2ghidra_sleigh Core()->setConfig("r2ghidra.sleighhome", sleighHome.absolutePath()); + + auto r2decHome = appdir; + appdir.cd("share/radare2/plugins/r2dec-js"); // appdir/share/radare2/plugins/r2dec-js + qputenv("R2DEC_HOME", appdir.absolutePath().toLocal8Bit()); } #endif