* PC-Alpine builds with LibreSSL and supports S/MIME.
[alpine.git] / build.bat
blobbaab5e5bc8bb195da192062756790b70105c346d
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 set libresslflags=-I\"%ALPINE_LIBRESSL%\"\include -DENABLE_WINDOWS_LIBRESSL -DLIBRESSL_INTERNAL
43 set libressllibes=\"%ALPINE_LIBRESSL%\"\x86\libcrypto-41.lib \"%ALPINE_LIBRESSL%\"\x86\libssl-43.lib \"%ALPINE_LIBRESSL%\"\x86\libtls-15.lib
44 set libresslextralibes=
45 :ldapincludewnt
46 if not defined ALPINE_LDAP set ALPINE_LDAP=%cd%\ldap
47 if exist "%ALPINE_LDAP%" goto yesldapwnt
48 echo NOT including LDAP functionality
49 set ldapinclude=
50 set ldaplibes=
51 goto noldapwnt
52 :yesldapwnt
53 echo including LDAP functionality
54 set ldapflags=-I\"%ALPINE_LDAP%\"\inckit -DENABLE_LDAP
55 set ldaplibes=\"%ALPINE_LDAP%\"\binaries\release\ldap32.lib
56 :noldapwnt
57 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=\"\\\"\\\"\"
58 set extralibes="%libresslextralibes%"
59 set extralibesalpine="%ldaplibes% %libressllibes%"
60 set extrarcflags="/D_PCP_WNT"
61 set extramakecommand=
62 goto buildsetup
64 :w2k
65 echo Krb5ized PC-Alpine for Windows/Winsock (Win32) build sequence
66 set cclntmake=makefile.w2k
67 set alpinemake=makefile.wnt
68 if not defined ALPINE_LIBRESSL set ALPINE_LIBRESSL=%cd%\libressl
69 if exist "%ALPINE_LIBRESSL%" goto yeslibresslw2k
70 echo NOT including LIBRESSL functionality
71 set libresslflags=
72 set libressllibes=
73 set libresslextralibes="crypt32.lib"
74 goto ldapincludew2k
75 :yeslibresslw2k
76 set libresslflags=-I\"%ALPINE_LIBRESSL%\"\include -DENABLE_WINDOWS_LIBRESSL  -DLIBRESSL_INTERNAL
77 set libressllibes=\"%ALPINE_LIBRESSL%\"\x86\libcrypto-41.lib \"%ALPINE_LIBRESSL%\"\x86\libssl-43.lib \"%ALPINE_LIBRESSL%\"\x86\libtls-15.lib
78 set libresslextralibes=
79 :ldapincludew2k
80 if not defined ALPINE_LDAP set ALPINE_LDAP=%cd%\ldap
81 if exist "%ALPINE_LDAP%" goto yesldapw2k
82 echo NOT including LDAP functionality
83 set ldapinclude=
84 set ldaplibes=
85 goto noldapw2k
86 :yesldapw2k
87 echo including LDAP functionality
88 set ldapflags=-I\"%ALPINE_LDAP%\"\inckit -DENABLE_LDAP
89 set ldaplibes=\"%ALPINE_LDAP%\"\binaries\release\ldap32.lib
90 :noldapw2k
91 set extracflagsnq=/DWINVER=0x0501 /Zi -Od %ldapflags% -D_USE_32BIT_TIME_T -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DSPCFC_WINVER=\"\\\" 2000\\\"\" -DSPCL_REMARKS=\"\\\" with krb5\\\"\"
92 set extralibes="secur32.lib %libresslextralibes%"
93 set extralibesalpine="secur32.lib crypt32.lib %ldaplibes% %libressllibes%"
94 set extrarcflags="/D_PCP_W2K"
95 set extramakecommand=
96 goto buildsetup
98 :clean
99 echo Sure you want to delete object, library and executable files?!?!
100 echo If NOT, type Ctrl-C to terminate build script NOW.  Type ENTER if you do.
101 pause
102 echo Cleaning alpine, pico, mailutil, mapi, and c-client directories
103 echo del *.pdb
104 del /Q alpine\*.pdb
105 del /Q c-client\*.pdb
106 del /Q c-client-dll\*.pdb
107 rem del /Q mailutil\*.pdb
108 rem del /Q mapi\*.pdb
109 del /Q pico\*.pdb
110 del /Q pith\*.pdb
111 del /Q regex\*.pdb
112 del /Q alpine\osdep\*.pdb
113 del /Q pico\osdep\*.pdb
114 del /Q pith\charconv\*.pdb
115 del /Q pith\osdep\*.pdb
116 echo del *.ilk
117 del /Q alpine\*.ilk
118 rem del /Q mapi\*.ilk
119 del /Q pico\*.ilk
120 del /Q pith\*.ilk
121 set alpinemake=makefile.wnt
122 set extramakecommand=clean
123 if NOT exist c-client goto nocclient
124 del /Q c-client\*
125 rmdir c-client
126 :nocclient
127 if NOT exist c-client-dll goto nocclientdll
128 del /Q c-client-dll\*
129 rmdir c-client-dll
130 :nocclientdll
131 set cclntmake=makefile.w2k
132 goto buildmailutil
134 :buildsetup
135 if not exist c-client mkdir c-client
136 if not defined ALPINE_IMAP set ALPINE_IMAP=imap
137 echo Copying imap files to c-client directory
138 copy /Y "%ALPINE_IMAP%"\src\c-client\* c-client\ > garbageout.txt
139 copy /Y "%ALPINE_IMAP%"\src\charset\* c-client\ > garbageout.txt
140 copy /Y "%ALPINE_IMAP%"\src\osdep\nt\* c-client\ > garbageout.txt
141 del garbageout.txt
142 rem if not exist c-client-dll mkdir c-client-dll
143 rem copy /Y "%ALPINE_IMAP%"\src\c-client\* c-client-dll\ > garbageout.txt
144 rem copy /Y "%ALPINE_IMAP%"\src\charset\* c-client-dll\ > garbageout.txt
145 rem copy /Y "%ALPINE_IMAP%"\src\osdep\nt\* c-client-dll\ > garbageout.txt
146 rem del garbageout.txt
147 if not exist mailutil mkdir mailutil
148 copy /Y "%ALPINE_IMAP%"\src\mailutil\* mailutil\ > garbageout.txt
149 del garbageout.txt
150 goto build
152 :build
153 set extraldflags="/DEBUG /DEBUGTYPE:CV"
154 set extracflags="%extracflagsnq%"
155 set extradllcflags="%extracflagsnq% /D_DLL"
156 goto buildcclnt
158 :buildcclnt
159 echo Building c-client...
160 cd c-client
161 nmake -nologo -f %cclntmake% EXTRACFLAGS=%extracflags% %extramakecommand%
162 if errorlevel 1 goto bogus
163 cd ..
164 goto buildmailutil
166 :buildmailutil
167 if exist mailutil goto yesbuildmailutil
168 goto nobuildmailutil
169 :yesbuildmailutil
170 echo Building mailutil
171 cd mailutil
172 nmake -nologo -f %cclntmake% EXTRACFLAGS=%extracflags% %extramakecommand%
173 if errorlevel 1 goto bogus
174 cd ..
175 :nobuildmailutil
176 goto buildpithosd
178 :buildpithosd
179 echo Building pith-osdep...
180 cd pith\osdep
181 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
182 if errorlevel 1 goto bogus
183 cd ..\..
184 goto buildpithcc
186 :buildpithcc
187 echo Building pith-charconv...
188 cd pith\charconv
189 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
190 if errorlevel 1 goto bogus
191 cd ..\..
192 goto buildpith
194 :buildpith
195 echo Building pith...
196 cd pith
197 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
198 if errorlevel 1 goto bogus
199 cd ..
200 goto buildregex
202 :buildregex
203 echo Building regex...
204 cd regex
205 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
206 if errorlevel 1 goto bogus
207 cd ..
208 goto buildpicoosd
210 :buildpicoosd
211 echo Building pico-osdep...
212 cd pico\osdep
213 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
214 if errorlevel 1 goto bogus
215 cd ..\..
216 goto buildpico
218 :buildpico
219 echo Building pico...
220 cd pico
221 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
222 if errorlevel 1 goto bogus
223 cd ..
224 goto buildalpineosd
226 :buildalpineosd
227 echo Building alpine-osdep...
228 cd alpine\osdep
229 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% EXTRARCFLAGS=%extrarcflags% %extramakecommand%
230 if errorlevel 1 goto bogus
231 cd ..\..
232 goto buildalpine
234 :buildalpine
235 echo Building alpine...
236 cd alpine
237 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibesalpine% EXTRARCFLAGS=%extrarcflags% %extramakecommand%
238 if errorlevel 1 goto bogus
239 cd ..
240 goto nobuildmapi
242 :buildcclntdll
243 if NOT exist c-client-dll goto buildmapi
244 echo Building c-client-dll
245 cd c-client-dll
246 nmake -nologo -f %cclntmake% EXTRACFLAGS=%extradllcflags% %extramakecommand%
247 if errorlevel 1 goto bogus
248 cd ..
249 goto buildmapi
251 :buildmapi
252 echo Building mapi
253 cd mapi
254 nmake -nologo -f makefile EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
255 if errorlevel 1 goto bogus
256 cd ..
258 :nobuildmapi
259 echo Alpine build complete.
260 goto fini
262 :bogus
263 echo Problems building Alpine!
265 :fini