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