7 set _bootimage_version=latest
8 ) else if "%1"=="latest" (
9 set _bootimage_version=latest
10 ) else if "%1"=="update" (
11 set _bootimage_version=latest
12 ) else if "%1"=="clean" (
13 set _bootimage_version=clean
16 if not exist Nmakefile goto wrongdir
18 call cl 2>&1 | find "x86" >nul
20 echo x86-32 cl.exe detected.
22 set _bootimage=boot.windows-x86.32.image
24 call cl 2>&1 | find "x64" >nul
26 echo x86-64 cl.exe detected.
28 set _bootimage=boot.windows-x86.64.image
33 for /f %%x in ('git describe --all') do set GIT_DESCRIBE=%%x
34 for /f %%y in ('git rev-parse HEAD') do set GIT_ID=%%y
36 set git_label=%GIT_DESCRIBE%-%GIT_ID%
39 if %_bootimage_version%==clean (
40 set _git_branch=clean-windows-%_target%
41 set _bootimage_path=clean/windows-%_target%
43 set _git_branch=master
44 set _bootimage_path=latest
47 echo Deleting staging images from temp/...
48 del temp\staging.*.image
50 echo Updating working copy from %_git_branch%...
51 call git pull git://factorcode.org/git/factor.git %_git_branch%
52 if errorlevel 1 goto fail
55 nmake /nologo /f Nmakefile clean
56 if errorlevel 1 goto fail
57 nmake /nologo /f Nmakefile %_target%
58 if errorlevel 1 goto fail
60 echo Fetching %_bootimage_version% boot image...
61 cscript /nologo misc\http-get.vbs http://downloads.factorcode.org/images/%_bootimage_path%/%_bootimage% %_bootimage%
62 if errorlevel 1 goto fail
65 .\factor.com -i=%_bootimage%
66 if errorlevel 1 goto fail
68 echo Copying fresh factor.image to factor.image.fresh.
69 copy factor.image factor.image.fresh
70 if errorlevel 1 goto fail
80 echo build.cmd must be run from the root of the Factor source tree.
84 echo Unable to detect cl.exe target platform.
85 echo Make sure you're running within the Visual Studio or Windows SDK environment.
89 echo Usage: build.cmd [latest/clean]
90 echo Updates the working copy, cleans and builds the vm using nmake,
91 echo fetches a boot image, and bootstraps factor.
92 echo If latest is specified, then the working copy is updated to the
93 echo upstream "master" branch and the boot image corresponding to the
94 echo most recent factor build is downloaded. This is the default.
95 echo If clean is specified, then the working copy is updated to the
96 echo upstream "clean-windows-*" branch corresponding to the current
97 echo platform and the corresponding boot image is downloaded.