]> gitweb.factorcode.org Git - factor.git/blob - build-support/factor.cmd
"factor.cmd" script to automate update/build/bootstrap cycle for windows. remove...
[factor.git] / build-support / factor.cmd
1 @echo off\r
2 if not exist Nmakefile goto wrong_dir\r
3 \r
4 if /i %PROCESSOR_ARCHITECTURE%==AMD64 (\r
5     set _target="x86-64"\r
6     set _bootimage="boot.winnt-x86.64.image"\r
7 ) else (\r
8     set _target="x86-32"\r
9     set _bootimage="boot.winnt-x86.32.image"\r
10 )\r
11 \r
12 if "%1"=="/?" goto usage\r
13 \r
14 if "%1"=="" (\r
15     set _bootimage_version="latest"\r
16     set _git_branch=master\r
17 )\r
18 if "%1"=="latest" (\r
19     set _bootimage_version="latest"\r
20     set _git_branch=master\r
21 )\r
22 if "%1"=="clean" (\r
23     set _bootimage_version="clean"\r
24     set _git_branch=clean-winnt-%_target%\r
25 )\r
26 \r
27 if not defined _bootimage_version goto usage\r
28 \r
29 echo Updating working copy...\r
30 cmd /c "git pull http://factorcode.org/git/factor.git %_git_branch%"\r
31 if not errorlevel 0 goto fail\r
32 \r
33 echo Building vm...\r
34 nmake /nologo /f Nmakefile clean\r
35 if not errorlevel 0 goto fail\r
36 nmake /nologo /f Nmakefile %_target%\r
37 if not errorlevel 0 goto fail\r
38 \r
39 echo Fetching %_bootimage_version% boot image...\r
40 cscript /nologo build-support\http-get.vbs http://factorcode.org/images/%_bootimage_version%/%_bootimage% %_bootimage%\r
41 if not errorlevel 0 goto fail\r
42 \r
43 echo Bootstrapping...\r
44 .\factor.com -i=%_bootimage%\r
45 if not errorlevel 0 goto fail\r
46 \r
47 echo Build complete.\r
48 goto cleanup\r
49 \r
50 :fail\r
51 echo Build failed.\r
52 goto cleanup\r
53 \r
54 :wrong_dir\r
55 echo build-support\factor.cmd must be run from the root of the Factor source tree.\r
56 goto cleanup\r
57 \r
58 :usage\r
59 echo Usage: build-support\factor.cmd [latest/clean]\r
60 echo     Updates the working copy, cleans and builds the vm using nmake,\r
61 echo     fetches a boot image, and bootstraps factor.\r
62 echo     If latest is specified, then the working copy is updated to the\r
63 echo     upstream "master" branch and the boot image corresponding to the\r
64 echo     most recent factor build is downloaded. This is the default.\r
65 echo     If clean is specified, then the working copy is updated to the\r
66 echo     upstream "clean-winnt-*" branch corresponding to the current\r
67 echo     platform and the corresponding boot image is downloaded.\r
68 goto cleanup\r
69 \r
70 :cleanup\r
71 set _target=\r
72 set _bootimage=\r
73 set _bootimage_version=\r
74 set _git_branch=\r