Skip to content
Permalink
Browse files
new scripts to support using Windows SDK 7.0 as toolchain for simpler…
… download and install
  • Loading branch information
dch committed Sep 1, 2011
1 parent f6caa75 commit 92385e0cb6f9821dec9c411dc599cb9c45e40722
Show file tree
Hide file tree
Showing 2 changed files with 206 additions and 0 deletions.
@@ -0,0 +1,116 @@
::@echo off
title Prepare to Relax.
:: this script should be run from within your preferred compilation environment
:: either vcvars32.bat x86 (for Visual Studio)
:: or setenv.cmd /Release /x86 (for Windows SDKs)
:: this allows it to set up the correct links so that later scripts don't need
:: to detect them - its a messy and complicated process to automate as each SDK
:: or VC release, and each Windows version has slightly different locations.

:: our goal is to get the path set up in this order:
:: erlang and couchdb build helper scripts
:: Microsoft VC compiler and SDK 7.0
:: cygwin path for other build tools like make
:: the remaining windows system path

:: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\link.exe
:: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\cl.exe
:: C:\Program Files\Microsoft SDKs\Windows\v7.0\mc.exe
:: etc
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if "%RELAX%"=="" set RELAX=C:\relax
if not exist %RELAX% mkdir %RELAX%

:: find our source tree from one level up from current bin
set GLAZIER=%~dp0..

:: set these paths into the user environment for future usage
setx GLAZIER %GLAZIER%
setx RELAX %RELAX%

:: now we can set up new paths as junction points
echo setting up links to tools, SDK and VC++

:: set up junction point to make finding stuff simpler in unix path
:: VS90ComnTools is the only variable set by the initial install of VC++ 9.0
:: VS90COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\
:: the Windows SDK uses a different variable only after you've call SetEnv.cmd first
:: VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\
if not exist "%RELAX%\bin" mklink /d "%RELAX%\bin" "%GLAZIER%\bin"
if not exist "%RELAX%\bits" mklink /d "%RELAX%\bits" "%GLAZIER%\bits"
if defined VCINSTALLDIR mklink /d "%RELAX%\VC" "%VCINSTALLDIR%\.."
if defined VS90COMNTOOLS mklink /d "%RELAX%\VC" "%VS90COMNTOOLS%\..\.."
if not exist "%RELAX%\SDK" mklink /d "%RELAX%\SDK" "%programfiles%\Microsoft SDKs\Windows\v7.0"
if not exist "c:\cygwin\relax" mklink /d C:\cygwin\relax "%RELAX%"
::mklink /d "%RELAX%\openssl" c:\openssl

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
goto eof
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: transfer relevant environment variables across for later
::::: SDK vars
CPU=i386
FxTools=C:\Windows\Microsoft.NET\Framework\v3.5;C:\Windows\Microsoft.NET\Framework\v2.0.50727
Include=c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Include;C:\Program Files\Microsoft SDKs\Windows\v7.0\Include;C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\gl;
Lib=c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Lib;C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib;
MSSdk=C:\Program Files\Microsoft SDKs\Windows\v7.0
NODEBUG=1
ORIGINALPATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\relax\winmerge;c:\relax\7zip;c:\relax\cmake\bin;c:\relax\bin;Z:\Dropbox\tools\pstools;c:\erlang\bin;C:\NuGet\bin;
OS=Windows_NT
Path=c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Bin;c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcpackages;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE;C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\x64;C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin;C:\Windows\Microsoft.NET\Framework\v3.5;C:\Windows\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft SDKs\Windows\v7.0\Setup;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\relax\winmerge;c:\relax\7zip;c:\relax\cmake\bin;c:\relax\bin;Z:\Dropbox\tools\pstools;c:\erlang\bin;C:\NuGet\bin;
RegKeyPath=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7
SdkSetupDir=C:\Program Files\Microsoft SDKs\Windows\v7.0\Setup
SdkTools=C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\x64;C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin
TARGETOS=WINNT
VCINSTALLDIR=c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\
VCRoot=c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\
VSRegKeyPath=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7

:: base env vars
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\couch\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=RELAX
ComSpec=C:\Windows\system32\cmd.exe
FP_NO_HOST_CHECK=NO
GLAZIER=Z:\r\glazier\bin\..
HOMEDRIVE=C:
HOMEPATH=\Users\couch
LOCALAPPDATA=C:\Users\couch\AppData\Local
LOGONSERVER=\\RELAX
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\relax\winmerge;c:\relax\7zip;c:\relax\cmake\bin;c:\relax\bin;Z:\Dropbox\tools\pstools;c:\erlang\bin;C:\NuGet\bin;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 42 Stepping 7, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=2a07
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC=C:\Users\Public
RELAX=C:\relax
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\couch\AppData\Local\Temp
TMP=C:\Users\couch\AppData\Local\Temp
tools=z:\Dropbox\tools
USERDOMAIN=relax
USERNAME=couch
USERPROFILE=C:\Users\couch
VS100COMNTOOLS=c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\
windir=C:\Windows
windows_tracing_flags=3
windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log

:eof
endlocal
@@ -0,0 +1,90 @@
@echo off
title Time to Relax.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set CYGWIN=nontsec nodosfilewarning
if not exist c:\tmp mkdir c:\tmp
set TEMP=c:\tmp
set TMP=c:\tmp

::path=%windir%\system32;%windir%;%windir%\system32\wbem;%windir%\syswow64;

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: various compilation settings from SDKs, VC compiler/linker, etc
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: set LINK & CL to resolve manifest binding issues & virtualisation hack in ld.sh#171
set CL=/D_BIND_TO_CURRENT_VCLIBS_VERSION=1
:: SETting LINK buggers up couchdb/src/couchdb/priv libtool and subsequent driver creation
:: set LINK=/manifestuac:"level=asInvoker uiAccess=false"

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: following settings allow Erlang build to locate openssl correctly
:: and CouchDB to find ICU, Curl, and SSL if required
set USE_SSLEAY=1
set USE_OPENSSL=1
if not defined SSL_PATH set SSL_PATH=%RELAX%\openssl
if not defined ICU_PATH set ICU_PATH=%RELAX%\icu
if not defined CURL_PATH set CURL_PATH=%RELAX%\curl
if not defined ZLIB_PATH set ZLIB_PATH=%RELAX%\zlib

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: LIB and INCLUDE are preset by Windows SDK and/or Visual C++ shells
:: however VC++ uses LIB & INCLUDE and SDK uses Lib & Include. In Cygwin
:: these are *NOT* the same

set LIB=%RELAX%\VC\VC\lib;%RELAX%\SDK\lib;%LIB%
SET INCLUDE=%RELAX%\VC\VC\Include;%RELAX%\SDK\Include;%RELAX%\SDK\Include\gl;%INCLUDE%

set INCLUDE=%INCLUDE%;%SSL_PATH%\include\openssl;%SSL_PATH%\include;%CURL_PATH%\include\curl;%ICU_PATH%\include;%ZLIB_PATH%\include;
set LIBPATH=%LIBPATH%;%SSL_PATH%\lib;%CURL_PATH%\lib;%ICU_PATH%\lib;%ZLIB_PATH%\lib;
set LIB=%LIB%;%SSL_PATH%\lib;%CURL_PATH%\lib;%ICU_PATH%\lib;%ZLIB_PATH%\lib;

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::check which version of erlang setup we want
:: choice.exe exists on all windows platforms since MSDOS but not on XP
set /p choice=press 1 for R14b01, 3 for R14b03, 4 for R14b04, 0 (or wait) to exit to the shell
:: then get to unix goodness as fast as possible
if /i "%choice%"=="0" goto win_shell
::::if /i "%choice%"=="2" goto R......
if /i "%choice%"=="1" goto R14B01
if /i "%choice%"=="2" goto R14B02
if /i "%choice%"=="3" goto R14B03
if /i "%choice%"=="4" goto R14B04
if /i "%choice%"=="5" goto R14B05
:: else
goto eof

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:R14B03
set ERL_TOP=/relax/otp_src_R14B03
set ERL_VER=5.8.4
set OTP_VER=R14B03
goto unix_shell

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:R14B01
set ERL_TOP=/relax/otp_src_R14B01
set ERL_VER=5.8.2
set OTP_VER=R14B01
goto unix_shell

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:R14B04
set ERL_TOP=/relax/otp_src_R14B04
set ERL_VER=5.8.5
set OTP_VER=R14B04
goto unix_shell

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:unix_shell
title Building in %ERL_TOP% with OTP %OTP_VER% and Erlang v%ERL_VER%
c:\cygwin\bin\bash %RELAX%\bin\relax.sh
goto eof

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:win_shell
echo type exit to stop relaxing.
cmd.exe /k

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:eof
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

0 comments on commit 92385e0

Please sign in to comment.