|
|
1.1 root 1: ::
1.1.1.8 root 2: :: Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved.
1.1 root 3: ::
1.1.1.9 root 4: :: Governed by the TrueCrypt License 3.0 the full text of which is contained in
1.1.1.8 root 5: :: the file License.txt included in TrueCrypt binary and source code distribution
6: :: packages.
1.1 root 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:
1.1.1.9 root 22: set TC_WINDDK_BUILD=7600.16385.1
1.1.1.5 root 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:
1.1.1.9 root 37: set TC_C_DEFINES=-D_WIN32 -DTC_WINDOWS_DRIVER
1.1 root 38: set TC_C_FLAGS=-nologo -I..
1.1.1.7 root 39: set TC_C_WARNING_LEVEL=-W4
40: set TC_C_DISABLED_WARNINGS=-wd4057 -wd4100 -wd4127 -wd4152 -wd4201 -wd4701 -wd4702 -wd4706
1.1.1.3 root 41: set TC_LIBRARIAN_FLAGS=-nologo
1.1 root 42: set TC_LINKER_FLAGS=-nologo
1.1.1.9 root 43: set TC_TEST_SIGN=0
1.1 root 44:
45:
1.1.1.5 root 46: :: Windows Driver Kit root
1.1 root 47:
48: set TC_WINDDK_ROOT=%SYSTEMDRIVE%\WinDDK\%TC_WINDDK_BUILD%
49: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
50:
1.1.1.3 root 51: set TC_WINDDK_ROOT=%WINDDK_ROOT%\%TC_WINDDK_BUILD%
1.1 root 52: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
53:
54: set TC_WINDDK_ROOT=%WINDDK_ROOT%
55: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
56:
1.1.1.3 root 57: 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 58: exit /B 1
59:
60: :ddk_found
61:
62:
63: :: CPU architecture
64:
65: if "%TC_ARG_ARCH%"=="-x64" (
1.1.1.3 root 66: set TC_BUILD_ARCH=x64 WNET
1.1 root 67: set TC_BUILD_ARCH_DIR=amd64
1.1.1.2 root 68: set TC_ARCH=x64
1.1 root 69: set TC_ARCH_SUFFIX=-x64
1.1.1.7 root 70: set TC_C_DISABLED_WARNINGS=%TC_C_DISABLED_WARNINGS% -wd4328 -wd4366
1.1.1.9 root 71: set TC_LINKER_FLAGS=%TC_LINKER_FLAGS% -LTCG
72: if defined TC_KERNEL_TEST_CERTIFICATE_NAME set TC_TEST_SIGN=1
1.1 root 73: ) else (
74: set TC_BUILD_ARCH=WXP
75: set TC_BUILD_ARCH_DIR=i386
1.1.1.2 root 76: set TC_ARCH=x86
1.1 root 77: set TC_ARCH_SUFFIX=
78: )
79:
80:
81: :: Build type
82:
83: if "%TC_ARG_TYPE%"=="-debug" (
84: set TC_BUILD_TYPE=chk
85: set TC_C_DEFINES=%TC_C_DEFINES% -DDEBUG -D_DEBUG
86: set TC_BUILD_ALT_DIR=_driver_debug
87: set TC_COPY_DIR="..\Debug"
88: ) else (
89: set TC_BUILD_TYPE=fre
90: set TC_BUILD_ALT_DIR=_driver_release
91: set TC_COPY_DIR="..\Release"
1.1.1.9 root 92: set TC_TEST_SIGN=0
1.1 root 93: )
94:
95:
96: :: WDK environment
97:
98: pushd .
1.1.1.7 root 99: call %TC_WINDDK_ROOT%\bin\setenv %TC_WINDDK_ROOT% %TC_BUILD_TYPE% %TC_BUILD_ARCH% no_oacr || exit /B %errorlevel%
1.1 root 100: popd
101:
102:
103: :: Build
104:
1.1.1.10! root 105: if "%TC_ARG_CMD%"=="-rebuild" (set TC_BUILD_OPTS=-c -Z)
1.1 root 106:
107: pushd .
108: :build_dirs
109:
110: if "%~1"=="" goto done
111: cd /D "%~1" || exit /B %errorlevel%
112:
113: if "%TC_ARG_CMD%"=="-clean" (
114: rd /s /q obj%TC_BUILD_ALT_DIR%\%TC_BUILD_ARCH_DIR% 2>NUL:
115: rd /q obj%TC_BUILD_ALT_DIR% 2>NUL:
116: ) else (
117:
1.1.1.7 root 118: set USER_C_FLAGS=%TC_C_FLAGS% %TC_C_DISABLED_WARNINGS% -FAcs -Fa%~1\obj%TC_BUILD_ALT_DIR%\%TC_BUILD_ARCH_DIR%\
119: set MSC_WARNING_LEVEL=%TC_C_WARNING_LEVEL%
1.1 root 120: set C_DEFINES=%TC_C_DEFINES%
121: set RCOPTIONS=/I %MFC_INC_PATH%
1.1.1.3 root 122: set LIBRARIAN_FLAGS=%TC_LIBRARIAN_FLAGS%
123: set LINKER_FLAGS=%TC_LINKER_FLAGS%
1.1 root 124: set BUILD_ALT_DIR=%TC_BUILD_ALT_DIR%
125:
1.1.1.10! root 126: build %TC_BUILD_OPTS% -w -nmake /S -nmake /C 2>build_errors.log 1>&2
1.1 root 127:
128: if errorlevel 1 (
129: type build_errors.log
1.1.1.9 root 130: type build_errors_asm.log 2>NUL:
1.1 root 131: exit /B 1
132: )
1.1.1.9 root 133: del /q build_errors.log build_errors_asm.log build%BUILD_ALT_DIR%.* 2>NUL:
1.1 root 134: )
135:
136: shift
137:
138: goto build_dirs
139: :done
140: popd
141:
142:
143: if "%TC_ARG_CMD%"=="-clean" exit /B 0
144:
145: md "%TC_COPY_DIR%\Setup Files" >NUL: 2>NUL:
146: 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:
147:
148: if errorlevel 1 (
1.1.1.9 root 149: echo BuildDriver.cmd: error: Cannot copy target. >&2
1.1 root 150: exit /B 1
151: )
152:
1.1.1.9 root 153: if %TC_TEST_SIGN% equ 1 (
154: signtool sign /s "%TC_KERNEL_TEST_CERTIFICATE_STORE%" /n "%TC_KERNEL_TEST_CERTIFICATE_NAME%" "%TC_COPY_DIR%\Setup Files\truecrypt%TC_ARCH_SUFFIX%.sys" >NUL:
155:
156: if errorlevel 1 (
157: echo BuildDriver.cmd: error: Cannot test-sign target. >&2
158: exit /B 1
159: )
160: )
161:
1.1 root 162: exit /B 0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.