local-system-acct-20041017
[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. Install Wix 2.0
37    J. Build Wix MSI Install Package
38    K. Final Results
39    L. Optional Items
40         
41 The Microsoft development tools require anywhere from 660 MB to 1.8GB
42 of storage depending on which compilers are selected.  The following 
43 versions are supported:
44
45     Microsoft Visual C++ 6.0
46     Microsoft Visual .NET 
47     Microsoft Visual .NET 2003 (recommended)
48
49     Microsoft Platform SDK for Windows XP SP2
50       [Core and Data Access SDKs are required]
51
52 The NSIS installer requires about 14 MB of storage. The following 
53 version is supported.
54
55     Nullsoft Scriptable Installation System 2.0 
56
57 The InstallShield scripts (although not supported) require version 5.5
58 of InstallShiled. Version 6.0 or higher of InstallShield are not 
59 compatible.
60
61 The OpenAFS Source directory requires about 360 MB storage. The Source
62 directory size includes additional space for files that will be
63 generated during the build process.
64
65
66 STEP A. Obtain a copy of the Open AFS Source Tree.
67
68 Transfer OpenAFS source tree onto your hardrive.  The source can be
69 downloaded from the OpenAFS web site:
70         http://www.OpenAFS.org/release/snapindex.html.
71
72 For this example, download source for version 1.3.60 using the
73 following URL:
74 http://www.openafs.org/dl/openafs/1.3.60/openafs-1.3.60-src.tar
75
76 HINT: DailySnapShots are pre-release source trees and much more
77 likely to have compilation errors. If this is your first attempt, do
78 your build based on a release version of the source, e.g. 1.3.60. Once
79 you have completed a build process successfully, you can experiment with
80 other source trees.
81
82 You will need an unzip utility that can expand compressed tar files.
83 For example "Pkzip for Windows" from Pkware will uncompress tar files.
84 (http://www.pkware.com/)
85
86 Expand the downloaded tar file (openafs-1.3.60-src.tar) into target
87 directory (c:\OpenAFS), the unzip routine will expand the source into a
88 subdirectory tree:
89                 c:\OpenAFS\OpenAFS-1.3.60\src
90
91 Copy the files 'NTMakefile' and 'ntbuild.bat' from 'src' to the OpenAFS 
92 base directory:
93
94   From a DOS command prompt window, enter the following copy commands:
95
96     copy c:\OpenAFS\OpenAFS-1.3.60\src\NTMakefile c:\OpenAFS\OpenAFS-1.3.60\.
97     copy c:\OpenAFS\OpenAFS-1.3.60\src\ntbuild.bat c:\OpenAFS\OpenAFS-1.3.60\.
98
99
100 The AFS base directory should look something like the following:
101
102   c:\OpenAFS\OpenAFS-1.3.60\
103     NTMakefile
104     ntbuild.bat
105     src
106           
107
108 STEP B. Install compiler and development tools.
109
110 Install a copy of Microsoft Visual C++ 6.0, Visual .NET, or Visual .NET 2003.
111 The "Typical" install setting is sufficient.
112
113 (1) You can reduce the installation size by selecting "Custom" install
114 and remove all but the following Options:
115
116         Microsoft Visual C++
117         Data Access
118
119 (2) When asked, Select to Register Environment Variables.
120
121
122 STEP C. Install SDK header files.
123
124 Files from Microsoft's Platform SDK (August 2001 or later) are required to
125 complete a build on Windows 2000 or XP.   You can install the "Core SDK"
126 from
127
128   http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
129
130 by using Internet Explorer 5.x or higher.  (Active X controls are required)
131
132 The header files that are required are found from a Microsoft SDK are:
133
134    netspi.h   (Windows 9x builds)
135    npapi.h    (Windows 2000,XP,2003 builds)
136    netcfgx.h  (NSIS Loopback Adapter installer - Windows 2000,XP,2003 builds)
137    netcfgn.h  (NSIS Loopback Adapter installer - Windows 2000,XP,2003 builds)
138
139 These files come from the following Microsoft DDKs/SDKs:
140
141    npapi.h:
142         Windows XP/2003 Platform SDK - include/
143
144    netcfgn.h, netcfgx.h:
145         Windows XP/2003 DDK - inc/wxp/
146
147    netmpr.h, netspi.h:
148        July 1998 Windows 95 DDK - net/inc/netmpr.h and net/inc/netspi.h
149        July 1999 Windows 98 DDK - src/net/inc/netmpr.h and src/net/inc/netspi.h
150                                 - you need to install "Legacy and Related
151                                   driver samples"
152
153 STEP D. Configure NTBUILD.BAT.
154
155 The NTBUILD.BAT file copied to the OpenAFS base directory must be 
156 customized for use on your development system.  The following variables
157 must be defined to match your configuration:
158
159   AFSVER_CL: Set to 1200 if using MS Visual C++ 6.0
160              Set to 1300 if using MS Visual .NET
161              Set to 1310 if using MS Visual .NET 2003
162
163   MSVCDIR: Set to the short name version of the directory into which
164            the visual C++ compiler was installed regardless of version
165
166   MSSDKDIR: Set to the short name of the directory into which
167             the Platform SDK was installed
168
169   NTDDKDIR: Set the short name of the directory containing the npapi.h file
170
171   AFSROOT: Set to the short name of the OpenAFS Base directory
172
173
174 STEP E. Set version and installation options (optional)
175
176 Add a CellServDB file to install area. CellServDB contains the entries
177 for the various cell names.  You can download a general purpose one
178 from:
179         http://grand.central.org/dl/cellservdb/CellServDB
180 then copy it to %AFSROOT%\src\WINNT\install\NSIS and name it afsdcell.ini
181
182 Edit file %AFSROOT%\src\config\NTMakefile.i386_nt40
183     AFSPRODUCT_VER_MAJOR - Version Major Number
184     AFSPRODUCT_VER_MINOR - Version Minor Number
185     AFSPRODUCT_VER_PATCH - Version Patch Number
186     AFSPRODUCT_VER_BUILD - Version Build Number
187         CELLSERVDB_INSTALL - The default file name for the CellServDB
188         included in the install Package.
189         CELLNAME_DEFAULT -  The default home cell name.
190         CELLSERVDB_WEB  - The default web address to obtain CellServDB
191
192 For example: in the file %AFSROOT%\src\config\NTMakefile.i386_nt40 you would
193 see the following:
194
195    AFSPRODUCT_VER_MAJOR=1
196    AFSPRODUCT_VER_MINOR=3
197    AFSPRODUCT_VER_PATCH=6000
198    AFSPRODUCT_VER_BUILD=0
199    CELLNAME_DEFAULT=openafs.org
200    CELLSERVDB_INSTALL=CellServDB.GrandCentral
201    CELLSERVDB_WEB=http://grand.central.org/dl/cellservdb/CellServDB
202
203 During the Open AFS installation process the user will be presented
204 with two choices for the CellServDB: Local copy (CELLSERVDB_INSTALL) and
205 one that can be downloaded from the web (CELLSERVDB_WEB).
206
207 STEP F. Begin the build
208
209 (1) From Windows 2000/XP open up a DOS prompt window.
210
211 (2) Change to the %AFSROOT% directory
212
213 (3) Configure the environment variables:
214
215     For a release build:
216
217     (a) Execute the VCVARS32.BAT or VSVARS32.BAT file which part of the
218         Visual Studio environment you installed.
219
220     (b) Execute the SETENV.BAT file with the parameters "/2000 /RETAIL"
221
222     (c) Execute the NTBUILD.BAT file with the parameter "free"
223
224     For a debug build:
225
226     (a) Execute the VCVARS32.BAT or VSVARS32.BAT file which part of the
227         Visual Studio environment you installed.
228
229     (b) Execute the SETENV.BAT file with the parameters "/2000 /DEBUG"
230
231     (c) Execute the NTBUILD.BAT file with the parameter "checked"
232
233 (4) Clean the work area:
234
235     nmake /f NTMakefile clean
236
237 (5) Build the complete Windows NT/2000 development environment.
238
239     nmake /f NTMakefile install
240
241 While the build is running you will see many compile warnings. This
242 behavior is normal; the build process is successful as long as the build
243 process doesn't terminate with an error ("nmake.exe return code 0x2")
244 and it displays 'Build Finished Successfully'.
245
246
247 STEP G. Install NSIS 2.0 (optional).
248
249 Download the Nullsoft Scriptable Installation System (NSIS) 2.0 from
250
251     http://nsis.sourceforge.net/home/
252
253 Run the nsis20.exe installer.
254
255 NOTE: The NSIS installer may be rebuilt from source files 
256    
257     C:\Program Files\NSIS\Source
258
259 to enable options not built into the default configuration.  The 
260 OpenAFS installers are built using a modified version of the NSIS
261 sources.  The following changes were made to exehead\config.h.
262
263     NSIS_MAX_STRLEN set to 4096
264     NSIS_CONFIG_LOG defined
265     NSIS_CONFIG_LOG_ODS defined
266     
267
268 STEP H.  Build OpenAFS NSIS install package
269
270 From the DOS command prompt window run:
271
272     nmake /f NTMakefile NSIS
273
274
275 STEP I.  Install Wix MSI Installer
276
277 Download the Wix 2.0.1927.1 installer from 
278
279     http://prdownloads.sourceforge.net/wix/sources-2.0.1927.1.zip
280
281 Apply the following patches to the source tree and execute 
282
283     make ship
284
285 from the \src\wix directory.  
286
287 Index: src/wix/Compiler.cs
288 ===================================================================
289 RCS file: /cvsroot/wix/wix/src/wix/Compiler.cs,v
290 retrieving revision 1.10
291 diff -u -w -r1.10 Compiler.cs
292 --- src/wix/Compiler.cs 28 Jul 2004 15:50:22 -0000      1.10
293 +++ src/wix/Compiler.cs 4 Aug 2004 16:28:16 -0000
294 @@ -647,7 +647,7 @@
295                  // add the core registry keys for each context in the class
296                  for (int i = 0; i < contextCount; ++i)
297                  {
298 -                    this.AddRegistryKey(sourceLineNumbers, null, 0, String.Concat("CLSID\\", classId, "\\", context[i]), String.Empty, String.Concat("\"[!", fileServer, "]", argument == null ? String.Empty : " ", argument, "\""), componentId); // ClassId context
299 +                    this.AddRegistryKey(sourceLineNumbers, null, 0, String.Concat("CLSID\\", classId, "\\", context[i]), String.Empty, String.Concat("\"[#", fileServer, "]", argument == null ? String.Empty : " ", argument, "\""), componentId); // ClassId context
300                      if (null != icon) // ClassId default icon
301                      {
302                          if (null != iconIndex)
303 @@ -7385,6 +7385,20 @@
304                              break;
305                      }
306                          break;
307 +                                       case "Delete":
308 +                                               switch (attrib.Value)
309 +                                               {
310 +                                                       case "install":
311 +                                                               events |= MsiInterop.MsidbServiceControlEventDelete;
312 +                                                               break;
313 +                                                       case "uninstall":
314 +                                                               events |= MsiInterop.MsidbServiceControlEventUninstallDelete;
315 +                                                               break;
316 +                                                       case "both":
317 +                                                               events |= MsiInterop.MsidbServiceControlEventDelete | MsiInterop.MsidbServiceControlEventUninstallDelete;
318 +                                                               break;
319 +                                               }
320 +                                               break;
321                      case "Wait":
322                          wait = Common.IsYes(attrib.Value, sourceLineNumbers, node.Name, attrib.Name, id) ? "1" : "0";   // strings used since integer column is nullable
323                          break;
324 @@ -8715,6 +8729,7 @@
325                          }
326                          bits ^= (bit * 65536);
327                          break;
328 +
329                      default:
330                          bit = this.NameToBit(MsiInterop.CommonControlAttributes, attrib.Name, attrib.Value, node.Name, id);
331                          if (-1 == bit)
332 Index: src/wix/Preprocessor.cs
333 ===================================================================
334 RCS file: /cvsroot/wix/wix/src/wix/Preprocessor.cs,v
335 retrieving revision 1.5
336 diff -u -w -r1.5 Preprocessor.cs
337 --- src/wix/Preprocessor.cs     28 Jul 2004 15:50:22 -0000      1.5
338 +++ src/wix/Preprocessor.cs     4 Aug 2004 16:28:16 -0000
339 @@ -267,12 +267,12 @@
340                              break;
341                          case "ifdef":
342                              stack.Push(context);
343 -                            context = new IfContext(context.IsTrue & context.Active, this.variables.ContainsKey(reader.Value.Trim()), IfState.If);
344 +                            context = new IfContext(context.IsTrue & context.Active, this.IsDefined(reader.Value.Trim()), IfState.If);
345                              ignore = true;
346                              break;
347                          case "ifndef":
348                              stack.Push(context);
349 -                            context = new IfContext(context.IsTrue & context.Active, !this.variables.ContainsKey(reader.Value.Trim()), IfState.If);
350 +                            context = new IfContext(context.IsTrue & context.Active, !this.IsDefined(reader.Value.Trim()), IfState.If);
351                              ignore = true;
352                              break;
353                          case "elseif":
354 @@ -354,6 +354,8 @@
355                              break;
356                          case "endforeach": // endforeach is handled in PreprocessForeach, so seeing it here is an error
357                              throw new WixPreprocessorException(this.GetCurrentSourceLineNumbers(), "Cannot have a <?endforeach?> processing instruction without a matching <?foreach?>.");
358 +                                               case "error":
359 +                                                       throw new WixPreprocessorException(this.GetCurrentSourceLineNumbers(), this.PreprocessVariables(reader.Value));
360                          default:
361                              // Console.WriteLine("processing instruction: {0}, {1}", reader.Name, reader.Value);
362                              break;
363 @@ -401,6 +403,22 @@
364          }
365  
366          /// <summary>
367 +               /// Returns true if the symbol exists.
368 +               /// </summary>
369 +               /// <param name="symbol">symbol name to check</param>
370 +               /// <returns>true if symbol is defined</returns>
371 +               private bool IsDefined(string symbol)
372 +               {
373 +                       if( symbol.StartsWith("env.") )
374 +                               return Environment.GetEnvironmentVariable(symbol.Substring(4)) != null;
375 +                       if( symbol.StartsWith("var.") )
376 +                               return this.variables.ContainsKey(symbol.Substring(4));
377 +                       if( symbol.StartsWith("sys.") )
378 +                               return this.systemVariables.ContainsKey(symbol.Substring(4));
379 +                       return this.variables.ContainsKey(symbol);
380 +               }
381 +
382 +        /// <summary>
383          /// Replaces parameters in the source text.
384          /// </summary>
385          /// <param name="value">Text that may contain parameters to replace.</param>
386 Index: src/wix/wix.csproj
387 ===================================================================
388 RCS file: /cvsroot/wix/wix/src/wix/wix.csproj,v
389 retrieving revision 1.4
390 diff -u -w -r1.4 wix.csproj
391 --- src/wix/wix.csproj  31 May 2004 01:07:40 -0000      1.4
392 +++ src/wix/wix.csproj  4 Aug 2004 16:28:16 -0000
393 @@ -659,9 +659,19 @@
394                      BuildAction = "EmbeddedResource"
395                  />
396                  <File
397 +                    RelPath = "Xsd\wix.xsx"
398 +                    DependentUpon = "wix.xsd"
399 +                    BuildAction = "None"
400 +                />
401 +                <File
402                      RelPath = "Xsd\wixloc.xsd"
403                      BuildAction = "Content"
404                  />
405 +                <File
406 +                    RelPath = "Xsd\wixloc.xsx"
407 +                    DependentUpon = "wixloc.xsd"
408 +                    BuildAction = "None"
409 +                />
410              </Include>
411          </Files>
412      </CSHARP>
413 Index: src/wix/Xsd/wix.xsd
414 ===================================================================
415 RCS file: /cvsroot/wix/wix/src/wix/Xsd/wix.xsd,v
416 retrieving revision 1.12
417 diff -u -w -r1.12 wix.xsd
418 --- src/wix/Xsd/wix.xsd 28 Jul 2004 15:50:24 -0000      1.12
419 +++ src/wix/Xsd/wix.xsd 4 Aug 2004 16:28:17 -0000
420 @@ -2733,6 +2733,7 @@
421                                         </xs:restriction>
422                                 </xs:simpleType>
423                         </xs:attribute>
424 +                       <xs:attribute name="Separator" type="xs:string"/>
425                         <xs:attribute name="Permanent" type="YesNoType"/>
426                         <xs:attribute name="System" type="YesNoType"/>
427                 </xs:complexType>
428
429
430 STEP J.  Build Wix MSI install package
431
432 From the DOS command prompt window run:
433
434     nmake /f NTMakefile wix
435
436 Make sure the binaries installed to \src\wix\release\ship are
437 available in the PATH environment variable
438
439
440 STEP K. Final Results
441
442 The build process generates its binaries in %AFSROOT%\DEST. The subdirectory
443 would look like the following:
444
445 %AFSROOT%:\DEST\{checked,free}\
446         bin
447         etc
448         include
449         lib
450         root.client
451         root.server
452         WinInstall
453
454     Bin - contains build utilities.
455     root.client - contains Open AFS binaries
456     root.server - contain Open AFS Server binaries
457     WinInstall\OpenAFSforWindows.exe - is the install package for Open AFS
458
459
460 STEP L. Optional Items
461
462 The build process has an error table that is compiled for many OpenAFS
463 applications.  This table is generated by Unix based tools.  It is not
464 normally necessary to modify this table so pre-generated source files
465 are included in the OpenAFS source.  If you need to make modifications
466 in these areas the Unix base tools that run on Windows can be found on
467 the web. For example:
468
469         http://cygwin.com/
470
471 Below is a short explanation how to update the error table.
472
473 (1) Install flex and bison from a Unix based tool provider.
474
475 (2) Make changes to the source files.
476
477 There are two files in the source tree that are processed with lex
478 and yacc on UNIX systems, src/comerr/et_lex.lex.l and
479 src/comerr/error_table.y, that when processed produce the files
480 et_lex.lex_nt.c, error_table_nt.c, and error_table_nt.h.
481
482 Since NT does not include lex and yacc or any equivalent tools, we
483 have provided the output files that lex and yacc produce (using Win32
484 ports of flex and bison). This will allow builds to work for anyone
485 who does not need to change the .l and .y files.
486
487 If you do need to change et_lex.lex.l, then you will need to install
488 Win32 port of flex on your system. Put flex.exe in a directory on the
489 path and rebuild.
490
491 If you do need to change error_table.y, then you will need to install
492 a Win32 port of bison on your system. Put bison.exe in a directory on
493 the path, configure bison as explained in step 5, and rebuild.
494
495 You can also attempt to use other replacements for lex and yacc. This
496 will require modifying the LEX and YACC settings in
497 /config/NTMakefile.i386_nt40. If the replacements require different
498 command line options than flex and bison, then you may also need to
499 change src/comerr/NTMakefile.
500
501 (3) Generate new OpenAFS binaries