"factor.cmd" script to automate update/build/bootstrap cycle for windows. remove bootimage-* targets from nmakefile

db4
Joe Groff 2010-05-24 15:56:00 -07:00
parent 492e07723c
commit 0993e6883d
2 changed files with 82 additions and 14 deletions

View File

@ -106,25 +106,19 @@ default:
@exit 1
x86-32:
nmake PLATFORM=x86-32 /f Nmakefile all
nmake /nologo PLATFORM=x86-32 /f Nmakefile all
x86-64:
nmake PLATFORM=x86-64 /f Nmakefile all
nmake /nologo PLATFORM=x86-64 /f Nmakefile all
clean:
del vm\*.obj
del factor.lib
del factor.com
del factor.exe
del factor.dll
del factor.dll.lib
if exist factor.lib del factor.lib
if exist factor.com del factor.com
if exist factor.exe del factor.exe
if exist factor.dll del factor.dll
if exist factor.dll.lib del factor.dll.lib
bootimage-x86-32:
cscript /nologo build-support\http-get.vbs http://factorcode.org/images/$(BOOTIMAGE_VERSION)/boot.winnt-x86.32.image boot.winnt-x86.32.image
bootimage-x86-64:
cscript /nologo build-support\http-get.vbs http://factorcode.org/images/$(BOOTIMAGE_VERSION)/boot.winnt-x86.64.image boot.winnt.x86.64.image
.PHONY: all bootimage-x86-32 bootimage-x86-64 default x86-32 x86-64 clean
.PHONY: all default x86-32 x86-64 clean
.SUFFIXES: .rs

74
build-support/factor.cmd Normal file
View File

@ -0,0 +1,74 @@
@echo off
if not exist Nmakefile goto wrong_dir
if /i %PROCESSOR_ARCHITECTURE%==AMD64 (
set _target="x86-64"
set _bootimage="boot.winnt-x86.64.image"
) else (
set _target="x86-32"
set _bootimage="boot.winnt-x86.32.image"
)
if "%1"=="/?" goto usage
if "%1"=="" (
set _bootimage_version="latest"
set _git_branch=master
)
if "%1"=="latest" (
set _bootimage_version="latest"
set _git_branch=master
)
if "%1"=="clean" (
set _bootimage_version="clean"
set _git_branch=clean-winnt-%_target%
)
if not defined _bootimage_version goto usage
echo Updating working copy...
cmd /c "git pull http://factorcode.org/git/factor.git %_git_branch%"
if not errorlevel 0 goto fail
echo Building vm...
nmake /nologo /f Nmakefile clean
if not errorlevel 0 goto fail
nmake /nologo /f Nmakefile %_target%
if not errorlevel 0 goto fail
echo Fetching %_bootimage_version% boot image...
cscript /nologo build-support\http-get.vbs http://factorcode.org/images/%_bootimage_version%/%_bootimage% %_bootimage%
if not errorlevel 0 goto fail
echo Bootstrapping...
.\factor.com -i=%_bootimage%
if not errorlevel 0 goto fail
echo Build complete.
goto cleanup
:fail
echo Build failed.
goto cleanup
:wrong_dir
echo build-support\factor.cmd must be run from the root of the Factor source tree.
goto cleanup
:usage
echo Usage: build-support\factor.cmd [latest/clean]
echo Updates the working copy, cleans and builds the vm using nmake,
echo fetches a boot image, and bootstraps factor.
echo If latest is specified, then the working copy is updated to the
echo upstream "master" branch and the boot image corresponding to the
echo most recent factor build is downloaded. This is the default.
echo If clean is specified, then the working copy is updated to the
echo upstream "clean-winnt-*" branch corresponding to the current
echo platform and the corresponding boot image is downloaded.
goto cleanup
:cleanup
set _target=
set _bootimage=
set _bootimage_version=
set _git_branch=