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
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
10 rem http://www.apache.org/licenses/LICENSE-2.0
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
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
31 echo Must specify build command!
34 echo where "cmd" is one of either:
36 echo wxp -- Windows XP
37 echo w2k -- Windows with Win2k Kerb
38 echo clean -- to remove obj, lib, and exe files from source
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
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
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
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
65 echo PC-Alpine for Windows/Winsock (Win32) build sequence
66 set cclntmake=makefile.nt
67 set alpinemake=makefile.wnt
71 if not defined ALPINE_LDAP set ALPINE_LDAP=%cd%\ldap
72 if exist "%ALPINE_LDAP%" goto yesldapwnt
73 echo NOT including LDAP functionality
78 echo including LDAP functionality
79 set ldapflags=-I\"%ALPINE_LDAP%\"\inckit -DENABLE_LDAP
80 set ldaplibes=\"%ALPINE_LDAP%\"\binaries\release\ldap32.lib
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"
90 echo Krb5ized PC-Alpine for Windows/Winsock (Win32) build sequence
91 set cclntmake=makefile.w2k
92 set alpinemake=makefile.wnt
95 set sslextralibes="crypt32.lib"
98 if not defined ALPINE_LDAP set ALPINE_LDAP=%cd%\ldap
99 if exist "%ALPINE_LDAP%" goto yesldapw2k
100 echo NOT including LDAP functionality
105 echo including LDAP functionality
106 set ldapflags=-I\"%ALPINE_LDAP%\"\inckit -DENABLE_LDAP
107 set ldaplibes=\"%ALPINE_LDAP%\"\binaries\release\ldap32.lib
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=
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.
120 echo Cleaning alpine, pico, mailutil, mapi, and c-client directories
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
130 del /Q alpine\osdep\*.pdb
131 del /Q pico\osdep\*.pdb
132 del /Q pith\charconv\*.pdb
133 del /Q pith\osdep\*.pdb
136 rem del /Q mapi\*.ilk
139 set alpinemake=makefile.wnt
140 set extramakecommand=clean
141 if NOT exist c-client goto nocclient
145 if NOT exist c-client-dll goto nocclientdll
146 del /Q c-client-dll\*
149 set cclntmake=makefile.w2k
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
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
176 set extraldflags="/DEBUG /DEBUGTYPE:CV"
177 set extracflags="%extracflagsnq%"
178 set extradllcflags="%extracflagsnq% /D_DLL"
182 echo Building c-client...
184 nmake -nologo -f %cclntmake% EXTRACFLAGS=%extracflags% EXTRALIBES=%extralibes% %extramakecommand%
185 if errorlevel 1 goto bogus
190 if exist mailutil goto yesbuildmailutil
193 echo Building mailutil
195 nmake -nologo -f %cclntmake% EXTRACFLAGS=%extracflags% LIBRESSLLIBS="%ssllibes%" %extramakecommand%
196 if errorlevel 1 goto bogus
202 echo Building pith-osdep...
204 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
205 if errorlevel 1 goto bogus
210 echo Building pith-charconv...
212 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
213 if errorlevel 1 goto bogus
218 echo Building pith...
220 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
221 if errorlevel 1 goto bogus
226 echo Building regex...
228 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% %extramakecommand%
229 if errorlevel 1 goto bogus
234 echo Building pico-osdep...
236 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% %extramakecommand%
237 if errorlevel 1 goto bogus
242 echo Building pico...
244 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% %extramakecommand%
245 if errorlevel 1 goto bogus
250 echo Building alpine-osdep...
252 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRARCFLAGS=%extrarcflags% %extramakecommand%
253 if errorlevel 1 goto bogus
258 echo Building 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
266 if NOT exist c-client-dll goto buildmapi
267 echo Building c-client-dll
269 nmake -nologo -f %cclntmake% EXTRACFLAGS=%extradllcflags% %extramakecommand%
270 if errorlevel 1 goto bogus
277 nmake -nologo -f makefile EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% LDAPLIBS=%ldaplibes% %extramakecommand%
278 if errorlevel 1 goto bogus
282 echo Alpine build complete.
286 echo Problems building Alpine!