blob: 6b3edddbe4aaae2c01140fbfd28b4f09628ea2b6 [file] [log] [blame]
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +00001
2 Windows port
Igor Zlatkovic9e0acaa2003-08-28 12:34:00 +00003 ============
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +00004
5This directory contains the files required to build this software on the
Igor Zlatkovic9e0acaa2003-08-28 12:34:00 +00006native Windows platform. This is not a place to look for help if you are
7using a POSIX emulator, such as Cygwin. Check the Unix instructions for
8that.
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +00009
10
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000011
Igor Zlatkovic9e0acaa2003-08-28 12:34:00 +000012CONTENTS
13========
14
151. General
16 1.1 Building From the Command-Line
17 1.2 Configuring The Source
18 1.3 Compiling
19 1.4 Installing
20
212. Compiler Specifics
22 2.1 Microsoft Visual C/C++
23 2.1 GNU C/C++, Mingw Edition
24 2.2 Borland C++ Builder
25 2.2.1 Building with iconv support
26 2.2.2 Compatability problems with MSVC (and probably CYGWIN)
27 2.2.3 Other caveats
28
29
30
31
321. General
33==========
34
35
361.1 Building From The Command-Line
37----------------------------------
38
39This is the easiest, preferred and currently supported method. It can
40be that a subdirectory of the directory where this file resides
41contains project files for some IDE. If you want to use that, please
42refer to the readme file within that subdirectory.
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000043
44In order to build from the command-line you need to make sure that
45your compiler works from the command line. This is not always the
46case, often the required environment variables are missing. If you are
47not sure, test if this works first. If it doesn't, you will first have
48to configure your compiler suite to run from the command-line - please
49refer to your compiler's documentation regarding that.
50
51The first thing you want to do is configure the source. You can have
52the configuration script do this automatically for you. The
53configuration script is written in JScript, a Microsoft's
Igor Zlatkovica6f2d902002-04-16 17:57:17 +000054implementation of the ECMA scripting language. Almost every Windows
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000055machine can execute this through the Windows Scripting Host. If your
56system lacks the ability to execute JScript for some reason, you must
Igor Zlatkovic9e0acaa2003-08-28 12:34:00 +000057perform the configuration manually and you are on your own with that.
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000058
59The second step is compiling the source and, optionally, installing it
60to the location of your choosing.
61
62
Igor Zlatkovic9e0acaa2003-08-28 12:34:00 +0000631.2 Configuring The Source
64--------------------------
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000065
66The configuration script accepts numerous options. Some of these
67affect features which will be available in the compiled software,
68others affect the way the software is built and installed. To see a
69full list of options supported by the configuration script, run
70
71 cscript configure.js help
72
73from the win32 subdirectory. The configuration script will present you
74the options it accepts and give a biref explanation of these. In every
75case you will have two sets of options. The first set is specific to
76the software you are building and the second one is specific to the
77Windows port.
78
79Once you have decided which options suit you, run the script with that
80options. Here is an example:
81
Igor Zlatkovic4f928212003-11-27 18:39:01 +000082 cscript configure.js compiler=msvc prefix=c:\opt
83 include=c:\opt\include lib=c:\opt\lib debug=yes
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000084
Igor Zlatkovic4f928212003-11-27 18:39:01 +000085The previous example will configure the process to use the Microsoft's
86compiler, install the library in c:\opt, use c:\opt\include and
87c:\opt\lib as additional search paths for the compiler and the linker
88and build executables with debug symbols.
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000089
90Note: Please do not use path names which contain spaces. This will
91fail. Allowing this would require me to put almost everything in the
92Makefile in quotas and that looks quite ugly with my
93syntax-highlighting engine. If you absolutely must use spaces in paths
94send me an email and tell me why. If there are enough of you out there
95who need this, or if a single one has a very good reason, I will
96modify the Makefile to allow spaces in paths.
97
98
Igor Zlatkovic9e0acaa2003-08-28 12:34:00 +0000991.3 Compiling
100-------------
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000101
102After the configuration stage has been completed, you want to build
Igor Zlatkovicb2f61632002-11-14 17:43:55 +0000103the software. You will have to use the make tool which comes with
104your compiler. If you, for example, configured the source to build
105with Microsoft's MSVC compiler, you would use the NMAKE utility. If
Igor Zlatkovic9e0acaa2003-08-28 12:34:00 +0000106you configured it to build with GNU C compiler, mingw edition, you
Igor Zlatkovicb2f61632002-11-14 17:43:55 +0000107would use the GNU make. Assuming you use MSVC, type
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000108
Igor Zlatkovic4f928212003-11-27 18:39:01 +0000109 nmake /f Makefile.msvc
110
111and if you use MinGW, you would type
112
113 make -f Makefile.mingw
114
115and if you use Borland's compiler, you would type
116
117 bmake -f Makefile.bcb
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000118
Igor Zlatkovicb2f61632002-11-14 17:43:55 +0000119in the win32 subdirectory. When the building completes, you will find
Igor Zlatkovic4f928212003-11-27 18:39:01 +0000120the executable files in win32\bin.* directory, where * stands for the
121name of the compiler you have used.
122
Igor Zlatkovic9e0acaa2003-08-28 12:34:00 +0000123
1241.4 Installing
125--------------
126
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000127You can install the software into the directory you specified to the
Igor Zlatkovic4f928212003-11-27 18:39:01 +0000128configure script during the configure stage by typing (with MSVC in
129this example)
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000130
Igor Zlatkovic4f928212003-11-27 18:39:01 +0000131 nmake /f Makefile.msvc install
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000132
133That would be it, enjoy.
134
135
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000136
137
Igor Zlatkovic9e0acaa2003-08-28 12:34:00 +0000138
1392. Compiler Specifics
140=====================
141
142
1432.1 Microsoft Visual C/C++
144--------------------------
145
146If you use the compiler which comes with Visual Studio .NET, note that
Igor Zlatkovic4f928212003-11-27 18:39:01 +0000147it will link to its own C-runtime named msvcr70.dll or msvcr71.dll. This
148file is not available on any machine which doesn't have Visual Studio
149.NET installed.
Igor Zlatkovic9e0acaa2003-08-28 12:34:00 +0000150
151
1522.2 GNU C/C++, Mingw edition
153----------------------------
154
155When specifying paths to configure.js, please use slashes instead of
156backslashes for directory separation. Sometimes Mingw needs this. If
Igor Zlatkovic4f928212003-11-27 18:39:01 +0000157this is the case, and you specify backslashes, then the compiler will
158complain about not finding necessary header files.
Igor Zlatkovic9e0acaa2003-08-28 12:34:00 +0000159
160
1612.2 Borland C++ Builder
162-----------------------
163
164To compile libxml2 with the BCB6 compiler and associated tools, just follow
165the basic instructions found in this file file. Be sure to specify
166the "compiler=bcb" option when running the configure script. To compile the
167library and test programs, just type
168
169 make -fMakefile.bcb
170
171That should be all that's required. But there are a few other things to note:
172
1732.2.1 Building with iconv support
174
175If you configure libxml2 to include iconv support, you will obviously need to
176obtain the iconv library and include files. To get them, just follow the links
177at http://www.gnu.org/software/libiconv/ - there are pre-compiled Win32
178versions available, but note that these where built with MSVC. Hence the
179supplied import library is in COFF format rather than OMF format. You can
180convert this library by using Borland's COFF2OMF utility, or use IMPLIB to
181build a new import library from the DLL. Alternatively, it is possible to
182obtain the iconv source, and build the DLL using the Borland compiler.
183
184There is a minor problem with the header files for iconv - they expect a
185macro named "EILSEQ" in errno.h, but this is not defined in the Borland
186headers, and its absence can cause problems. To circumvent this problem, I
187define EILSEQ=2 in Makefile.bcb. The value "2" is the value for ENOFILE (file
188not found). This should not have any disastrous side effects beyond possibly
189displaying a misleading error message in certain situations.
190
1912.2.2 Compatability problems with MSVC (and probably CYGWIN)
192
193A libxml2 DLL generated by BCB is callable from MSVC programs, but there is a
194minor problem with the names of the symbols exported from the library. The
195Borland compiler, by default, prepends an underscore character to global
196identifiers (functions and global variables) when generating object files.
197Hence the function "xmlAddChild" is added to the DLL with the name
198"_xmlAddChild". The MSVC compiler does not have this behaviour, and looks for
199the unadorned name. I currently circumvent this problem by writing a .def file
200which causes BOTH the adorned and unadorned names to be exported from the DLL.
201This behaviour may not be supported in the future.
202
203An even worse problem is that of generating an import library for the DLL. The
204Borland-generated DLL is in OMF format. MSVC expects libraries in COFF format,
205but they don't provide a "OMF2COFF" utility, or even the equivalent of
206Borland's IMPLIB utility. But it is possible to create an import lib from the
207.def file, using the command:
208 LIB /DEF:libxml2.def
209
210If you don't have the .def file, it's possible to create one manually. Use
211DUMPBIN /EXPORTS /OUT:libxml2.tmp libxml2.dll to get a list of the exported
212names, and edit this into .def file format.
213
214A similar problem is likely with Cygwin.
215
2162.2.3 Other caveats
217
Igor Zlatkovic4f928212003-11-27 18:39:01 +0000218We have tested this only with BCB6, Professional Edition, and BCB 5.5 free
219command-line tools.
Igor Zlatkovic9e0acaa2003-08-28 12:34:00 +0000220
221
222
223Authors: Igor Zlatkovic <igor@zlatkovic.com>
224 Eric Zurcher <Eric.Zurcher@csiro.au>
225
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000226