From fe2399ccc3bfe7c1e507c7c33c239adeaf648b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C4=81rlis=20Se=C5=86ko?= Date: Sun, 29 Nov 2020 17:44:20 +0200 Subject: [PATCH] Run cutter appimage packaging in GHA. * Update cutter-deps. * Switch to older visual studio due to pyside having problems parsing MSVC headers. --- .github/workflows/ccpp.yml | 54 +++++++++++++++++++++++++++++++++----- cmake/BundledRizin.cmake | 2 +- dist/CMakeLists.txt | 14 ++++++++-- scripts/fetch_deps.sh | 12 ++++----- 4 files changed, 66 insertions(+), 16 deletions(-) mode change 100755 => 100644 scripts/fetch_deps.sh diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index e5a8e3d5..c2d0b9fe 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -13,17 +13,22 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-18.04] #, ubuntu-16.04, macos-latest, windows-latest] + os: [ubuntu-18.04, ubuntu-16.04, macos-latest, windows-2016] python-version: [3.7.x] system-deps: [false] cc-override: [default] cxx-override: [default] include: - - os: ubuntu-16.04 + - os: windows-latest + package: true + - os: ubuntu-16.04 # ensure that Cutter can be built at least in basic config on Ubuntu 16.04 using sytem libraries python-version: 3.5.10 system-deps: true cc-override: '/usr/bin/gcc-5' cxx-override: '/usr/bin/g++-5' + - os: ubuntu-16.04 # release package build + system-deps: false + package: true # Prevent one job from pausing the rest fail-fast: false steps: @@ -34,7 +39,7 @@ jobs: - name: apt dependencies if: contains(matrix.os, 'ubuntu') run: | - sudo apt-get install libgraphviz-dev mesa-common-dev + sudo apt-get install libgraphviz-dev mesa-common-dev libxkbcommon-x11-dev if [[ "${{ matrix.os }}" = "ubuntu-16.04" ]] then sudo apt-get install ninja-build/xenial-backports @@ -85,6 +90,7 @@ jobs: export PKG_CONFIG_PATH="$CUTTER_DEPS_PYTHON_PREFIX/lib/pkgconfig:${PKG_CONFIG_PATH:-}" export LD_LIBRARY_PATH="`llvm-config --libdir`:$LD_LIBRARY_PATH" fi + set -euo pipefail #TODO: move to top once cutter-deps doesn't fail if [[ "${{ matrix.cc-override }}" != "default" ]] then export CC="${{matrix.cc-override}}" @@ -100,14 +106,20 @@ jobs: then cmake \ -G Ninja \ - -DCUTTER_ENABLE_PYTHON=ON \ -DCMAKE_BUILD_TYPE=Release \ + -DCUTTER_ENABLE_PYTHON=ON \ -DPYTHON_LIBRARY="$CUTTER_DEPS_PYTHON_PREFIX/lib/libpython3.6m.so.1.0" \ -DPYTHON_INCLUDE_DIR="$CUTTER_DEPS_PYTHON_PREFIX/include/python3.6m" \ -DPYTHON_EXECUTABLE="$CUTTER_DEPS_PYTHON_PREFIX/bin/python3" \ - -DCUTTER_ENABLE_PYTHON_BINDINGS=OFF \ + -DCUTTER_ENABLE_PYTHON_BINDINGS=ON \ + -DCUTTER_ENABLE_GRAPHVIZ=OFF \ -DCUTTER_ENABLE_CRASH_REPORTS=ON \ -DCUTTER_USE_BUNDLED_RIZIN=ON \ + -DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON \ + -DCUTTER_PACKAGE_RZ_GHIDRA=ON \ + -DCUTTER_APPIMAGE_BUILD=ON \ + -DCMAKE_INSTALL_PREFIX=appdir/usr \ + -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \ .. else cmake \ @@ -117,6 +129,34 @@ jobs: .. fi ninja + if [[ "${{ matrix.package || false }}" = "true" ]] + then + export CUTTER_VERSION=$(python ../scripts/get_version.py) + export VERSION=$CUTTER_VERSION # TODO cleanup this + ninja install + "../scripts/appimage_embed_python.sh" appdir + # "../scripts/rz-ghidra.sh" -DCMAKE_INSTALL_PREFIX="`pwd`/appdir/usr" -DBUILD_CUTTER_PLUGIN=ON -DCUTTER_SOURCE_DIR="`pwd`/.." + APP_PREFIX=`pwd`/appdir/usr + # export LD_LIBRARY_PATH=${APP_PREFIX}/lib:$Shiboken2_ROOT/lib + export PATH=$PATH:${APP_PREFIX}/bin + "../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 "../cutter-deps/qt/plugins/imageformats/libqjp2.so" + # ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -executable=./appdir/usr/bin/python3 -bundle-non-qt-libs -no-strip -exclude-libs=libnss3.so,libnssutil3.so,libqjp2.so -ignore-glob=usr/lib/python3.9/**/* -verbose=2 + # exclude librzghidra cutter plugin because cutter and rz plugin is loaded manuallly as they are plugins linuxdeployqt doesn't know this + ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop \ + -executable=./appdir/usr/bin/python3 \ + -appimage \ + -no-strip -exclude-libs=libnss3.so,libnssutil3.so,libqjp2.so \ + -ignore-glob=usr/lib/python3.9/**/* \ + -ignore-glob=usr/share/RadareOrg/Cutter/plugins/native/librzghidra* \ + -verbose=2 + find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq + export APPIMAGE_FILE="Cutter-v$CUTTER_VERSION-x64.Linux.AppImage" + mv Cutter-*-x86_64.AppImage "$APPIMAGE_FILE" + echo PACKAGE_NAME=$APPIMAGE_FILE >> $GITHUB_ENV + fi - name: cmake macos shell: bash if: contains(matrix.os, 'macos') @@ -148,13 +188,13 @@ jobs: scripts/fetch_deps.sh choco install winflexbison3 - name: windows cmake - if: contains(matrix.os, 'windows-latest') + if: contains(matrix.os, 'windows') shell: cmd run: | set ARCH=x64 set CUTTER_DEPS=%CD%\cutter-deps set PATH=%CD%\cutter-deps\qt\bin;%PATH% - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 + call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 call scripts\prepare_breakpad.bat cd mkdir build diff --git a/cmake/BundledRizin.cmake b/cmake/BundledRizin.cmake index f0479db7..a9b144e6 100644 --- a/cmake/BundledRizin.cmake +++ b/cmake/BundledRizin.cmake @@ -71,5 +71,5 @@ elseif (WIN32) COMPONENT Devel PATTERN "*.pdb" EXCLUDE) else () - install(DIRECTORY "${RIZIN_INSTALL_DIR}/" DESTINATION ".") + install(DIRECTORY "${RIZIN_INSTALL_DIR}/" DESTINATION "." USE_SOURCE_PERMISSIONS) endif() diff --git a/dist/CMakeLists.txt b/dist/CMakeLists.txt index 1d88bcf4..fe6bdc2d 100644 --- a/dist/CMakeLists.txt +++ b/dist/CMakeLists.txt @@ -91,6 +91,17 @@ if(CUTTER_PACKAGE_RZ_GHIDRA) INSTALL_COMMAND "" ) endif() + if (WIN32) + set (GHIDRA_OPTIONS " + \"-DRIZIN_INSTALL_PLUGDIR=\${CMAKE_INSTALL_PREFIX}/${RIZIN_INSTALL_PLUGDIR}\" + -DCUTTER_INSTALL_PLUGDIR=plugins/native") + elseif (APPLE) + set (GHIDRA_OPTIONS " + \"-DRIZIN_INSTALL_PLUGDIR=\${CMAKE_INSTALL_PREFIX}/${RIZIN_INSTALL_PLUGDIR}\" + -DCUTTER_INSTALL_PLUGDIR=plugins/native") + else() + set (GHIDRA_OPTIONS "") + endif() install(CODE " execute_process( WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/rz-ghidra-prefix/src/rz-ghidra-build @@ -100,8 +111,7 @@ if(CUTTER_PACKAGE_RZ_GHIDRA) -DCMAKE_BUILD_TYPE=Release \"-DCMAKE_PREFIX_PATH=\${CMAKE_INSTALL_PREFIX};\${CMAKE_INSTALL_PREFIX}/include/librz;\${CMAKE_INSTALL_PREFIX}/include/librz/sdb;${RZ_GHIDRA_PREFIX_PATH}\" -DCMAKE_INSTALL_PREFIX=\${CMAKE_INSTALL_PREFIX} - \"-DRIZIN_INSTALL_PLUGDIR=\${CMAKE_INSTALL_PREFIX}/${RIZIN_INSTALL_PLUGDIR}\" - -DCUTTER_INSTALL_PLUGDIR=plugins/native + ${GHIDRA_OPTIONS} -DBUILD_CUTTER_PLUGIN=ON -DBUILD_SLEIGH_PLUGIN=OFF -G Ninja diff --git a/scripts/fetch_deps.sh b/scripts/fetch_deps.sh old mode 100755 new mode 100644 index 9ef8fe74..96091413 --- a/scripts/fetch_deps.sh +++ b/scripts/fetch_deps.sh @@ -4,16 +4,16 @@ cd $(dirname "${BASH_SOURCE[0]}")/.. mkdir -p cutter-deps && cd cutter-deps LINUX_FILE="cutter-deps-linux.tar.gz" -LINUX_MD5=31fd19443a3405d6b6097cbbd4c11fba -LINUX_URL=https://github.com/rizinorg/cutter-deps/releases/download/v12/cutter-deps-linux.tar.gz +LINUX_MD5=63fb136f9c2b1da0b881e460030bff7f +LINUX_URL=https://github.com/rizinorg/cutter-deps/releases/download/test-v13/cutter-deps-linux.tar.gz MACOS_FILE="cutter-deps-macos.tar.gz" -MACOS_MD5=e75041c04fc806437723a399028402af -MACOS_URL=https://github.com/rizinorg/cutter-deps/releases/download/v12/cutter-deps-macos.tar.gz +MACOS_MD5=44e490ea45985cfedb5f7882acd36fa2 +MACOS_URL=https://github.com/rizinorg/cutter-deps/releases/download/test-v13/cutter-deps-macos.tar.gz WIN_FILE="cutter-deps-win.tar.gz" -WIN_MD5=7c755404140f2e9945bfc13d2e645bb1 -WIN_URL=https://github.com/rizinorg/cutter-deps/releases/download/v12/cutter-deps-win.tar.gz +WIN_MD5=f7bfcf69da0c9bbe96f7c34dc149d3b9 +WIN_URL=https://github.com/rizinorg/cutter-deps/releases/download/test-v13/cutter-deps-win.tar.gz if [ "$OS" == "Windows_NT" ]; then FILE="${WIN_FILE}"