mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 10:56:11 +00:00
Add cmake script for packaging r2dec on windows. (#2425)
This commit is contained in:
parent
38b317e619
commit
c49cbc9f01
1
.github/workflows/ccpp.yml
vendored
1
.github/workflows/ccpp.yml
vendored
@ -124,6 +124,7 @@ jobs:
|
||||
-DCUTTER_ENABLE_PYTHON_BINDINGS=ON ^
|
||||
-DCUTTER_PACKAGE_DEPENDENCIES=ON ^
|
||||
-DCUTTER_PACKAGE_R2GHIDRA=ON ^
|
||||
-DCUTTER_PACKAGE_R2DEC=ON ^
|
||||
-DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON ^
|
||||
-DCUTTER_ENABLE_CRASH_REPORTS=ON ^
|
||||
-DCMAKE_PREFIX_PATH="%CUTTER_DEPS%\pyside" ^
|
||||
|
@ -1,9 +1,11 @@
|
||||
$dist = $args[0]
|
||||
$python = Split-Path((Get-Command python.exe).Path)
|
||||
|
||||
git clone https://github.com/radareorg/r2dec-js.git
|
||||
if (-not (Test-Path -Path 'r2dec-js' -PathType Container)) {
|
||||
git clone https://github.com/radareorg/r2dec-js.git --branch master --depth 1
|
||||
}
|
||||
cd r2dec-js
|
||||
git checkout b5a0d15c7bcc488f268ffb0931b7ced2919f6c9d
|
||||
#git checkout b5a0d15c7bcc488f268ffb0931b7ced2919f6c9d
|
||||
& meson.exe --buildtype=release -Dc_args=-DDUK_USE_DATE_NOW_WINDOWS --prefix=$dist --libdir=lib\plugins --datadir=lib\plugins p build
|
||||
ninja -C build install
|
||||
Remove-Item -Recurse -Force $dist\lib\plugins\core_pdd.lib
|
||||
|
@ -7,10 +7,10 @@ SCRIPTPATH=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
|
||||
cd "$SCRIPTPATH/.."
|
||||
|
||||
if [[ ! -d r2dec-js ]]; then
|
||||
git clone https://github.com/wargio/r2dec-js.git
|
||||
cd r2dec-js
|
||||
git checkout b5a0d15c7bcc488f268ffb0931b7ced2919f6c9d
|
||||
cd ..
|
||||
git clone https://github.com/radareorg/r2dec-js.git --depth 1 --branch master
|
||||
#cd r2dec-js
|
||||
#git checkout b5a0d15c7bcc488f268ffb0931b7ced2919f6c9d
|
||||
#cd ..
|
||||
fi
|
||||
|
||||
cd r2dec-js
|
||||
|
@ -24,6 +24,7 @@ set(CUTTER_EXTRA_PLUGIN_DIRS "" CACHE STRING "List of addition plugin locations"
|
||||
option(CUTTER_ENABLE_DEPENDENCY_DOWNLOADS "Enable downloading of dependencies. Setting to OFF doesn't affect any downloads done by r2 build." OFF)
|
||||
option(CUTTER_PACKAGE_DEPENDENCIES "During install step include the third party dependencies." OFF)
|
||||
option(CUTTER_PACKAGE_R2GHIDRA "Compile and install r2ghidra during install step." OFF)
|
||||
option(CUTTER_PACKAGE_R2DEC "Compile and install r2dec during install step." OFF)
|
||||
|
||||
if(NOT CUTTER_ENABLE_PYTHON)
|
||||
set(CUTTER_ENABLE_PYTHON_BINDINGS OFF)
|
||||
@ -263,6 +264,10 @@ if (CUTTER_APPIMAGE_BUILD)
|
||||
target_compile_definitions(Cutter PRIVATE APPIMAGE)
|
||||
endif()
|
||||
|
||||
if (CUTTER_PACKAGE_R2DEC)
|
||||
target_compile_definitions(Cutter PRIVATE CUTTER_APPVEYOR_R2DEC)
|
||||
endif()
|
||||
|
||||
include(Translations)
|
||||
|
||||
# Install files
|
||||
|
@ -12,47 +12,58 @@ if(WIN32)
|
||||
install(FILES ${CUTTER_DEPS}/pyside/bin/shiboken2.abi3.dll ${CUTTER_DEPS}/pyside/bin/pyside2.abi3.dll DESTINATION .)
|
||||
endif()
|
||||
install(SCRIPT cmake/WindowsBundleQt.cmake)
|
||||
|
||||
if (CUTTER_PACKAGE_R2GHIDRA)
|
||||
if (CUTTER_ENABLE_DEPENDENCY_DOWNLOADS)
|
||||
# Currently using external project only for downloading source
|
||||
# It neeeds to link against compiled cutter so for now build it using custom install script.
|
||||
# That way r2ghidra build process is the same as with any other external plugin built against
|
||||
# installed Cutter.
|
||||
ExternalProject_Add(R2Ghidra
|
||||
GIT_REPOSITORY https://github.com/radareorg/r2ghidra.git
|
||||
GIT_TAG master
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
endif()
|
||||
install(CODE "
|
||||
execute_process(
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/R2Ghidra-prefix/src/R2Ghidra-build
|
||||
RESULT_VARIABLE SCRIPT_RESULT
|
||||
COMMAND \${CMAKE_COMMAND}
|
||||
../R2Ghidra
|
||||
-DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=\"\${CMAKE_INSTALL_PREFIX}\;\${CMAKE_INSTALL_PREFIX}/include/libr\;\${CMAKE_INSTALL_PREFIX}/include/libr/sdb\"
|
||||
-DCMAKE_INSTALL_PREFIX=\${CMAKE_INSTALL_PREFIX}
|
||||
-DRADARE2_INSTALL_PLUGDIR=\${CMAKE_INSTALL_PREFIX}/lib/plugins
|
||||
-DCUTTER_INSTALL_PLUGDIR=plugins/native
|
||||
-DBUILD_CUTTER_PLUGIN=ON
|
||||
-DBUILD_SLEIGH_PLUGIN=OFF
|
||||
-G Ninja
|
||||
)
|
||||
if (SCRIPT_RESULT)
|
||||
message(FATAL_ERROR \"Failed to configure r2ghidra\")
|
||||
endif()
|
||||
execute_process(WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/R2Ghidra-prefix/src/R2Ghidra-build
|
||||
RESULT_VARIABLE SCRIPT_RESULT
|
||||
COMMAND \${CMAKE_COMMAND} --build . --target install
|
||||
)
|
||||
if (SCRIPT_RESULT)
|
||||
message(FATAL_ERROR \"Failed to install r2ghidra plugin\")
|
||||
endif()
|
||||
")
|
||||
endif()
|
||||
if (CUTTER_PACKAGE_R2GHIDRA)
|
||||
if (CUTTER_ENABLE_DEPENDENCY_DOWNLOADS)
|
||||
# Currently using external project only for downloading source
|
||||
# It neeeds to link against compiled cutter so for now build it using custom install script.
|
||||
# That way r2ghidra build process is the same as with any other external plugin built against
|
||||
# installed Cutter.
|
||||
ExternalProject_Add(R2Ghidra
|
||||
GIT_REPOSITORY https://github.com/radareorg/r2ghidra.git
|
||||
GIT_TAG master
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
endif()
|
||||
install(CODE "
|
||||
execute_process(
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/R2Ghidra-prefix/src/R2Ghidra-build
|
||||
RESULT_VARIABLE SCRIPT_RESULT
|
||||
COMMAND \${CMAKE_COMMAND}
|
||||
../R2Ghidra
|
||||
-DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=\"\${CMAKE_INSTALL_PREFIX}\;\${CMAKE_INSTALL_PREFIX}/include/libr\;\${CMAKE_INSTALL_PREFIX}/include/libr/sdb\"
|
||||
-DCMAKE_INSTALL_PREFIX=\${CMAKE_INSTALL_PREFIX}
|
||||
-DRADARE2_INSTALL_PLUGDIR=\${CMAKE_INSTALL_PREFIX}/lib/plugins
|
||||
-DCUTTER_INSTALL_PLUGDIR=plugins/native
|
||||
-DBUILD_CUTTER_PLUGIN=ON
|
||||
-DBUILD_SLEIGH_PLUGIN=OFF
|
||||
-G Ninja
|
||||
)
|
||||
if (SCRIPT_RESULT)
|
||||
message(FATAL_ERROR \"Failed to configure r2ghidra\")
|
||||
endif()
|
||||
execute_process(WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/R2Ghidra-prefix/src/R2Ghidra-build
|
||||
RESULT_VARIABLE SCRIPT_RESULT
|
||||
COMMAND \${CMAKE_COMMAND} --build . --target install
|
||||
)
|
||||
if (SCRIPT_RESULT)
|
||||
message(FATAL_ERROR \"Failed to install r2ghidra plugin\")
|
||||
endif()
|
||||
")
|
||||
endif()
|
||||
if (CUTTER_PACKAGE_R2DEC AND CUTTER_ENABLE_DEPENDENCY_DOWNLOADS)
|
||||
install(CODE "
|
||||
set(ENV{R_ALT_SRC_DIR} 1)
|
||||
set(ENV{PATH} \"\${CMAKE_INSTALL_PREFIX};\$ENV{PATH}\")
|
||||
execute_process(COMMAND powershell ../scripts/bundle_r2dec.ps1 \"\${CMAKE_INSTALL_PREFIX}\"
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
RESULT_VARIABLE SCRIPT_RESULT)
|
||||
if (SCRIPT_RESULT)
|
||||
message(FATAL_ERROR \"Failed to package r2dec\")
|
||||
endif()
|
||||
")
|
||||
endif()
|
||||
endif()
|
||||
include(CPack)
|
||||
|
Loading…
Reference in New Issue
Block a user