Add rz-silhouette to cutter builds (#3161)

This commit is contained in:
Giovanni 2023-04-11 11:35:52 +08:00 committed by GitHub
parent fcd504d87f
commit 3166843dff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 64 additions and 0 deletions

View File

@ -155,6 +155,7 @@ jobs:
-DCUTTER_PACKAGE_JSDEC=ON \
-DCUTTER_PACKAGE_RZ_LIBSWIFT=ON \
-DCUTTER_PACKAGE_RZ_LIBYARA=ON \
-DCUTTER_PACKAGE_RZ_SILHOUETTE=ON \
-DCMAKE_INSTALL_PREFIX=appdir/usr \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \
..
@ -227,6 +228,7 @@ jobs:
-DCUTTER_PACKAGE_JSDEC=ON \
-DCUTTER_PACKAGE_RZ_LIBSWIFT=ON \
-DCUTTER_PACKAGE_RZ_LIBYARA=ON \
-DCUTTER_PACKAGE_RZ_SILHOUETTE=ON \
-DCPACK_PACKAGE_FILE_NAME="$PACKAGE_NAME" \
-DCPACK_BUNDLE_APPLE_CERT_APP="-" \
.. && \
@ -266,6 +268,7 @@ jobs:
-DCUTTER_PACKAGE_RZ_GHIDRA=ON ^
-DCUTTER_PACKAGE_RZ_LIBSWIFT=ON ^
-DCUTTER_PACKAGE_RZ_LIBYARA=ON ^
-DCUTTER_PACKAGE_RZ_SILHOUETTE=ON ^
-DCUTTER_PACKAGE_JSDEC=ON ^
-DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON ^
-DCMAKE_PREFIX_PATH="%CUTTER_DEPS%\pyside" ^

View File

@ -28,6 +28,7 @@ pipeline:
-DCUTTER_PACKAGE_JSDEC=ON
-DCUTTER_PACKAGE_RZ_LIBSWIFT=ON
-DCUTTER_PACKAGE_RZ_LIBYARA=ON
-DCUTTER_PACKAGE_RZ_SILHOUETTE=ON
-DCPACK_PACKAGE_FILE_NAME="$$PACKAGE_NAME"
-DCPACK_BUNDLE_APPLE_CERT_APP="-"
- ninja -C build

View File

@ -27,6 +27,7 @@ option(CUTTER_PACKAGE_DEPENDENCIES "During install step include the third party
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_RZ_LIBYARA "Compile and install rz-libyara during the install step." OFF)
option(CUTTER_PACKAGE_RZ_SILHOUETTE "Compile and install rz-silhouette during the install step." OFF)
option(CUTTER_PACKAGE_JSDEC "Compile and install jsdec during install step." OFF)
OPTION(CUTTER_QT6 "Use QT6" OFF)
@ -161,6 +162,7 @@ message(STATUS "- Package Dependencies: ${CUTTER_PACKAGE_DEPENDENCIES}")
message(STATUS "- Package RzGhidra: ${CUTTER_PACKAGE_RZ_GHIDRA}")
message(STATUS "- Package RzLibSwift: ${CUTTER_PACKAGE_RZ_LIBSWIFT}")
message(STATUS "- Package RzLibYara: ${CUTTER_PACKAGE_RZ_LIBYARA}")
message(STATUS "- Package RzSilhouette: ${CUTTER_PACKAGE_RZ_SILHOUETTE}")
message(STATUS "- Package JSDec: ${CUTTER_PACKAGE_JSDEC}")
message(STATUS "- QT6: ${CUTTER_QT6}")
message(STATUS "")

24
dist/CMakeLists.txt vendored
View File

@ -59,6 +59,18 @@ if(WIN32)
endif()
")
endif()
if (CUTTER_PACKAGE_RZ_SILHOUETTE 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_silhouette.ps1\" \"\${CMAKE_INSTALL_PREFIX}\"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE SCRIPT_RESULT)
if (SCRIPT_RESULT)
message(FATAL_ERROR \"Failed to package rz-silhouette (returned \${SCRIPT_RESULT})\")
endif()
")
endif()
endif()
################################################
@ -150,6 +162,18 @@ if(CUTTER_ENABLE_DEPENDENCY_DOWNLOADS AND (NOT WIN32))
endif()
")
endif()
if (CUTTER_PACKAGE_RZ_SILHOUETTE)
install(CODE "
execute_process(COMMAND
\"${CMAKE_CURRENT_SOURCE_DIR}/../scripts/rz-silhouette.sh\"
\"\${CMAKE_INSTALL_PREFIX}\" \"${YARA_PLUGIN_OPTIONS}\"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE SCRIPT_RESULT)
if (SCRIPT_RESULT)
message(FATAL_ERROR \"Failed to package rz-silhouette (returned \${SCRIPT_RESULT})\")
endif()
")
endif()
endif()
################################################

17
dist/bundle_rz_silhouette.ps1 vendored Normal file
View File

@ -0,0 +1,17 @@
$dist = $args[0]
$cmake_opts = $args[1]
$python = Split-Path((Get-Command python.exe).Path)
if (-not (Test-Path -Path 'rz-silhouette' -PathType Container)) {
git clone https://github.com/rizinorg/rz-silhouette.git --depth 1 rz-silhouette
}
cd rz-silhouette
& meson.exe --buildtype=release --prefix=$dist build
ninja -C build install
$pathdll = "$dist/lib/plugins/rz_silhouette.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/rz_silhouette.lib

17
scripts/rz-silhouette.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
set -e
SCRIPTPATH=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
INSTALL_PREFIX="$1"
EXTRA_CMAKE_OPTS="$2"
cd "$SCRIPTPATH/.."
if [[ ! -d rz-silhouette ]]; then
git clone https://github.com/rizinorg/rz-silhouette.git --depth 1 rz-silhouette
fi
cd rz-silhouette
meson --buildtype=release --pkg-config-path="$INSTALL_PREFIX/lib/pkgconfig" --prefix="$INSTALL_PREFIX" build
ninja -C build install