* Rewrite support for specific SSL encryption protocols, including
[alpine.git] / build.bat
blobd6ab1346b6f3739667d078ac25f665400909403c
1 @echo OFF
2 rem $Id: build.bat 14098 2005-10-03 18:54:13Z jpf@u.washington.edu $
3 rem ========================================================================
4 rem Copyright 2006-2007 University of Washington
5 rem
6 rem Licensed under the Apache License, Version 2.0 (the "License");
7 rem you may not use this file except in compliance with the License.
8 rem You may obtain a copy of the License at
9 rem
10 rem     http://www.apache.org/licenses/LICENSE-2.0
11 rem
12 rem ========================================================================
14 if "%1"=="" goto blank
15 if "%1"=="wnt" goto wnt
16 if "%1"=="w2k" goto w2k
17 if "%1"=="clean" goto clean
18 echo Unknown build command: %1 %2 %3 %4
19 goto usage
20 :blank
21 echo Must specify build command!
22 :usage
23 echo usage: BUILD cmd
24 echo   where "cmd" is one of either:
25 echo         wnt        -- Windows
26 echo         w2k        -- Windows with Win2k Kerb
27 echo         clean      -- to remove obj, lib, and exe files from source
28 goto fini
30 :wnt
31 echo PC-Alpine for Windows/Winsock (Win32) build sequence
32 set cclntmake=makefile.nt
33 set alpinemake=makefile.wnt
34 if not defined ALPINE_LIBRESSL set ALPINE_LIBRESSL=%cd%\libressl
35 if exist "%ALPINE_LIBRESSL%" goto yeslibresslwnt
36 echo NOT including LIBRESSL functionality
37 set libresslflags=
38 set libressllibes=
39 set libresslextralibes="crypt32.lib"
40 goto ldapincludewnt
41 :yeslibresslwnt
42 echo including LIBRESSL functionality
43 set libresslflags=-I\"%ALPINE_LIBRESSL%\"\include -I\"%ALPINE_LIBRESSL%\"\include\openssl -DENABLE_WINDOWS_LIBRESSL
44 set libressllibes=\"%ALPINE_LIBRESSL%\"\x86\libcrypto-41.lib \"%ALPINE_LIBRESSL%\"\x86\libssl-43.lib \"%ALPINE_LIBRESSL%\"\x86\libtls-15.lib
45 set libresslextralibes=
46 :ldapincludewnt
47 if not defined ALPINE_LDAP set ALPINE_LDAP=%cd%\ldap
48 if exist "%ALPINE_LDAP%" goto yesldapwnt
49 echo NOT including LDAP functionality
50 set ldapinclude=
51 set ldaplibes=
52 goto noldapwnt
53 :yesldapwnt
54 echo including LDAP functionality
55 set ldapflags=-I\"%ALPINE_LDAP%\"\inckit -DENABLE_LDAP
56 set ldaplibes=\"%ALPINE_LDAP%\"\binaries\release\ldap32.lib
57 :noldapwnt
58 set extracflagsnq=/DWINVER=0x0501 /Zi -Od %ldapflags% %libresslflags% -D_USE_32BIT_TIME_T -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DSPCL_REMARKS=\"\\\"\\\"\"
59 set extralibes="%libresslextralibes%"
60 set extralibesalpine="%ldaplibes% %libressllibes%"
61 set extrarcflags="/D_PCP_WNT"
62 set extramakecommand=
63 goto buildsetup
65 :w2k
66 echo Krb5ized PC-Alpine for Windows/Winsock (Win32) build sequence
67 set cclntmake=makefile.w2k
68 set alpinemake=makefile.wnt
69 if not defined ALPINE_LIBRESSL set ALPINE_LIBRESSL=%cd%\libressl
70 if exist "%ALPINE_LIBRESSL%" goto yeslibresslw2k
71 echo NOT including LIBRESSL functionality
72 set libresslflags=
73 set libressllibes=
74 set libresslextralibes="crypt32.lib"
75 goto ldapincludew2k
76 :yeslibresslw2k
77 echo including LIBRESSL functionality
78 set libresslflags=-I\"%ALPINE_LIBRESSL%\"\include -I\"%ALPINE_LIBRESSL%\"\include\openssl -DENABLE_WINDOWS_LIBRESSL
79 set libressllibes=\"%ALPINE_LIBRESSL%\"\x86\libcrypto-41.lib \"%ALPINE_LIBRESSL%\"\x86\libssl-43.lib \"%ALPINE_LIBRESSL%\"\x86\libtls-15.lib
80 set libresslextralibes=
81 :ldapincludew2k
82 if not defined ALPINE_LDAP set ALPINE_LDAP=%cd%\ldap
83 if exist "%ALPINE_LDAP%" goto yesldapw2k
84 echo NOT including LDAP functionality
85 set ldapinclude=
86 set ldaplibes=
87 goto noldapw2k
88 :yesldapw2k
89 echo including LDAP functionality
90 set ldapflags=-I\"%ALPINE_LDAP%\"\inckit -DENABLE_LDAP
91 set ldaplibes=\"%ALPINE_LDAP%\"\binaries\release\ldap32.lib
92 :noldapw2k
93 set extracflagsnq=/DWINVER=0x0501 /Zi -Od %ldapflags% %libresslflags% -D_USE_32BIT_TIME_T -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DSPCFC_WINVER=\"\\\" 2000\\\"\" -DSPCL_REMARKS=\"\\\" with krb5\\\"\"
94 set extralibes="secur32.lib %libresslextralibes%"
95 set extralibesalpine="secur32.lib crypt32.lib %ldaplibes% %libressllibes%"
96 set extrarcflags="/D_PCP_W2K"
97 set extramakecommand=
98 goto buildsetup
100 :clean
101 echo Sure you want to delete object, library and executable files?!?!
102 echo If NOT, type Ctrl-C to terminate build script NOW.  Type ENTER if you do.
103 pause
104 echo Cleaning alpine, pico, mailutil, mapi, and c-client directories
105 echo del *.pdb
106 del /Q alpine\*.pdb
107 del /Q c-client\*.pdb
108 del /Q c-client-dll\*.pdb
109 rem del /Q mailutil\*.pdb
110 rem del /Q mapi\*.pdb
111 del /Q pico\*.pdb
112 del /Q pith\*.pdb
113 del /Q regex\*.pdb
114 del /Q alpine\osdep\*.pdb
115 del /Q pico\osdep\*.pdb
116 del /Q pith\charconv\*.pdb
117 del /Q pith\osdep\*.pdb
118 echo del *.ilk
119 del /Q alpine\*.ilk
120 rem del /Q mapi\*.ilk
121 del /Q pico\*.ilk
122 del /Q pith\*.ilk
123 set alpinemake=makefile.wnt
124 set extramakecommand=clean
125 if NOT exist c-client goto nocclient
126 del /Q c-client\*
127 rmdir c-client
128 :nocclient
129 if NOT exist c-client-dll goto nocclientdll
130 del /Q c-client-dll\*
131 rmdir c-client-dll
132 :nocclientdll
133 set cclntmake=makefile.w2k
134 goto buildmailutil
136 :buildsetup
137 if not exist c-client mkdir c-client
138 if not defined ALPINE_IMAP set ALPINE_IMAP=imap
139 echo Copying imap files to c-client directory
140 copy /Y "%ALPINE_IMAP%"\src\c-client\* c-client\ > garbageout.txt
141 copy /Y "%ALPINE_IMAP%"\src\charset\* c-client\ > garbageout.txt
142 copy /Y "%ALPINE_IMAP%"\src\osdep\nt\* c-client\ > garbageout.txt
143 del garbageout.txt
144 rem if not exist c-client-dll mkdir c-client-dll
145 rem copy /Y "%ALPINE_IMAP%"\src\c-client\* c-client-dll\ > garbageout.txt
146 rem copy /Y "%ALPINE_IMAP%"\src\charset\* c-client-dll\ > garbageout.txt
147 rem copy /Y "%ALPINE_IMAP%"\src\osdep\nt\* c-client-dll\ > garbageout.txt
148 rem del garbageout.txt
149 if not exist mailutil mkdir mailutil
150 copy /Y "%ALPINE_IMAP%"\src\mailutil\* mailutil\ > garbageout.txt
151 del garbageout.txt
152 goto build
154 :build
155 set extraldflags="/DEBUG /DEBUGTYPE:CV"
156 set extracflags="%extracflagsnq%"
157 set extradllcflags="%extracflagsnq% /D_DLL"
158 goto buildcclnt
160 :buildcclnt
161 echo Building c-client...
162 cd c-client
163 nmake -nologo -f %cclntmake% EXTRACFLAGS=%extracflags% EXTRALIBES=%extralibes% %extramakecommand%
164 if errorlevel 1 goto bogus
165 cd ..
166 goto buildmailutil
168 :buildmailutil
169 if exist mailutil goto yesbuildmailutil
170 goto nobuildmailutil
171 :yesbuildmailutil
172 echo Building mailutil
173 cd mailutil
174 nmake -nologo -f %cclntmake% EXTRACFLAGS=%extracflags% LIBRESSLLIBS="%libressllibes%" %extramakecommand%
175 if errorlevel 1 goto bogus
176 cd ..
177 :nobuildmailutil
178 goto buildpithosd
180 :buildpithosd
181 echo Building pith-osdep...
182 cd pith\osdep
183 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
184 if errorlevel 1 goto bogus
185 cd ..\..
186 goto buildpithcc
188 :buildpithcc
189 echo Building pith-charconv...
190 cd pith\charconv
191 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
192 if errorlevel 1 goto bogus
193 cd ..\..
194 goto buildpith
196 :buildpith
197 echo Building pith...
198 cd pith
199 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
200 if errorlevel 1 goto bogus
201 cd ..
202 goto buildregex
204 :buildregex
205 echo Building regex...
206 cd regex
207 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% %extramakecommand%
208 if errorlevel 1 goto bogus
209 cd ..
210 goto buildpicoosd
212 :buildpicoosd
213 echo Building pico-osdep...
214 cd pico\osdep
215 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% %extramakecommand%
216 if errorlevel 1 goto bogus
217 cd ..\..
218 goto buildpico
220 :buildpico
221 echo Building pico...
222 cd pico
223 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% %extramakecommand%
224 if errorlevel 1 goto bogus
225 cd ..
226 goto buildalpineosd
228 :buildalpineosd
229 echo Building alpine-osdep...
230 cd alpine\osdep
231 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRARCFLAGS=%extrarcflags% %extramakecommand%
232 if errorlevel 1 goto bogus
233 cd ..\..
234 goto buildalpine
236 :buildalpine
237 echo Building alpine...
238 cd alpine
239 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% LIBRESSLLIBS="%libressllibes%" EXTRALIBES=%extralibesalpine% LDAPLIBS=%ldaplibes% EXTRALDFLAGS=%extraldflags% EXTRARCFLAGS=%extrarcflags% %extramakecommand%
240 if errorlevel 1 goto bogus
241 cd ..
242 goto nobuildmapi
244 :buildcclntdll
245 if NOT exist c-client-dll goto buildmapi
246 echo Building c-client-dll
247 cd c-client-dll
248 nmake -nologo -f %cclntmake% EXTRACFLAGS=%extradllcflags% %extramakecommand%
249 if errorlevel 1 goto bogus
250 cd ..
251 goto buildmapi
253 :buildmapi
254 echo Building mapi
255 cd mapi
256 nmake -nologo -f makefile EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% LDAPLIBS=%ldaplibes% %extramakecommand%
257 if errorlevel 1 goto bogus
258 cd ..
260 :nobuildmapi
261 echo Alpine build complete.
262 goto fini
264 :bogus
265 echo Problems building Alpine!
267 :fini