nt-makefile-configuration-change-20040617
[openafs.git] / README-NT
1 This software has been released under the terms of the IBM Public
2 License.  For details, see the LICENSE file in the top-level source
3 directory or on-line at http://www.openafs.org/dl/license10.html
4
5 The document now provides a step by step procedure that takes the user 
6 from a basic Windows 2000/XP workstation to an OpenAFS development 
7 environment.   Details are provided so that a 'beginning' windows 
8 developer can build an OpenAFS installable package for Windows 2000/XP/2003.
9
10 NOTE:
11 As of the OpenAFS 1.3 release series, Windows platforms released
12 prior to Windows 2000 are not being supported.  The InstallShield
13 installer is still in the source tree but is no longer supported.
14 A new open source installer based on NSIS 2.0 replaces it.
15
16 ***********   Windows 2000/XP/2003 Build Process ****************
17
18 Building OpenAFS for Windows requires configuring a Windows
19 development system by installing compilation tools and header files.
20 Open AFS Software development can be done on Windows 2000 or XP.  The
21 target system, where OpenAFS will be installed, should be either
22 Windows 2000, Windows XP, or Windows 2003.  The building process is 
23 controlled by a nmake file that generates the necessary binaries and 
24 binds them into an install package.
25
26 The following steps describe how to configure Windows 2000/XP:
27
28    A. Obtain a copy of the OpenAFS Source Tree
29    B. Install Compiler and Development tools.
30    C. Install SDK header files
31    D. Configure NTBUILD.BAT
32    E. Set program version Level
33    F. Build Win2000 binaries
34    G. Install NSIS 2.0
35    H. Build NSIS Install Package
36    I. Final Results
37    J. Optional Items
38         
39 The Microsoft development tools require anywhere from 660 MB to 1.8GB
40 of storage depending on which compilers are selected.  The following 
41 versions are supported:
42
43     Microsoft Visual C++ 6.0
44     Microsoft Visual .NET 
45     Microsoft Visual .NET 2003 (recommended)
46
47     Any version of the Microsoft SDK and Tools released August 2001 or later.
48
49 The NSIS installer requires about 14 MB of storage. The following 
50 version is supported.
51
52     Nullsoft Scriptable Installation System 2.0 
53
54 The InstallShield scripts (although not supported) require version 5.5
55 of InstallShiled. Version 6.0 or higher of InstallShield are not 
56 compatible.
57
58 The OpenAFS Source directory requires about 360 MB storage. The Source
59 directory size includes additional space for files that will be
60 generated during the build process.
61
62
63 STEP A. Obtain a copy of the Open AFS Source Tree.
64
65 Transfer OpenAFS source tree onto your hardrive.  The source can be
66 downloaded from the OpenAFS web site:
67         http://www.OpenAFS.org/release/snapindex.html.
68
69 For this example, download source for version 1.3.60 using the
70 following URL:
71 http://www.openafs.org/dl/openafs/1.3.60/openafs-1.3.60-src.tar
72
73 HINT: DailySnapShots are pre-release source trees and much more
74 likely to have compilation errors. If this is your first attempt, do
75 your build based on a release version of the source, e.g. 1.3.60. Once
76 you have completed a build process successfully, you can experiment with
77 other source trees.
78
79 You will need an unzip utility that can expand compressed tar files.
80 For example "Pkzip for Windows" from Pkware will uncompress tar files.
81 (http://www.pkware.com/)
82
83 Expand the downloaded tar file (openafs-1.3.60-src.tar) into target
84 directory (c:\OpenAFS), the unzip routine will expand the source into a
85 subdirectory tree:
86                 c:\OpenAFS\OpenAFS-1.3.60\src
87
88 Copy the files 'NTMakefile' and 'ntbuild.bat' from 'src' to the OpenAFS 
89 base directory:
90
91   From a DOS command prompt window, enter the following copy commands:
92
93     copy c:\OpenAFS\OpenAFS-1.3.60\src\NTMakefile c:\OpenAFS\OpenAFS-1.3.60\.
94     copy c:\OpenAFS\OpenAFS-1.3.60\src\ntbuild.bat c:\OpenAFS\OpenAFS-1.3.60\.
95
96
97 The AFS base directory should look something like the following:
98
99   c:\OpenAFS\OpenAFS-1.3.60\
100     NTMakefile
101     ntbuild.bat
102     src
103           
104
105 STEP B. Install compiler and development tools.
106
107 Install a copy of Microsoft Visual C++ 6.0, Visual .NET, or Visual .NET 2003.
108 The "Typical" install setting is sufficient.
109
110 (1) You can reduce the installation size by selecting "Custom" install
111 and remove all but the following Options:
112
113         Microsoft Visual C++
114         Data Access
115
116 (2) When asked, Select to Register Environment Variables.
117
118
119 STEP C. Install SDK header files.
120
121 Files from Microsoft's Platform SDK (August 2001 or later) are required to
122 complete a build on Windows 2000 or XP.   You can install the "Core SDK"
123 from
124
125   http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
126
127 by using Internet Explorer 5.x or higher.  (Active X controls are required)
128
129 The header files that are required are found from a Microsoft SDK are:
130
131    netspi.h   (Windows 9x builds)
132    npapi.h    (Windows 2000,XP,2003 builds)
133    netcfgx.h  (NSIS Loopback Adapter installer - Windows 2000,XP,2003 builds)
134    netcfgn.h  (NSIS Loopback Adapter installer - Windows 2000,XP,2003 builds)
135
136 These files come from the following Microsoft DDKs/SDKs:
137
138    npapi.h:
139         Windows XP/2003 Platform SDK - include/
140
141    netcfgn.h, netcfgx.h:
142         Windows XP/2003 DDK - inc/wxp/
143
144    netmpr.h, netspi.h:
145        July 1998 Windows 95 DDK - net/inc/netmpr.h and net/inc/netspi.h
146        July 1999 Windows 98 DDK - src/net/inc/netmpr.h and src/net/inc/netspi.h
147                                 - you need to install "Legacy and Related
148                                   driver samples"
149
150 STEP D. Configure NTBUILD.BAT.
151
152 The NTBUILD.BAT file copied to the OpenAFS base directory must be 
153 customized for use on your development system.  The following variables
154 must be defined to match your configuration:
155
156   AFSVER_CL: Set to 1200 if using MS Visual C++ 6.0
157              Set to 1300 if using MS Visual .NET
158              Set to 1310 if using MS Visual .NET 2003
159
160   MSVCDIR: Set to the short name version of the directory into which
161            the visual C++ compiler was installed regardless of version
162
163   MSSDKDIR: Set to the short name of the directory into which
164             the Platform SDK was installed
165
166   NTDDKDIR: Set the short name of the directory containing the npapi.h file
167
168   AFSROOT: Set to the short name of the OpenAFS Base directory
169
170
171 STEP E. Set version and installation options (optional)
172
173 Add a CellServDB file to install area. CellServDB contains the entries
174 for the various cell names.  You can download a general purpose one
175 from:
176         http://grand.central.org/dl/cellservdb/CellServDB
177 then copy it to %AFSROOT%\src\WINNT\install\NSIS and name it afsdcell.ini
178
179 Edit file %AFSROOT%\src\config\NTMakefile.i386_nt40
180     AFSPRODUCT_VER_MAJOR - Version Major Number
181     AFSPRODUCT_VER_MINOR - Version Minor Number
182     AFSPRODUCT_VER_PATCH - Version Patch Number
183     AFSPRODUCT_VER_BUILD - Version Build Number
184         CELLSERVDB_INSTALL - The default file name for the CellServDB
185         included in the install Package.
186         CELLNAME_DEFAULT -  The default home cell name.
187         CELLSERVDB_WEB  - The default web address to obtain CellServDB
188
189 For example: in the file %AFSROOT%\src\config\NTMakefile.i386_nt40 you would
190 see the following:
191
192    AFSPRODUCT_VER_MAJOR=1
193    AFSPRODUCT_VER_MINOR=3
194    AFSPRODUCT_VER_PATCH=6000
195    AFSPRODUCT_VER_BUILD=0
196    CELLNAME_DEFAULT=openafs.org
197    CELLSERVDB_INSTALL=CellServDB.GrandCentral
198    CELLSERVDB_WEB=http://grand.central.org/dl/cellservdb/CellServDB
199
200 During the Open AFS installation process the user will be presented
201 with two choices for the CellServDB: Local copy (CELLSERVDB_INSTALL) and
202 one that can be downloaded from the web (CELLSERVDB_WEB).
203
204 STEP F. Begin the build
205
206 (1) From Windows 2000/XP open up a DOS prompt window.
207
208 (2) Change to the %AFSROOT% directory
209
210 (3) Configure the environment variables:
211
212     For a release build:
213
214     (a) Execute the VCVARS32.BAT or VSVARS32.BAT file which part of the
215         Visual Studio environment you installed.
216
217     (b) Execute the SETENV.BAT file with the parameters "/2000 /RETAIL"
218
219     (c) Execute the NTBUILD.BAT file with the parameter "free"
220
221     For a debug build:
222
223     (a) Execute the VCVARS32.BAT or VSVARS32.BAT file which part of the
224         Visual Studio environment you installed.
225
226     (b) Execute the SETENV.BAT file with the parameters "/2000 /DEBUG"
227
228     (c) Execute the NTBUILD.BAT file with the parameter "checked"
229
230 (4) Clean the work area:
231
232     nmake /f NTMakefile clean
233
234 (5) Build the complete Windows NT/2000 development environment.
235
236     nmake /f NTMakefile install
237
238 While the build is running you will see many compile warnings. This
239 behavior is normal; the build process is successful as long as the build
240 process doesn't terminate with an error ("nmake.exe return code 0x2")
241 and it displays 'Build Finished Successfully'.
242
243
244 STEP G. Install NSIS 2.0 (optional).
245
246 Download the Nullsoft Scriptable Installation System (NSIS) 2.0 from
247
248     http://nsis.sourceforge.net/home/
249
250 Run the nsis20.exe installer.
251
252 NOTE: The NSIS installer may be rebuilt from source files 
253    
254     C:\Program Files\NSIS\Source
255
256 to enable options not built into the default configuration.  The 
257 OpenAFS installers are built using a modified version of the NSIS
258 sources.  The following changes were made to exehead\config.h.
259
260     NSIS_MAX_STRLEN set to 4096
261     NSIS_CONFIG_LOG defined
262     NSIS_CONFIG_LOG_ODS defined
263     
264
265 STEP H.  Build OpenAFS NSIS install package
266
267 From the DOS command prompt window run:
268
269     nmake /f NTMakefile NSIS
270
271
272 STEP I. Final Results
273
274 The build process generates its binaries in %AFSROOT%\DEST. The subdirectory
275 would look like the following:
276
277 %AFSROOT%:\DEST\{checked,free}\
278         bin
279         etc
280         include
281         lib
282         root.client
283         root.server
284         WinInstall
285
286     Bin - contains build utilities.
287     root.client - contains Open AFS binaries
288     root.server - contain Open AFS Server binaries
289     WinInstall\OpenAFSforWindows.exe - is the install package for Open AFS
290
291
292 STEP J. Optional Items
293
294 The build process has an error table that is compiled for many OpenAFS
295 applications.  This table is generated by Unix based tools.  It is not
296 normally necessary to modify this table so pre-generated source files
297 are included in the OpenAFS source.  If you need to make modifications
298 in these areas the Unix base tools that run on Windows can be found on
299 the web. For example:
300
301         http://cygwin.com/
302
303 Below is a short explanation how to update the error table.
304
305 (1) Install flex and bison from a Unix based tool provider.
306
307 (2) Make changes to the source files.
308
309 There are two files in the source tree that are processed with lex
310 and yacc on UNIX systems, src/comerr/et_lex.lex.l and
311 src/comerr/error_table.y, that when processed produce the files
312 et_lex.lex_nt.c, error_table_nt.c, and error_table_nt.h.
313
314 Since NT does not include lex and yacc or any equivalent tools, we
315 have provided the output files that lex and yacc produce (using Win32
316 ports of flex and bison). This will allow builds to work for anyone
317 who does not need to change the .l and .y files.
318
319 If you do need to change et_lex.lex.l, then you will need to install
320 Win32 port of flex on your system. Put flex.exe in a directory on the
321 path and rebuild.
322
323 If you do need to change error_table.y, then you will need to install
324 a Win32 port of bison on your system. Put bison.exe in a directory on
325 the path, configure bison as explained in step 5, and rebuild.
326
327 You can also attempt to use other replacements for lex and yacc. This
328 will require modifying the LEX and YACC settings in
329 /config/NTMakefile.i386_nt40. If the replacements require different
330 command line options than flex and bison, then you may also need to
331 change src/comerr/NTMakefile.
332
333 (3) Generate new OpenAFS binaries