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