|
|
1.1 root 1: ::
1.1.1.5 root 2: :: Copyright (c) 2008-2009 TrueCrypt Foundation. All rights reserved.
1.1 root 3: ::
1.1.1.6 ! root 4: :: Governed by the TrueCrypt License 2.7 the full text of which is contained
1.1 root 5: :: in the file License.txt included in TrueCrypt binary and source code
6: :: distribution packages.
7: ::
8:
9: :: Usage: BuildDriver <-build|-rebuild|-clean> <-release|-debug> <-x86|-x64> <dir1> [dir2] ...
10:
11: @echo off
12: set TC_ARG_CMD=%~1
13: shift
14: set TC_ARG_TYPE=%~1
15: shift
16: set TC_ARG_ARCH=%~1
17: shift
18:
19:
1.1.1.5 root 20: :: Windows Driver Kit build number
21:
22: set TC_WINDDK_BUILD=6001.18002
23:
24:
1.1.1.4 root 25: :: Check for spaces in the current directory path
26:
27: cd | find " " >NUL:
28:
29: if %ERRORLEVEL% == 0 (
30: echo BuildDriver.cmd: error: MS Build does not support building of projects stored in a path containing spaces. >&2
31: exit /B 1
32: )
33:
34:
1.1 root 35: :: Build options
36:
37: set TC_C_DEFINES=-D_WIN32 -DNT4_DRIVER
38: set TC_C_FLAGS=-nologo -I..
1.1.1.3 root 39: set TC_LIBRARIAN_FLAGS=-nologo
1.1 root 40: set TC_LINKER_FLAGS=-nologo
1.1.1.2 root 41: set NO_SAFESEH=1
1.1 root 42:
43:
1.1.1.5 root 44: :: Windows Driver Kit root
1.1 root 45:
46: set TC_WINDDK_ROOT=%SYSTEMDRIVE%\WinDDK\%TC_WINDDK_BUILD%
47: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
48:
1.1.1.3 root 49: set TC_WINDDK_ROOT=%WINDDK_ROOT%\%TC_WINDDK_BUILD%
1.1 root 50: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
51:
52: set TC_WINDDK_ROOT=%WINDDK_ROOT%
53: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
54:
1.1.1.3 root 55: echo BuildDriver.cmd: error: Windows Driver Development Kit not found in the default directory. Set WINDDK_ROOT environment variable to point to your Windows DDK installation directory. >&2
1.1 root 56: exit /B 1
57:
58: :ddk_found
59:
60:
61: :: CPU architecture
62:
63: if "%TC_ARG_ARCH%"=="-x64" (
1.1.1.3 root 64: set TC_BUILD_ARCH=x64 WNET
1.1 root 65: set TC_BUILD_ARCH_DIR=amd64
1.1.1.2 root 66: set TC_ARCH=x64
1.1 root 67: set TC_ARCH_SUFFIX=-x64
68: ) else (
69: set TC_BUILD_ARCH=WXP
70: set TC_BUILD_ARCH_DIR=i386
1.1.1.2 root 71: set TC_ARCH=x86
1.1 root 72: set TC_ARCH_SUFFIX=
73: )
74:
75:
76: :: Build type
77:
78: if "%TC_ARG_TYPE%"=="-debug" (
79: set TC_BUILD_TYPE=chk
80: set TC_C_DEFINES=%TC_C_DEFINES% -DDEBUG -D_DEBUG
81: set TC_BUILD_ALT_DIR=_driver_debug
82: set TC_COPY_DIR="..\Debug"
83: ) else (
84: set TC_BUILD_TYPE=fre
85: set TC_BUILD_ALT_DIR=_driver_release
1.1.1.2 root 86: set TC_C_FLAGS=%TC_C_FLAGS% -w34189
1.1 root 87: set TC_COPY_DIR="..\Release"
88: )
89:
90:
91: :: WDK environment
92:
93: pushd .
94: call %TC_WINDDK_ROOT%\bin\setenv %TC_WINDDK_ROOT% %TC_BUILD_TYPE% %TC_BUILD_ARCH% || exit /B %errorlevel%
95: popd
96:
97:
98: :: Build
99:
100: if "%TC_ARG_CMD%"=="-rebuild" (set TC_BUILD_OPTS=-c)
101:
102: pushd .
103: :build_dirs
104:
105: if "%~1"=="" goto done
106: cd /D "%~1" || exit /B %errorlevel%
107:
108: if "%TC_ARG_CMD%"=="-clean" (
109: rd /s /q obj%TC_BUILD_ALT_DIR%\%TC_BUILD_ARCH_DIR% 2>NUL:
110: rd /q obj%TC_BUILD_ALT_DIR% 2>NUL:
111: ) else (
112:
113: set USER_C_FLAGS=%TC_C_FLAGS% -FAcs -Fa%~1\obj%TC_BUILD_ALT_DIR%\%TC_BUILD_ARCH_DIR%\
114: set C_DEFINES=%TC_C_DEFINES%
115: set RCOPTIONS=/I %MFC_INC_PATH%
1.1.1.3 root 116: set LIBRARIAN_FLAGS=%TC_LIBRARIAN_FLAGS%
117: set LINKER_FLAGS=%TC_LINKER_FLAGS%
1.1 root 118: set BUILD_ALT_DIR=%TC_BUILD_ALT_DIR%
119:
120: build %TC_BUILD_OPTS% -Z -w -nmake /S -nmake /C 2>build_errors.log 1>&2
121:
122: if errorlevel 1 (
123: type build_errors.log
124: exit /B 1
125: )
126: del /q build_errors.log build%BUILD_ALT_DIR%.* 2>NUL:
127: )
128:
129: shift
130:
131: goto build_dirs
132: :done
133: popd
134:
135:
136: if "%TC_ARG_CMD%"=="-clean" exit /B 0
137:
138: md "%TC_COPY_DIR%\Setup Files" >NUL: 2>NUL:
139: copy /B /Y obj%TC_BUILD_ALT_DIR%\%TC_BUILD_ARCH_DIR%\truecrypt.sys "%TC_COPY_DIR%\Setup Files\truecrypt%TC_ARCH_SUFFIX%.sys" >NUL:
140:
141: if errorlevel 1 (
142: echo BuildDriver.cmd: error: Cannot copy target.>&2
143: exit /B 1
144: )
145:
146: exit /B 0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.