* Implement a different way to delete a password from the cache.
[alpine.git] / build.bat
blob2a1038c8185ca63bfb5eb7835db79a47a12a292e
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 rem These are the default values, which we might override below
15 rem by setting them to older versions
17 rem Default flags. These are in effect when openssl and libressl are disabled.
18 set MESSAGE=Not including OPENSSL or LIBRESSL support
19 set sslflags=
20 set ssllibes=
21 set sslextralibes="crypt32.lib"
23 if "%1"=="" goto blank
24 if "%1"=="wnt" goto wnt
25 if "%1"=="wxp" goto wxp
26 if "%1"=="w2k" goto w2k
27 if "%1"=="clean" goto clean
28 echo Unknown build command: %1 %2 %3 %4
29 goto usage
30 :blank
31 echo Must specify build command!
32 :usage
33 echo usage: BUILD cmd
34 echo   where "cmd" is one of either:
35 echo         wnt        -- Windows
36 echo         wxp        -- Windows XP
37 echo         w2k        -- Windows with Win2k Kerb
38 echo         clean      -- to remove obj, lib, and exe files from source
39 goto fini
41 :wxp
42 if not defined ALPINE_LIBRESSL set ALPINE_LIBRESSL=%cd%\libressl
43 if NOT exist "%ALPINE_LIBRESSL%" goto wntbuild
44 set MESSAGE=including LIBRESSL support
45 set CRYPTO_VERSION=41
46 set SSL_VERSION=43
47 set TLS_VERSION=15
48 set windows32build=-DWXPBUILD -D__MINGW_USE_VC2005_COMPAT
49 set sslflags=-I\"%ALPINE_LIBRESSL%\"\include -I\"%ALPINE_LIBRESSL%\"\include\openssl -DENABLE_WINDOWS_UNIXSSL
50 set ssllibes=\"%ALPINE_LIBRESSL%\"\x86\libcrypto-%CRYPTO_VERSION%.lib \"%ALPINE_LIBRESSL%\"\x86\libssl-%SSL_VERSION%.lib \"%ALPINE_LIBRESSL%\"\x86\libtls-%TLS_VERSION%.lib
51 set sslextralibes=
52 goto wntbuild
54 :wnt
55 if not defined ALPINE_OPENSSL set ALPINE_OPENSSL=%cd%\openssl
56 if NOT exist "%ALPINE_OPENSSL%" goto wntbuild
57 set MESSAGE=including OPENSSL support
58 set windows32build=
59 set sslflags=-I\"%ALPINE_OPENSSL%\"\include\ -I\"%ALPINE_OPENSSL%\"\include\openssl -DENABLE_WINDOWS_UNIXSSL -DOPENSSL_1_1_0
60 set ssllibes=\"%ALPINE_OPENSSL%\"\lib\libcrypto.lib \"%ALPINE_OPENSSL%\"\lib\libssl.lib 
61 set sslextralibes=
62 goto wntbuild
64 :wntbuild
65 echo PC-Alpine for Windows/Winsock (Win32) build sequence
66 set cclntmake=makefile.nt
67 set alpinemake=makefile.wnt
68 echo %MESSAGE%
69 goto ldapincludewnt
70 :ldapincludewnt
71 if not defined ALPINE_LDAP set ALPINE_LDAP=%cd%\ldap
72 if exist "%ALPINE_LDAP%" goto yesldapwnt
73 echo NOT including LDAP functionality
74 set ldapinclude=
75 set ldaplibes=
76 goto noldapwnt
77 :yesldapwnt
78 echo including LDAP functionality
79 set ldapflags=-I\"%ALPINE_LDAP%\"\inckit -DENABLE_LDAP
80 set ldaplibes=\"%ALPINE_LDAP%\"\binaries\release\ldap32.lib
81 :noldapwnt
82 set extracflagsnq=/DWINVER=0x0501 /Zi -Od %ldapflags% %sslflags% %windows32build% -D_USE_32BIT_TIME_T -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DSPCL_REMARKS=\"\\\"\\\"\"
83 set extralibes="%sslextralibes%"
84 set extralibesalpine="%ldaplibes% %ssllibes%"
85 set extrarcflags="/D_PCP_WNT"
86 set extramakecommand=
87 goto buildsetup
89 :w2k
90 echo Krb5ized PC-Alpine for Windows/Winsock (Win32) build sequence
91 set cclntmake=makefile.w2k
92 set alpinemake=makefile.wnt
93 set sslflags=
94 set ssllibes=
95 set sslextralibes="crypt32.lib"
96 goto ldapincludew2k
97 :ldapincludew2k
98 if not defined ALPINE_LDAP set ALPINE_LDAP=%cd%\ldap
99 if exist "%ALPINE_LDAP%" goto yesldapw2k
100 echo NOT including LDAP functionality
101 set ldapinclude=
102 set ldaplibes=
103 goto noldapw2k
104 :yesldapw2k
105 echo including LDAP functionality
106 set ldapflags=-I\"%ALPINE_LDAP%\"\inckit -DENABLE_LDAP
107 set ldaplibes=\"%ALPINE_LDAP%\"\binaries\release\ldap32.lib
108 :noldapw2k
109 set extracflagsnq=/DWINVER=0x0501 /Zi -Od %ldapflags% %sslflags% -D_USE_32BIT_TIME_T -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DSPCFC_WINVER=\"\\\" 2000\\\"\" -DSPCL_REMARKS=\"\\\" with krb5\\\"\"
110 set extralibes="secur32.lib %sslextralibes%"
111 set extralibesalpine="secur32.lib crypt32.lib %ldaplibes% %ssllibes%"
112 set extrarcflags="/D_PCP_W2K"
113 set extramakecommand=
114 goto buildsetup
116 :clean
117 echo Sure you want to delete object, library and executable files?!?!
118 echo If NOT, type Ctrl-C to terminate build script NOW.  Type ENTER if you do.
119 pause
120 echo Cleaning alpine, pico, mailutil, mapi, and c-client directories
121 echo del *.pdb
122 del /Q alpine\*.pdb
123 del /Q c-client\*.pdb
124 del /Q c-client-dll\*.pdb
125 rem del /Q mailutil\*.pdb
126 rem del /Q mapi\*.pdb
127 del /Q pico\*.pdb
128 del /Q pith\*.pdb
129 del /Q regex\*.pdb
130 del /Q alpine\osdep\*.pdb
131 del /Q pico\osdep\*.pdb
132 del /Q pith\charconv\*.pdb
133 del /Q pith\osdep\*.pdb
134 echo del *.ilk
135 del /Q alpine\*.ilk
136 rem del /Q mapi\*.ilk
137 del /Q pico\*.ilk
138 del /Q pith\*.ilk
139 set alpinemake=makefile.wnt
140 set extramakecommand=clean
141 if NOT exist c-client goto nocclient
142 del /Q c-client\*
143 rmdir c-client
144 :nocclient
145 if NOT exist c-client-dll goto nocclientdll
146 del /Q c-client-dll\*
147 rmdir c-client-dll
148 :nocclientdll
149 set cclntmake=makefile.w2k
150 goto buildmailutil
152 :buildsetup
153 if not exist c-client mkdir c-client
154 if not defined ALPINE_IMAP set ALPINE_IMAP=imap
155 echo Copying imap files to c-client directory
156 copy /Y "%ALPINE_IMAP%"\src\c-client\* c-client\ > garbageout.txt
157 copy /Y "%ALPINE_IMAP%"\src\charset\* c-client\ > garbageout.txt
158 copy /Y "%ALPINE_IMAP%"\src\osdep\nt\* c-client\ > garbageout.txt
159 del garbageout.txt
160 rem if not exist c-client-dll mkdir c-client-dll
161 rem copy /Y "%ALPINE_IMAP%"\src\c-client\* c-client-dll\ > garbageout.txt
162 rem copy /Y "%ALPINE_IMAP%"\src\charset\* c-client-dll\ > garbageout.txt
163 rem copy /Y "%ALPINE_IMAP%"\src\osdep\nt\* c-client-dll\ > garbageout.txt
164 rem del garbageout.txt
165 if not exist mailutil mkdir mailutil
166 copy /Y "%ALPINE_IMAP%"\src\mailutil\* mailutil\ > garbageout.txt
167 if defined ALPINE_LIBRESSL del /Q libressl\x86\lib*.lib
168 if defined ALPINE_LIBRESSL del /Q alpine\lib*.dll
169 if defined ALPINE_LIBRESSL copy /Y libressl\x86\"%1%"\* libressl\x86\ > garbageout.txt
170 if defined ALPINE_LIBRESSL copy /Y alpine\DLL\"%1%\"\* alpine\ > garbageout.txt
171 if defined ALPINE_OPENSSL copy /Y alpine\DLL\openssl\* alpine\ > garbageout.txt
172 del garbageout.txt
173 goto build
175 :build
176 set extraldflags="/DEBUG /DEBUGTYPE:CV"
177 set extracflags="%extracflagsnq%"
178 set extradllcflags="%extracflagsnq% /D_DLL"
179 goto buildcclnt
181 :buildcclnt
182 echo Building c-client...
183 cd c-client
184 nmake -nologo -f %cclntmake% EXTRACFLAGS=%extracflags% EXTRALIBES=%extralibes% %extramakecommand%
185 if errorlevel 1 goto bogus
186 cd ..
187 goto buildmailutil
189 :buildmailutil
190 if exist mailutil goto yesbuildmailutil
191 goto nobuildmailutil
192 :yesbuildmailutil
193 echo Building mailutil
194 cd mailutil
195 nmake -nologo -f %cclntmake% EXTRACFLAGS=%extracflags% LIBRESSLLIBS="%ssllibes%" %extramakecommand%
196 if errorlevel 1 goto bogus
197 cd ..
198 :nobuildmailutil
199 goto buildpithosd
201 :buildpithosd
202 echo Building pith-osdep...
203 cd pith\osdep
204 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
205 if errorlevel 1 goto bogus
206 cd ..\..
207 goto buildpithcc
209 :buildpithcc
210 echo Building pith-charconv...
211 cd pith\charconv
212 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
213 if errorlevel 1 goto bogus
214 cd ..\..
215 goto buildpith
217 :buildpith
218 echo Building pith...
219 cd pith
220 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
221 if errorlevel 1 goto bogus
222 cd ..
223 goto buildregex
225 :buildregex
226 echo Building regex...
227 cd regex
228 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% %extramakecommand%
229 if errorlevel 1 goto bogus
230 cd ..
231 goto buildpicoosd
233 :buildpicoosd
234 echo Building pico-osdep...
235 cd pico\osdep
236 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% %extramakecommand%
237 if errorlevel 1 goto bogus
238 cd ..\..
239 goto buildpico
241 :buildpico
242 echo Building pico...
243 cd pico
244 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% %extramakecommand%
245 if errorlevel 1 goto bogus
246 cd ..
247 goto buildalpineosd
249 :buildalpineosd
250 echo Building alpine-osdep...
251 cd alpine\osdep
252 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRARCFLAGS=%extrarcflags% %extramakecommand%
253 if errorlevel 1 goto bogus
254 cd ..\..
255 goto buildalpine
257 :buildalpine
258 echo Building alpine...
259 cd alpine
260 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALIBES=%extralibesalpine% LDAPLIBS=%ldaplibes% EXTRALDFLAGS=%extraldflags% EXTRARCFLAGS=%extrarcflags% %extramakecommand%
261 if errorlevel 1 goto bogus
262 cd ..
263 goto nobuildmapi
265 :buildcclntdll
266 if NOT exist c-client-dll goto buildmapi
267 echo Building c-client-dll
268 cd c-client-dll
269 nmake -nologo -f %cclntmake% EXTRACFLAGS=%extradllcflags% %extramakecommand%
270 if errorlevel 1 goto bogus
271 cd ..
272 goto buildmapi
274 :buildmapi
275 echo Building mapi
276 cd mapi
277 nmake -nologo -f makefile EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% LDAPLIBS=%ldaplibes% %extramakecommand%
278 if errorlevel 1 goto bogus
279 cd ..
281 :nobuildmapi
282 echo Alpine build complete.
283 goto fini
285 :bogus
286 echo Problems building Alpine!
288 :fini