Cleanup Windows build scripts (#266)

This commit is contained in:
Paul I 2018-01-03 21:46:30 +03:00 committed by xarkes
parent 8b52c66f4f
commit ec7cef1394
2 changed files with 84 additions and 82 deletions

View File

@ -1,43 +1,37 @@
@echo off @ECHO off
SETLOCAL ENABLEDELAYEDEXPANSION
echo Setting path IF NOT DEFINED QT32PATH SET QT32PATH=C:\Qt\5.9.2\msvc2015
if "%OLDPATH%"=="" set OLDPATH=%PATH% IF NOT DEFINED QT64PATH SET QT64PATH=C:\Qt\5.9.2\msvc2015_64
if "%QT32PATH%"=="" set QT32PATH=C:\Qt\5.9.2\msvc2015 IF NOT DEFINED VSVARSALLPATH SET VSVARSALLPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
if "%QT64PATH%"=="" set QT64PATH=C:\Qt\5.9.2\msvc2015_64
if "%VSVARSALLPATH%"=="" set VSVARSALLPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
if "%1" == "32" ( if "%1" == "32" (
set "PATH=%QT32PATH%\bin;%PATH%" SET "PATH=%QT32PATH%\bin;%PATH%"
call "%VSVARSALLPATH%" x86 CALL "%VSVARSALLPATH%" x86
set MSBUILDPLATFORM=Win32 SET MSBUILDPLATFORM=Win32
) else if "%1" == "64" ( ) else if "%1" == "64" (
set "PATH=%QT64PATH%\bin;%PATH%" SET "PATH=%QT64PATH%\bin;%PATH%"
call "%VSVARSALLPATH%" x64 CALL "%VSVARSALLPATH%" x64
set MSBUILDPLATFORM=x64 SET MSBUILDPLATFORM=x64
) else ( ) else (
echo Usage: build.bat 32/64 ECHO Usage: %0 {32^|64}
goto restorepath EXIT /B
) )
echo Preparing directory ECHO Preparing directory
rmdir /s /q build%1 RMDIR /S /Q build%1
mkdir build%1 MKDIR build%1
cd build%1 CD build%1
echo Building cutter ECHO Building cutter
qmake ..\src\cutter.pro -config release -tp vc qmake ..\src\cutter.pro -config release -tp vc
if not %ERRORLEVEL%==0 exit IF !ERRORLEVEL! NEQ 0 EXIT /B
msbuild /m cutter.vcxproj /p:Configuration=Release;Platform=%MSBUILDPLATFORM% msbuild /m cutter.vcxproj /p:Configuration=Release;Platform=%MSBUILDPLATFORM%
if not %ERRORLEVEL%==0 exit IF !ERRORLEVEL! NEQ 0 EXIT /B
echo Deploying cutter ECHO Deploying cutter
mkdir cutter%1 MKDIR cutter%1
move release\cutter.exe cutter%1\cutter.exe MOVE release\cutter.exe cutter%1\cutter.exe
xcopy /s ..\dist%1 cutter%1\ XCOPY /S ..\dist%1 cutter%1\
windeployqt cutter%1\cutter.exe windeployqt cutter%1\cutter.exe
cd .. CD ..
:restorepath
echo Restoring path
set PATH=%OLDPATH%
set OLDPATH=

View File

@ -1,60 +1,68 @@
@echo off @ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
if "%OLDPATH%"=="" set OLDPATH=%PATH% SET BADARG=1
if "%PYTHON%"=="" set PYTHON=C:\Python36-x64 FOR %%i IN ("" "32" "64") DO (IF "%1" == %%i SET BADARG=)
if "%NINJA_URL%"=="" set NINJA_URL=https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip IF DEFINED BADARG (
if "%VSVARSALLPATH%"=="" set VSVARSALLPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat ECHO Usage: %0 [32^|64]
EXIT /B
)
SET BITS=%1
set "PYTHONHOME=%PYTHON%" FOR %%i IN (python.exe) DO (IF NOT DEFINED PYTHON SET PYTHON=%%~dp$PATH:i)
set "PATH=%PYTHON%;%PATH%"
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 git submodule update --init
echo Downloading meson and ninja ECHO Downloading meson and ninja
python -m pip install meson && COPY %PYTHON%\Scripts\meson.py meson.py python -m pip install meson
if defined NINJA_URL ( powershell -Command wget %NINJA_URL% -OutFile ninja.zip && unzip -o ninja.zip -d .\ && del ninja.zip ) 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" ( IF NOT "%BITS%" == "32" (
set VARSALL=x64 SET VARSALL=x64
set BI=64 SET BI=64
call :BUILD CALL :BUILD
IF !ERRORLEVEL! NEQ 0 EXIT /B
) )
IF NOT "%BITS%" == "64" ( IF NOT "%BITS%" == "64" (
set VARSALL=x86 SET VARSALL=x86
set BI=32 SET BI=32
call :BUILD CALL :BUILD
IF !ERRORLEVEL! NEQ 0 EXIT /B
) )
GOTO :END ECHO Copying relevant files in cutter_win32
IF "%BITS%" == "64" (
XCOPY /S /Y dist64\include\libr cutter_win32\radare2\include\libr\
) ELSE (
XCOPY /S /Y dist32\include\libr cutter_win32\radare2\include\libr\
)
EXIT /B
:BUILD :BUILD
echo Building radare2 (%VARSALL%) ECHO Building radare2 (%VARSALL%)
cd radare2 CD radare2
git clean -xfd git clean -xfd
copy ..\ninja.exe .\ RMDIR /s /q ..\dist%BI%
copy ..\meson.py .\ CALL "%VSVARSALLPATH%" %VARSALL%
rmdir /s /q ..\dist%BI% python sys\meson.py --release --shared --prefix="%CD%"
call "%VSVARSALLPATH%" %VARSALL% IF !ERRORLEVEL! NEQ 0 EXIT /B 1
%PYTHON%\python.exe sys\meson.py --release --shared --prefix="%CD%" CALL sys\meson_install.bat --with-static ..\dist%BI%
if not %ERRORLEVEL%==0 exit COPY /Y build\r_userconf.h ..\dist%BI%\include\libr\
call sys\meson_install.bat --with-static ..\dist%BI% COPY /Y build\r_version.h ..\dist%BI%\include\libr\
copy /Y build\r_userconf.h ..\dist%BI%\include\libr\ COPY /Y build\shlr\liblibr2sdb.a ..\dist%BI%\r_sdb.lib
copy /Y build\r_version.h ..\dist%BI%\include\libr\ CD ..
copy /Y build\shlr\liblibr2sdb.a ..\dist%BI%\r_sdb.lib COPY /Y dist%BI%\*.lib cutter_win32\radare2\lib%BI%\
cd ..
copy /Y dist%BI%\*.lib cutter_win32\radare2\lib%BI%\
EXIT /B 0 EXIT /B 0
:END
echo Copying relevant files in cutter_win32
IF "%BITS%"=="64" (
xcopy /s /Y dist64\include\libr cutter_win32\radare2\include\libr\
) ELSE (
xcopy /s /Y dist32\include\libr cutter_win32\radare2\include\libr\
)
del ninja.exe
del meson.py
set PATH=%OLDPATH%
set OLDPATH=