From 0993e6883d2912877371b066c7dd580d3b0b6b07 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Mon, 24 May 2010 15:56:00 -0700 Subject: [PATCH] "factor.cmd" script to automate update/build/bootstrap cycle for windows. remove bootimage-* targets from nmakefile --- Nmakefile | 22 +++++------- build-support/factor.cmd | 74 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 14 deletions(-) create mode 100644 build-support/factor.cmd diff --git a/Nmakefile b/Nmakefile index 8f60176d58..1e6d3a0d42 100755 --- a/Nmakefile +++ b/Nmakefile @@ -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 diff --git a/build-support/factor.cmd b/build-support/factor.cmd new file mode 100644 index 0000000000..473e44ee40 --- /dev/null +++ b/build-support/factor.cmd @@ -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= -- 2.34.1