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