build-support/factor.cmd: detect cl.exe platform and choose build platform based on that. fix errorlevel handling
parent
b60f8482e5
commit
17d07bdb0a
|
|
@ -1,13 +1,31 @@
|
||||||
@echo off
|
@echo off
|
||||||
if not exist Nmakefile goto wrong_dir
|
if not exist Nmakefile goto wrongdir
|
||||||
|
|
||||||
if /i %PROCESSOR_ARCHITECTURE%==AMD64 (
|
cl 2>&1 | find "x86" >nul
|
||||||
set _target="x86-64"
|
if not errorlevel 1 goto cl32
|
||||||
set _bootimage="boot.winnt-x86.64.image"
|
|
||||||
) else (
|
cl 2>&1 | find "x64" >nul
|
||||||
set _target="x86-32"
|
if not errorlevel 1 goto cl64
|
||||||
set _bootimage="boot.winnt-x86.32.image"
|
|
||||||
)
|
goto nocl
|
||||||
|
|
||||||
|
:cl32
|
||||||
|
echo x86-32 cl.exe detected.
|
||||||
|
set _target="x86-32"
|
||||||
|
set _bootimage="boot.winnt-x86.32.image"
|
||||||
|
goto platformdefined
|
||||||
|
|
||||||
|
:cl64
|
||||||
|
echo x86-64 cl.exe detected.
|
||||||
|
set _target="x86-64"
|
||||||
|
set _bootimage="boot.winnt-x86.64.image"
|
||||||
|
goto platformdefined
|
||||||
|
|
||||||
|
:nocl
|
||||||
|
echo "Unable to detect cl.exe target platform."
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:platformdefined
|
||||||
|
|
||||||
if "%1"=="/?" goto usage
|
if "%1"=="/?" goto usage
|
||||||
|
|
||||||
|
|
@ -27,31 +45,34 @@ if "%1"=="clean" (
|
||||||
if not defined _bootimage_version goto usage
|
if not defined _bootimage_version goto usage
|
||||||
|
|
||||||
echo Updating working copy...
|
echo Updating working copy...
|
||||||
cmd /c "git pull http://factorcode.org/git/factor.git %_git_branch%"
|
call git pull http://factorcode.org/git/factor.git %_git_branch%
|
||||||
if not errorlevel 0 goto fail
|
if errorlevel 1 goto fail
|
||||||
|
|
||||||
echo Building vm...
|
echo Building vm...
|
||||||
nmake /nologo /f Nmakefile clean
|
nmake /nologo /f Nmakefile clean
|
||||||
if not errorlevel 0 goto fail
|
if errorlevel 1 goto fail
|
||||||
nmake /nologo /f Nmakefile %_target%
|
nmake /nologo /f Nmakefile %_target%
|
||||||
if not errorlevel 0 goto fail
|
if errorlevel 1 goto fail
|
||||||
|
|
||||||
echo Fetching %_bootimage_version% boot image...
|
echo Fetching %_bootimage_version% boot image...
|
||||||
cscript /nologo build-support\http-get.vbs http://factorcode.org/images/%_bootimage_version%/%_bootimage% %_bootimage%
|
cscript /nologo build-support\http-get.vbs http://factorcode.org/images/%_bootimage_version%/%_bootimage% %_bootimage%
|
||||||
if not errorlevel 0 goto fail
|
if errorlevel 1 goto fail
|
||||||
|
|
||||||
echo Bootstrapping...
|
echo Bootstrapping...
|
||||||
.\factor.com -i=%_bootimage%
|
.\factor.com -i=%_bootimage%
|
||||||
if not errorlevel 0 goto fail
|
if errorlevel 1 goto fail
|
||||||
|
|
||||||
echo Build complete.
|
echo Build complete.
|
||||||
goto cleanup
|
goto cleanup
|
||||||
|
|
||||||
|
:nocl
|
||||||
|
echo
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
echo Build failed.
|
echo Build failed.
|
||||||
goto cleanup
|
goto cleanup
|
||||||
|
|
||||||
:wrong_dir
|
:wrongdir
|
||||||
echo build-support\factor.cmd must be run from the root of the Factor source tree.
|
echo build-support\factor.cmd must be run from the root of the Factor source tree.
|
||||||
goto cleanup
|
goto cleanup
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue