forked from rizinorg/cutter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare_r2.bat
61 lines (51 loc) · 1.8 KB
/
prepare_r2.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SET BADARG=1
FOR %%i IN ("32" "64") DO (IF "%1" == %%i SET BADARG=)
IF DEFINED BADARG (
ECHO Usage: %0 [32^|64]
EXIT /B
)
SET BITS=%1
FOR %%i IN (python.exe) DO (IF NOT DEFINED PYTHON SET PYTHON=%%~dp$PATH:i)
IF NOT DEFINED PYTHON SET PYTHON=C:\Program Files\Python36
IF NOT DEFINED NINJA_URL SET NINJA_URL=https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip
IF NOT DEFINED VSVARSALLPATH SET VSVARSALLPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
IF NOT EXIST %PYTHON%\python.exe EXIT /B
SET "PYTHONHOME=%PYTHON%"
SET "PATH=%CD%;%PYTHON%;%PYTHON%\Scripts;%PATH%"
git submodule update --init
ECHO Downloading meson and ninja
python -m pip install meson
IF !ERRORLEVEL! NEQ 0 EXIT /B
IF NOT EXIST ninja.exe (
powershell -Command wget %NINJA_URL% -OutFile ninja.zip && powershell -Command Expand-Archive .\ninja.zip -DestinationPath .\ && DEL ninja.zip
IF !ERRORLEVEL! NEQ 0 EXIT /B
)
IF NOT "%BITS%" == "32" (
SET VARSALL=x64
CALL :BUILD
IF !ERRORLEVEL! NEQ 0 EXIT /B
)
IF NOT "%BITS%" == "64" (
SET VARSALL=x86
CALL :BUILD
IF !ERRORLEVEL! NEQ 0 EXIT /B
)
ECHO Copying relevant files in cutter_win32
XCOPY /S /Y dist%BITS%\include\libr cutter_win32\radare2\include\libr\
EXIT /B
:BUILD
ECHO Building radare2 (%VARSALL%)
CD radare2
git clean -xfd
RMDIR /s /q ..\dist%BITS%
CALL "%VSVARSALLPATH%" %VARSALL%
python sys\meson.py --release --prefix="%CD%" --install=..\dist%BITS% --shared --copylib
IF !ERRORLEVEL! NEQ 0 EXIT /B 1
COPY /Y build\r_userconf.h ..\dist%BITS%\include\libr\
COPY /Y build\r_version.h ..\dist%BITS%\include\libr\
COPY /Y build\shlr\liblibr2sdb.a ..\dist%BITS%\r_sdb.lib
CD ..
COPY /Y dist%BITS%\*.lib cutter_win32\radare2\lib%BITS%\
EXIT /B 0