1setlocal EnableDelayedExpansion
2set PATH=C:\cygwin64\bin\;%PATH%
3set PLATFORM=Any CPU
4for /r %%i in (*.sh) do  CALL :convert_to_unix_newline %%i
5
6call bash -lc build.sh
7if %errorlevel% neq 0 exit /b %errorlevel%
8
9REM Need to use call for all functions outside of script, otherwise label handling go crazy
10call mkdir %LIBRARY_PREFIX%\renode\exec
11call mkdir %LIBRARY_PREFIX%\renode\tests
12call mkdir %LIBRARY_PREFIX%\renode\scripts
13call mkdir %LIBRARY_PREFIX%\renode\platforms
14call mkdir %LIBRARY_PREFIX%\renode\licenses
15call robocopy output\bin\Release\ %LIBRARY_PREFIX%\renode\exec\ /njh /njs /ndl /S
16call robocopy tests\ %LIBRARY_PREFIX%\renode\tests /njh /njs /ndl /S
17call robocopy scripts\ %LIBRARY_PREFIX%\renode\scripts /njh /njs /ndl /S
18call robocopy platforms\ %LIBRARY_PREFIX%\renode\platforms /njh /njs /ndl /S
19call robocopy .\ %LIBRARY_PREFIX%\renode\ .renode-root
20call robocopy .\ %LIBRARY_PREFIX%\renode\ LICENSE
21
22REM Copy all licenses. LIBRARY_PREFIX has to be converted to the Unix format first.
23FOR /F "delims=" %%i IN ('cygpath.exe -u "%LIBRARY_PREFIX%"') DO set "UNIX_LIBRARY_PREFIX=%%i"
24call bash -lc "tools/packaging/common_copy_licenses.sh $UNIX_LIBRARY_PREFIX/renode/licenses windows"
25if %errorlevel% neq 0 exit /b %errorlevel%
26
27
28REM Add activation script to append renode dir to PATH
29if not exist %PREFIX%\etc\conda\activate.d call mkdir %PREFIX%\etc\conda\activate.d
30call copy %RECIPE_DIR%\activate.bat %PREFIX%\etc\conda\activate.d\%PKG_NAME%_activate.bat
31call copy %RECIPE_DIR%\activate-win.sh %PREFIX%\etc\conda\activate.d\%PKG_NAME%_activate.sh
32
33if not exist %PREFIX%\etc\conda\deactivate.d call mkdir %PREFIX%\etc\conda\deactivate.d
34call copy %RECIPE_DIR%\deactivate-win.sh %PREFIX%\etc\conda\deactivate.d\%PKG_NAME%_deactivate.sh
35
36REM PS1 scripts can't modify PATH so put a PowerShell script running Renode in PATH.
37if not exist %PREFIX%\Library\bin call mkdir %PREFIX%\Library\bin
38call copy %RECIPE_DIR%\Renode.ps1 %PREFIX%\Library\bin\Renode.ps1
39
40EXIT /B 0
41
42:convert_to_unix_newline
43powershell -Command "(Get-Content %~1 -Raw).Replace(\"`r\",\"\") |Set-Content -NoNewLine %~1 -Force"
44EXIT /B 0
45
46