Bundle r2dec on Appveyor (#913)

Thanks :)
This commit is contained in:
Paul I 2018-11-10 15:10:26 +03:00 committed by xarkes
parent b01de2d724
commit 87026dfe28
6 changed files with 31 additions and 5 deletions

View File

@ -46,10 +46,11 @@ before_build:
# Build config
build_script:
- cmd: if defined QMAKE ( call prepare_r2.bat && call build.bat )
- cmd: if defined QMAKE ( call prepare_r2.bat && call build.bat CUTTER_APPVEYOR_R2DEC=true )
- cmd: if defined MESON ( python meson.py --release --dist=%ARTIFACT_PATH% --backend=%BACKEND% --jupyter --webengine )
after_build:
- cmd: if defined QMAKE ( set "PATH=%CD%\r2_dist_%ARCH%;%PATH%" && powershell scripts\bundle_r2dec.ps1 "%CD%\%ARTIFACT_PATH%" )
- ps: $env:py_version = (python --version).Split()[1]
- ps: $env:py_platform = If ($env:ARCH -eq "x64") {"amd64"} Else {"win32"}
- ps: $env:py_url = "https://www.python.org/ftp/python/${env:py_version}/python-${env:py_version}-embed-${env:py_platform}.zip"

View File

@ -16,6 +16,6 @@ ECHO Building radare2 (%PLATFORM%)
CD radare2
git clean -xfd
RMDIR /S /Q ..\%R2DIST%
python sys\meson.py --release --shared --install=..\%R2DIST% --options "r2_datdir=radare2/share" "c_args=-D_UNICODE -DUNICODE"
python sys\meson.py --release --shared --install=..\%R2DIST% --options "r2_datdir=radare2/share" "r2_libdir=radare2/lib" "c_args=-D_UNICODE -DUNICODE"
IF !ERRORLEVEL! NEQ 0 EXIT /B 1
COPY /Y build\shlr\libr2sdb.a ..\%R2DIST%\lib\r_sdb.lib
COPY /Y build\shlr\libr2sdb.a ..\%R2DIST%\radare2\lib\r_sdb.lib

13
scripts/bundle_r2dec.ps1 Normal file
View File

@ -0,0 +1,13 @@
$dist = $args[0]
$python = Split-Path((Get-Command python.exe).Path)
git clone https://github.com/wargio/r2dec-js.git
cd r2dec-js
& $python\Scripts\meson.exe --buildtype=release p build
ninja -C build
Copy-Item . -Recurse -Destination $dist\radare2\lib\plugins\r2dec-js
Copy-Item build\core_pdd.dll -Destination $dist\radare2\lib\plugins
Remove-Item -Recurse -Force $dist\radare2\lib\plugins\r2dec-js\p
Remove-Item -Recurse -Force $dist\radare2\lib\plugins\r2dec-js\build
Remove-Item -Recurse -Force $dist\radare2\lib\plugins\r2dec-js\.git
Remove-Item -Recurse -Force $dist\radare2\lib\plugins\r2dec-js\.github

View File

@ -41,6 +41,9 @@ equals(CUTTER_ENABLE_JUPYTER, true) {
!defined(CUTTER_BUNDLE_R2_APPBUNDLE, var) CUTTER_BUNDLE_R2_APPBUNDLE=false
equals(CUTTER_BUNDLE_R2_APPBUNDLE, true) CONFIG += CUTTER_BUNDLE_R2_APPBUNDLE
!defined(CUTTER_APPVEYOR_R2DEC, var) CUTTER_APPVEYOR_R2DEC=false
equals(CUTTER_APPVEYOR_R2DEC, true) CONFIG += CUTTER_APPVEYOR_R2DEC
CUTTER_ENABLE_JUPYTER {
message("Jupyter support enabled.")
DEFINES += CUTTER_ENABLE_JUPYTER
@ -112,6 +115,11 @@ macx:CUTTER_BUNDLE_R2_APPBUNDLE {
DEFINES += MACOS_R2_BUNDLED
}
CUTTER_APPVEYOR_R2DEC {
message("Appveyor r2dec")
DEFINES += CUTTER_APPVEYOR_R2DEC
}
QMAKE_SUBSTITUTES += CutterConfig.h.in
SOURCES += \

View File

@ -189,6 +189,10 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
// Load plugins
loadPlugins();
#ifdef CUTTER_APPVEYOR_R2DEC
qputenv("R2DEC_HOME", "radare2\\lib\\plugins\\r2dec-js");
#endif
}
CutterApplication::~CutterApplication()

View File

@ -3,10 +3,10 @@ win32 {
DEFINES += _CRT_SECURE_NO_WARNINGS
INCLUDEPATH += "$$PWD/../radare2/libr/include/msvc"
!contains(QT_ARCH, x86_64) {
LIBS += -L"$$PWD/../r2_dist_x86/lib"
LIBS += -L"$$PWD/../r2_dist_x86/radare2/lib"
INCLUDEPATH += "$$PWD/../r2_dist_x86/include"
} else {
LIBS += -L"$$PWD/../r2_dist_x64/lib"
LIBS += -L"$$PWD/../r2_dist_x64/radare2/lib"
INCLUDEPATH += "$$PWD/../r2_dist_x64/include"
}