mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 10:56:11 +00:00
Enable support for building rz-libswift on cutter (#2841)
This commit is contained in:
parent
239343bb20
commit
75c334596e
3
.github/workflows/ccpp.yml
vendored
3
.github/workflows/ccpp.yml
vendored
@ -121,6 +121,7 @@ jobs:
|
||||
-DCUTTER_ENABLE_PACKAGING=ON \
|
||||
-DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON \
|
||||
-DCUTTER_PACKAGE_RZ_GHIDRA=ON \
|
||||
-DCUTTER_PACKAGE_RZ_LIBSWIFT=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=appdir/usr \
|
||||
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \
|
||||
..
|
||||
@ -187,6 +188,7 @@ jobs:
|
||||
-DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON \
|
||||
-DCUTTER_PACKAGE_RZ_GHIDRA=ON \
|
||||
-DCUTTER_PACKAGE_JSDEC=ON \
|
||||
-DCUTTER_PACKAGE_RZ_LIBSWIFT=ON \
|
||||
-DCPACK_PACKAGE_FILE_NAME="$PACKAGE_NAME" \
|
||||
-DCMAKE_FRAMEWORK_PATH="$BREAKPAD_FRAMEWORK_DIR" \
|
||||
-DCPACK_BUNDLE_APPLE_CERT_APP="-" \
|
||||
@ -224,6 +226,7 @@ jobs:
|
||||
-DCUTTER_ENABLE_PACKAGING=ON ^
|
||||
-DCUTTER_PACKAGE_DEPENDENCIES=ON ^
|
||||
-DCUTTER_PACKAGE_RZ_GHIDRA=ON ^
|
||||
-DCUTTER_PACKAGE_RZ_LIBSWIFT=ON ^
|
||||
-DCUTTER_PACKAGE_JSDEC=ON ^
|
||||
-DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON ^
|
||||
-DCUTTER_ENABLE_CRASH_REPORTS=ON ^
|
||||
|
@ -25,6 +25,7 @@ option(CUTTER_ENABLE_DEPENDENCY_DOWNLOADS "Enable downloading of dependencies. S
|
||||
option(CUTTER_ENABLE_PACKAGING "Enable building platform-specific packages for distributing" OFF)
|
||||
option(CUTTER_PACKAGE_DEPENDENCIES "During install step include the third party dependencies." OFF)
|
||||
option(CUTTER_PACKAGE_RZ_GHIDRA "Compile and install rz-ghidra during install step." OFF)
|
||||
option(CUTTER_PACKAGE_RZ_LIBSWIFT, "Compile and install rz-libswift demangler during the install step." OFF)
|
||||
option(CUTTER_PACKAGE_JSDEC "Compile and install jsdec during install step." OFF)
|
||||
OPTION(CUTTER_QT6 "Use QT6" OFF)
|
||||
|
||||
|
23
dist/CMakeLists.txt
vendored
23
dist/CMakeLists.txt
vendored
@ -32,6 +32,18 @@ if(WIN32)
|
||||
endif()
|
||||
")
|
||||
endif()
|
||||
if (CUTTER_PACKAGE_RZ_LIBSWIFT AND CUTTER_ENABLE_DEPENDENCY_DOWNLOADS)
|
||||
install(CODE "
|
||||
set(ENV{RZ_PREFIX} \"\${CMAKE_INSTALL_PREFIX}\")
|
||||
set(ENV{PATH} \"\${CMAKE_INSTALL_PREFIX};\$ENV{PATH}\")
|
||||
execute_process(COMMAND powershell \"${CMAKE_CURRENT_SOURCE_DIR}/bundle_rz_libswift.ps1\" \"\${CMAKE_INSTALL_PREFIX}\"
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
RESULT_VARIABLE SCRIPT_RESULT)
|
||||
if (SCRIPT_RESULT)
|
||||
message(FATAL_ERROR \"Failed to package rz-libswift\")
|
||||
endif()
|
||||
")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
################################################
|
||||
@ -93,6 +105,17 @@ if(APPLE)
|
||||
")
|
||||
endif()
|
||||
|
||||
if (CUTTER_PACKAGE_RZ_LIBSWIFT AND CUTTER_ENABLE_DEPENDENCY_DOWNLOADS)
|
||||
install(CODE "
|
||||
execute_process(COMMAND \"${CMAKE_CURRENT_SOURCE_DIR}/../scripts/rz-libswift.sh\" --pkg-config-path=\${CMAKE_INSTALL_PREFIX}/lib/pkgconfig --prefix=\${CMAKE_INSTALL_PREFIX}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
RESULT_VARIABLE SCRIPT_RESULT)
|
||||
if (SCRIPT_RESULT)
|
||||
message(FATAL_ERROR \"Failed to package rz-libswift\")
|
||||
endif()
|
||||
")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
################################################
|
||||
|
16
dist/bundle_rz_libswift.ps1
vendored
Normal file
16
dist/bundle_rz_libswift.ps1
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
$dist = $args[0]
|
||||
$python = Split-Path((Get-Command python.exe).Path)
|
||||
|
||||
if (-not (Test-Path -Path 'libswift' -PathType Container)) {
|
||||
git clone https://github.com/rizinorg/rz-libswift.git --depth 1 libswift
|
||||
}
|
||||
cd libswift
|
||||
& meson.exe --buildtype=release --prefix=$dist build
|
||||
ninja -C build install
|
||||
$pathdll = "$dist/lib/plugins/swift.dll"
|
||||
if(![System.IO.File]::Exists($pathdll)) {
|
||||
type build/meson-logs/meson-log.txt
|
||||
ls "$dist/lib/plugins/"
|
||||
throw (New-Object System.IO.FileNotFoundException("File not found: $pathdll", $pathdll))
|
||||
}
|
||||
Remove-Item -Recurse -Force $dist/lib/plugins/libswift.lib
|
19
scripts/rz-libswift.sh
Executable file
19
scripts/rz-libswift.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPTPATH=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
|
||||
|
||||
cd "$SCRIPTPATH/.."
|
||||
|
||||
if [[ ! -d libswift ]]; then
|
||||
git clone https://github.com/rizinorg/rz-libswift.git --depth 1 libswift
|
||||
fi
|
||||
|
||||
cd libswift
|
||||
rm -rf build || sleep 0
|
||||
mkdir build && cd build
|
||||
meson --buildtype=release "$@" ..
|
||||
ninja
|
||||
ninja install
|
||||
|
@ -564,7 +564,7 @@ void DecompilerContextMenu::updateTargetMenuActions()
|
||||
RzCoreLocked core = Core()->core();
|
||||
if (isReference()) {
|
||||
QString name;
|
||||
QMenu *menu;
|
||||
QMenu *menu = nullptr;
|
||||
if (annotationHere->type == RZ_CODE_ANNOTATION_TYPE_GLOBAL_VARIABLE
|
||||
|| annotationHere->type == RZ_CODE_ANNOTATION_TYPE_CONSTANT_VARIABLE) {
|
||||
menu = mainWindow->createShowInMenu(this, annotationHere->reference.offset,
|
||||
|
Loading…
Reference in New Issue
Block a user