* LibreSSL 2.2.2 does not have RAND_egd, so we eliminate that call (we were
[alpine.git] / build.bat
blobf73c0fbd3a709e68f5d16f3399d719f91f8c7d51
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-Pine for Windows/Winsock (Win32) build sequence
32 set cclntmake=makefile.nt
33 set alpinemake=makefile.wnt
34 if not defined ALPINE_LDAP set ALPINE_LDAP=%cd%\ldap
35 if exist "%ALPINE_LDAP%" goto yesldapwnt
36 echo NOT including LDAP functionality
37 set ldapinclude=
38 set ldaplibes=
39 goto noldapwnt
40 :yesldapwnt
41 echo including LDAP functionality
42 set ldapflags=-I\"%ALPINE_LDAP%\"\inckit -DENABLE_LDAP
43 set ldaplibes=\"%ALPINE_LDAP%\"\binaries\release\ldap32.lib
44 :noldapwnt
45 set extracflagsnq=/Zi -Od %ldapflags% -D_USE_32BIT_TIME_T -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DSPCL_REMARKS=\"\\\"\\\"\"
46 set extralibes=
47 set extralibesalpine=%ldaplibes%
48 set extrarcflags="/D_PCP_WNT"
49 set extramakecommand=
50 goto buildsetup
52 :w2k
53 echo Krb5ized PC-Pine for Windows/Winsock (Win32) build sequence
54 set cclntmake=makefile.w2k
55 set alpinemake=makefile.wnt
56 if not defined ALPINE_LDAP set ALPINE_LDAP=%cd%\ldap
57 if exist "%ALPINE_LDAP%" goto yesldapw2k
58 echo NOT including LDAP functionality
59 set ldapinclude=
60 set ldaplibes=
61 goto noldapw2k
62 :yesldapw2k
63 echo including LDAP functionality
64 set ldapflags=-I\"%ALPINE_LDAP%\"\inckit -DENABLE_LDAP
65 set ldaplibes=\"%ALPINE_LDAP%\"\binaries\release\ldap32.lib
66 :noldapw2k
67 set extracflagsnq=/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\\\"\"
68 set extralibes="secur32.lib"
69 set extralibesalpine="secur32.lib %ldaplibes%"
70 set extrarcflags="/D_PCP_W2K"
71 set extramakecommand=
72 goto buildsetup
74 :clean
75 echo Sure you want to delete object, library and executable files?!?!
76 echo If NOT, type Ctrl-C to terminate build script NOW.  Type ENTER if you do.
77 pause
78 echo Cleaning alpine, pico, mailutil, mapi, and c-client directories
79 set alpinemake=makefile.wnt
80 set extramakecommand=clean
81 if NOT exist c-client goto nocclient
82 del /Q c-client\*
83 rmdir c-client
84 :nocclient
85 if NOT exist c-client-dll goto nocclientdll
86 del /Q c-client-dll\*
87 rmdir c-client-dll
88 :nocclientdll
89 set cclntmake=makefile.w2k
90 goto buildmailutil
92 :buildsetup
93 if not exist c-client mkdir c-client
94 if not defined ALPINE_IMAP set ALPINE_IMAP=imap
95 echo Copying imap files to c-client directory
96 copy /Y "%ALPINE_IMAP%"\src\c-client\* c-client\ > garbageout.txt
97 copy /Y "%ALPINE_IMAP%"\src\charset\* c-client\ > garbageout.txt
98 copy /Y "%ALPINE_IMAP%"\src\osdep\nt\* c-client\ > garbageout.txt
99 del garbageout.txt
100 if not exist c-client-dll mkdir c-client-dll
101 copy /Y "%ALPINE_IMAP%"\src\c-client\* c-client-dll\ > garbageout.txt
102 copy /Y "%ALPINE_IMAP%"\src\charset\* c-client-dll\ > garbageout.txt
103 copy /Y "%ALPINE_IMAP%"\src\osdep\nt\* c-client-dll\ > garbageout.txt
104 del garbageout.txt
105 if not exist mailutil mkdir mailutil
106 copy /Y "%ALPINE_IMAP%"\src\mailutil\* mailutil\ > garbageout.txt
107 del garbageout.txt
108 goto build
110 :build
111 set extraldflags="/DEBUG /DEBUGTYPE:CV"
112 set extracflags="%extracflagsnq%"
113 set extradllcflags="%extracflagsnq% /D_DLL"
114 goto buildcclnt
116 :buildcclnt
117 echo Building c-client...
118 cd c-client
119 nmake -nologo -f %cclntmake% EXTRACFLAGS=%extracflags% %extramakecommand%
120 if errorlevel 1 goto bogus
121 cd ..
122 goto buildmailutil
124 :buildmailutil
125 if exist mailutil goto yesbuildmailutil
126 goto nobuildmailutil
127 :yesbuildmailutil
128 echo Building mailutil
129 cd mailutil
130 nmake -nologo -f %cclntmake% EXTRACFLAGS=%extracflags% %extramakecommand%
131 if errorlevel 1 goto bogus
132 cd ..
133 :nobuildmailutil
134 goto buildpithosd
136 :buildpithosd
137 echo Building pith-osdep...
138 cd pith\osdep
139 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
140 if errorlevel 1 goto bogus
141 cd ..\..
142 goto buildpithcc
144 :buildpithcc
145 echo Building pith-charconv...
146 cd pith\charconv
147 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
148 if errorlevel 1 goto bogus
149 cd ..\..
150 goto buildpith
152 :buildpith
153 echo Building pith...
154 cd pith
155 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
156 if errorlevel 1 goto bogus
157 cd ..
158 goto buildregex
160 :buildregex
161 echo Building regex...
162 cd regex
163 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
164 if errorlevel 1 goto bogus
165 cd ..
166 goto buildpicoosd
168 :buildpicoosd
169 echo Building pico-osdep...
170 cd pico\osdep
171 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
172 if errorlevel 1 goto bogus
173 cd ..\..
174 goto buildpico
176 :buildpico
177 echo Building pico...
178 cd pico
179 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
180 if errorlevel 1 goto bogus
181 cd ..
182 goto buildalpineosd
184 :buildalpineosd
185 echo Building alpine-osdep...
186 cd alpine\osdep
187 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% EXTRARCFLAGS=%extrarcflags% %extramakecommand%
188 if errorlevel 1 goto bogus
189 cd ..\..
190 goto buildalpine
192 :buildalpine
193 echo Building alpine...
194 cd alpine
195 nmake -nologo -f %alpinemake% wnt=1 EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibesalpine% EXTRARCFLAGS=%extrarcflags% %extramakecommand%
196 if errorlevel 1 goto bogus
197 cd ..
198 goto buildcclntdll
200 :buildcclntdll
201 if NOT exist c-client-dll goto buildmapi
202 echo Building c-client-dll
203 cd c-client-dll
204 nmake -nologo -f %cclntmake% EXTRACFLAGS=%extradllcflags% %extramakecommand%
205 if errorlevel 1 goto bogus
206 cd ..
207 goto buildmapi
209 :buildmapi
210 echo Building mapi
211 cd mapi
212 nmake -nologo -f makefile EXTRACFLAGS=%extracflags% EXTRALDFLAGS=%extraldflags% EXTRALIBES=%extralibes% %extramakecommand%
213 if errorlevel 1 goto bogus
214 cd ..
216 :nobuildmapi
217 echo Alpine build complete.
218 goto fini
220 :bogus
221 echo Problems building Alpine!
223 :fini