Readme.txt 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. Windows port
  2. ============
  3. This directory contains the files required to build this software on the
  4. native Windows platform. This is not a place to look for help if you are
  5. using a POSIX emulator, such as Cygwin. Check the Unix instructions for
  6. that.
  7. CONTENTS
  8. ========
  9. 1. General
  10. 1.1 Building From the Command-Line
  11. 1.2 Configuring The Source
  12. 1.3 Compiling
  13. 1.4 Installing
  14. 2. Compiler Specifics
  15. 2.1 Microsoft Visual C/C++
  16. 2.1 GNU C/C++, Mingw Edition
  17. 2.2 Borland C++ Builder
  18. 2.2.1 Building with iconv support
  19. 2.2.2 Compatability problems with MSVC (and probably CYGWIN)
  20. 2.2.3 Other caveats
  21. 1. General
  22. ==========
  23. 1.1 Building From The Command-Line
  24. ----------------------------------
  25. This is the easiest, preferred and currently supported method. It can
  26. be that a subdirectory of the directory where this file resides
  27. contains project files for some IDE. If you want to use that, please
  28. refer to the readme file within that subdirectory.
  29. In order to build from the command-line you need to make sure that
  30. your compiler works from the command line. This is not always the
  31. case, often the required environment variables are missing. If you are
  32. not sure, test if this works first. If it doesn't, you will first have
  33. to configure your compiler suite to run from the command-line - please
  34. refer to your compiler's documentation regarding that.
  35. The first thing you want to do is configure the source. You can have
  36. the configuration script do this automatically for you. The
  37. configuration script is written in JScript, a Microsoft's
  38. implementation of the ECMA scripting language. Almost every Windows
  39. machine can execute this through the Windows Scripting Host. If your
  40. system lacks the ability to execute JScript for some reason, you must
  41. perform the configuration manually and you are on your own with that.
  42. The second step is compiling the source and, optionally, installing it
  43. to the location of your choosing.
  44. 1.2 Configuring The Source
  45. --------------------------
  46. The configuration script accepts numerous options. Some of these
  47. affect features which will be available in the compiled software,
  48. others affect the way the software is built and installed. To see a
  49. full list of options supported by the configuration script, run
  50. cscript configure.js help
  51. from the win32 subdirectory. The configuration script will present you
  52. the options it accepts and give a biref explanation of these. In every
  53. case you will have two sets of options. The first set is specific to
  54. the software you are building and the second one is specific to the
  55. Windows port.
  56. Once you have decided which options suit you, run the script with that
  57. options. Here is an example:
  58. cscript configure.js compiler=msvc prefix=c:\opt
  59. include=c:\opt\include lib=c:\opt\lib debug=yes
  60. The previous example will configure the process to use the Microsoft's
  61. compiler, install the library in c:\opt, use c:\opt\include and
  62. c:\opt\lib as additional search paths for the compiler and the linker
  63. and build executables with debug symbols.
  64. Note: Please do not use path names which contain spaces. This will
  65. fail. Allowing this would require me to put almost everything in the
  66. Makefile in quotas and that looks quite ugly with my
  67. syntax-highlighting engine. If you absolutely must use spaces in paths
  68. send me an email and tell me why. If there are enough of you out there
  69. who need this, or if a single one has a very good reason, I will
  70. modify the Makefile to allow spaces in paths.
  71. 1.3 Compiling
  72. -------------
  73. After the configuration stage has been completed, you want to build
  74. the software. You will have to use the make tool which comes with
  75. your compiler. If you, for example, configured the source to build
  76. with Microsoft's MSVC compiler, you would use the NMAKE utility. If
  77. you configured it to build with GNU C compiler, mingw edition, you
  78. would use the GNU make. Assuming you use MSVC, type
  79. nmake /f Makefile.msvc
  80. and if you use MinGW, you would type
  81. make -f Makefile.mingw
  82. and if you use Borland's compiler, you would type
  83. bmake -f Makefile.bcb
  84. in the win32 subdirectory. When the building completes, you will find
  85. the executable files in win32\bin.* directory, where * stands for the
  86. name of the compiler you have used.
  87. 1.4 Installing
  88. --------------
  89. You can install the software into the directory you specified to the
  90. configure script during the configure stage by typing (with MSVC in
  91. this example)
  92. nmake /f Makefile.msvc install
  93. That would be it, enjoy.
  94. 2. Compiler Specifics
  95. =====================
  96. 2.1 Microsoft Visual C/C++
  97. --------------------------
  98. If you use the compiler which comes with Visual Studio .NET, note that
  99. it will link to its own C-runtime named msvcr70.dll or msvcr71.dll. This
  100. file is not available on any machine which doesn't have Visual Studio
  101. .NET installed.
  102. 2.2 GNU C/C++, Mingw edition
  103. ----------------------------
  104. When specifying paths to configure.js, please use slashes instead of
  105. backslashes for directory separation. Sometimes Mingw needs this. If
  106. this is the case, and you specify backslashes, then the compiler will
  107. complain about not finding necessary header files.
  108. 2.2 Borland C++ Builder
  109. -----------------------
  110. To compile libxml2 with the BCB6 compiler and associated tools, just follow
  111. the basic instructions found in this file file. Be sure to specify
  112. the "compiler=bcb" option when running the configure script. To compile the
  113. library and test programs, just type
  114. make -fMakefile.bcb
  115. That should be all that's required. But there are a few other things to note:
  116. 2.2.1 Building with iconv support
  117. If you configure libxml2 to include iconv support, you will obviously need to
  118. obtain the iconv library and include files. To get them, just follow the links
  119. at http://www.gnu.org/software/libiconv/ - there are pre-compiled Win32
  120. versions available, but note that these where built with MSVC. Hence the
  121. supplied import library is in COFF format rather than OMF format. You can
  122. convert this library by using Borland's COFF2OMF utility, or use IMPLIB to
  123. build a new import library from the DLL. Alternatively, it is possible to
  124. obtain the iconv source, and build the DLL using the Borland compiler.
  125. There is a minor problem with the header files for iconv - they expect a
  126. macro named "EILSEQ" in errno.h, but this is not defined in the Borland
  127. headers, and its absence can cause problems. To circumvent this problem, I
  128. define EILSEQ=2 in Makefile.bcb. The value "2" is the value for ENOFILE (file
  129. not found). This should not have any disastrous side effects beyond possibly
  130. displaying a misleading error message in certain situations.
  131. 2.2.2 Compatability problems with MSVC (and probably CYGWIN)
  132. A libxml2 DLL generated by BCB is callable from MSVC programs, but there is a
  133. minor problem with the names of the symbols exported from the library. The
  134. Borland compiler, by default, prepends an underscore character to global
  135. identifiers (functions and global variables) when generating object files.
  136. Hence the function "xmlAddChild" is added to the DLL with the name
  137. "_xmlAddChild". The MSVC compiler does not have this behaviour, and looks for
  138. the unadorned name. I currently circumvent this problem by writing a .def file
  139. which causes BOTH the adorned and unadorned names to be exported from the DLL.
  140. This behaviour may not be supported in the future.
  141. An even worse problem is that of generating an import library for the DLL. The
  142. Borland-generated DLL is in OMF format. MSVC expects libraries in COFF format,
  143. but they don't provide a "OMF2COFF" utility, or even the equivalent of
  144. Borland's IMPLIB utility. But it is possible to create an import lib from the
  145. .def file, using the command:
  146. LIB /DEF:libxml2.def
  147. If you don't have the .def file, it's possible to create one manually. Use
  148. DUMPBIN /EXPORTS /OUT:libxml2.tmp libxml2.dll to get a list of the exported
  149. names, and edit this into .def file format.
  150. A similar problem is likely with Cygwin.
  151. 2.2.3 Other caveats
  152. We have tested this only with BCB6, Professional Edition, and BCB 5.5 free
  153. command-line tools.
  154. Authors: Igor Zlatkovic <igor@zlatkovic.com>
  155. Eric Zurcher <Eric.Zurcher@csiro.au>