Blame win32/Readme.txt

Packit Service a31ea6
Packit Service a31ea6
                             Windows port
Packit Service a31ea6
                             ============
Packit Service a31ea6
Packit Service a31ea6
This directory contains the files required to build this software on the
Packit Service a31ea6
native Windows platform. This is not a place to look for help if you are
Packit Service a31ea6
using a POSIX emulator, such as Cygwin. Check the Unix instructions for 
Packit Service a31ea6
that.
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
CONTENTS
Packit Service a31ea6
========
Packit Service a31ea6
Packit Service a31ea6
1. General
Packit Service a31ea6
   1.1 Building From the Command-Line
Packit Service a31ea6
   1.2 Configuring The Source
Packit Service a31ea6
   1.3 Compiling
Packit Service a31ea6
   1.4 Installing
Packit Service a31ea6
Packit Service a31ea6
2. Compiler Specifics
Packit Service a31ea6
   2.1 Microsoft Visual C/C++
Packit Service a31ea6
   2.1 GNU C/C++, Mingw Edition
Packit Service a31ea6
   2.2 Borland C++ Builder
Packit Service a31ea6
       2.2.1 Building with iconv support
Packit Service a31ea6
	   2.2.2 Compatability problems with MSVC (and probably CYGWIN)
Packit Service a31ea6
	   2.2.3 Other caveats
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
1. General
Packit Service a31ea6
==========
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
1.1 Building From The Command-Line
Packit Service a31ea6
----------------------------------
Packit Service a31ea6
Packit Service a31ea6
This is the easiest, preferred and currently supported method. It can
Packit Service a31ea6
be that a subdirectory of the directory where this file resides 
Packit Service a31ea6
contains project files for some IDE. If you want to use that, please
Packit Service a31ea6
refer to the readme file within that subdirectory.
Packit Service a31ea6
Packit Service a31ea6
In order to build from the command-line you need to make sure that
Packit Service a31ea6
your compiler works from the command line. This is not always the
Packit Service a31ea6
case, often the required environment variables are missing. If you are
Packit Service a31ea6
not sure, test if this works first. If it doesn't, you will first have
Packit Service a31ea6
to configure your compiler suite to run from the command-line - please
Packit Service a31ea6
refer to your compiler's documentation regarding that.
Packit Service a31ea6
Packit Service a31ea6
The first thing you want to do is configure the source. You can have
Packit Service a31ea6
the configuration script do this automatically for you. The
Packit Service a31ea6
configuration script is written in JScript, a Microsoft's
Packit Service a31ea6
implementation of the ECMA scripting language. Almost every Windows
Packit Service a31ea6
machine can execute this through the Windows Scripting Host. If your
Packit Service a31ea6
system lacks the ability to execute JScript for some reason, you must
Packit Service a31ea6
perform the configuration manually and you are on your own with that.
Packit Service a31ea6
Packit Service a31ea6
The second step is compiling the source and, optionally, installing it
Packit Service a31ea6
to the location of your choosing.
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
1.2 Configuring The Source
Packit Service a31ea6
--------------------------
Packit Service a31ea6
Packit Service a31ea6
The configuration script accepts numerous options. Some of these
Packit Service a31ea6
affect features which will be available in the compiled software,
Packit Service a31ea6
others affect the way the software is built and installed. To see a
Packit Service a31ea6
full list of options supported by the configuration script, run
Packit Service a31ea6
Packit Service a31ea6
  cscript configure.js help
Packit Service a31ea6
Packit Service a31ea6
from the win32 subdirectory. The configuration script will present you
Packit Service a31ea6
the options it accepts and give a biref explanation of these. In every
Packit Service a31ea6
case you will have two sets of options. The first set is specific to
Packit Service a31ea6
the software you are building and the second one is specific to the
Packit Service a31ea6
Windows port.
Packit Service a31ea6
Packit Service a31ea6
Once you have decided which options suit you, run the script with that
Packit Service a31ea6
options. Here is an example:
Packit Service a31ea6
Packit Service a31ea6
  cscript configure.js compiler=msvc prefix=c:\opt 
Packit Service a31ea6
    include=c:\opt\include lib=c:\opt\lib debug=yes
Packit Service a31ea6
Packit Service a31ea6
The previous example will configure the process to use the Microsoft's
Packit Service a31ea6
compiler, install the library in c:\opt, use c:\opt\include and 
Packit Service a31ea6
c:\opt\lib as additional search paths for the compiler and the linker 
Packit Service a31ea6
and build executables with debug symbols.
Packit Service a31ea6
Packit Service a31ea6
Note: Please do not use path names which contain spaces. This will
Packit Service a31ea6
fail. Allowing this would require me to put almost everything in the
Packit Service a31ea6
Makefile in quotas and that looks quite ugly with my
Packit Service a31ea6
syntax-highlighting engine. If you absolutely must use spaces in paths
Packit Service a31ea6
send me an email and tell me why. If there are enough of you out there
Packit Service a31ea6
who need this, or if a single one has a very good reason, I will
Packit Service a31ea6
modify the Makefile to allow spaces in paths.
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
1.3 Compiling
Packit Service a31ea6
-------------
Packit Service a31ea6
Packit Service a31ea6
After the configuration stage has been completed, you want to build
Packit Service a31ea6
the software. You will have to use the make tool which comes with
Packit Service a31ea6
your compiler. If you, for example, configured the source to build
Packit Service a31ea6
with Microsoft's MSVC compiler, you would use the NMAKE utility. If
Packit Service a31ea6
you configured it to build with GNU C compiler, mingw edition, you
Packit Service a31ea6
would use the GNU make. Assuming you use MSVC, type
Packit Service a31ea6
Packit Service a31ea6
  nmake /f Makefile.msvc
Packit Service a31ea6
Packit Service a31ea6
and if you use MinGW, you would type
Packit Service a31ea6
Packit Service a31ea6
  make -f Makefile.mingw
Packit Service a31ea6
Packit Service a31ea6
and if you use Borland's compiler, you would type
Packit Service a31ea6
Packit Service a31ea6
  bmake -f Makefile.bcb
Packit Service a31ea6
Packit Service a31ea6
in the win32 subdirectory. When the building completes, you will find
Packit Service a31ea6
the executable files in win32\bin.* directory, where * stands for the
Packit Service a31ea6
name of the compiler you have used.
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
1.4 Installing
Packit Service a31ea6
--------------
Packit Service a31ea6
Packit Service a31ea6
You can install the software into the directory you specified to the
Packit Service a31ea6
configure script during the configure stage by typing (with MSVC in
Packit Service a31ea6
this example)
Packit Service a31ea6
Packit Service a31ea6
  nmake /f Makefile.msvc install
Packit Service a31ea6
Packit Service a31ea6
That would be it, enjoy.
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
2. Compiler Specifics
Packit Service a31ea6
=====================
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
2.1 Microsoft Visual C/C++
Packit Service a31ea6
--------------------------
Packit Service a31ea6
Packit Service a31ea6
If you use the compiler which comes with Visual Studio .NET, note that
Packit Service a31ea6
it will link to its own C-runtime named msvcr70.dll or msvcr71.dll. This 
Packit Service a31ea6
file is not available on any machine which doesn't have Visual Studio 
Packit Service a31ea6
.NET installed.
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
2.2 GNU C/C++, Mingw edition
Packit Service a31ea6
----------------------------
Packit Service a31ea6
Packit Service a31ea6
When specifying paths to configure.js, please use slashes instead of 
Packit Service a31ea6
backslashes for directory separation. Sometimes Mingw needs this. If
Packit Service a31ea6
this is the case, and you specify backslashes, then the compiler will 
Packit Service a31ea6
complain about not finding necessary header files.
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
2.2 Borland C++ Builder
Packit Service a31ea6
-----------------------
Packit Service a31ea6
Packit Service a31ea6
To compile libxml2 with the BCB6 compiler and associated tools, just follow
Packit Service a31ea6
the basic instructions found in this file file. Be sure to specify 
Packit Service a31ea6
the "compiler=bcb" option when running the configure script. To compile the
Packit Service a31ea6
library and test programs, just type
Packit Service a31ea6
Packit Service a31ea6
  make -fMakefile.bcb
Packit Service a31ea6
Packit Service a31ea6
That should be all that's required. But there are a few other things to note:
Packit Service a31ea6
Packit Service a31ea6
2.2.1 Building with iconv support
Packit Service a31ea6
Packit Service a31ea6
If you configure libxml2 to include iconv support, you will obviously need to
Packit Service a31ea6
obtain the iconv library and include files. To get them, just follow the links 
Packit Service a31ea6
at http://www.gnu.org/software/libiconv/ - there are pre-compiled Win32 
Packit Service a31ea6
versions available, but note that these where built with MSVC. Hence the 
Packit Service a31ea6
supplied import library is in COFF format rather than OMF format. You can 
Packit Service a31ea6
convert this library by using Borland's COFF2OMF utility, or use IMPLIB to 
Packit Service a31ea6
build a new import library from the DLL. Alternatively, it is possible to
Packit Service a31ea6
obtain the iconv source, and build the DLL using the Borland compiler.
Packit Service a31ea6
Packit Service a31ea6
There is a minor problem with the header files for iconv - they expect a
Packit Service a31ea6
macro named "EILSEQ" in errno.h, but this is not defined in the Borland
Packit Service a31ea6
headers, and its absence can cause problems. To circumvent this problem, I
Packit Service a31ea6
define EILSEQ=2 in Makefile.bcb. The value "2" is the value for ENOFILE (file
Packit Service a31ea6
not found). This should not have any disastrous side effects beyond possibly
Packit Service a31ea6
displaying a misleading error message in certain situations.
Packit Service a31ea6
Packit Service a31ea6
2.2.2 Compatability problems with MSVC (and probably CYGWIN)
Packit Service a31ea6
Packit Service a31ea6
A libxml2 DLL generated by BCB is callable from MSVC programs, but there is a
Packit Service a31ea6
minor problem with the names of the symbols exported from the library. The
Packit Service a31ea6
Borland compiler, by default, prepends an underscore character to global 
Packit Service a31ea6
identifiers (functions and global variables) when generating object files.
Packit Service a31ea6
Hence the function "xmlAddChild" is added to the DLL with the name
Packit Service a31ea6
"_xmlAddChild". The MSVC compiler does not have this behaviour, and looks for
Packit Service a31ea6
the unadorned name. I currently circumvent this problem by writing a .def file
Packit Service a31ea6
which causes BOTH the adorned and unadorned names to be exported from the DLL.
Packit Service a31ea6
This behaviour may not be supported in the future.
Packit Service a31ea6
Packit Service a31ea6
An even worse problem is that of generating an import library for the DLL. The
Packit Service a31ea6
Borland-generated DLL is in OMF format. MSVC expects libraries in COFF format,
Packit Service a31ea6
but they don't provide a "OMF2COFF" utility, or even the equivalent of
Packit Service a31ea6
Borland's IMPLIB utility. But it is possible to create an import lib from the
Packit Service a31ea6
.def file, using the command:
Packit Service a31ea6
  LIB /DEF:libxml2.def
Packit Service a31ea6
Packit Service a31ea6
If you don't have the .def file, it's possible to create one manually. Use
Packit Service a31ea6
DUMPBIN /EXPORTS /OUT:libxml2.tmp libxml2.dll to get a list of the exported
Packit Service a31ea6
names, and edit this into .def file format.
Packit Service a31ea6
Packit Service a31ea6
A similar problem is likely with Cygwin.
Packit Service a31ea6
Packit Service a31ea6
2.2.3 Other caveats
Packit Service a31ea6
Packit Service a31ea6
We have tested this only with BCB6, Professional Edition, and BCB 5.5 free
Packit Service a31ea6
command-line tools.
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
Packit Service a31ea6
Authors: Igor Zlatkovic <igor@zlatkovic.com>
Packit Service a31ea6
         Eric Zurcher <Eric.Zurcher@csiro.au>
Packit Service a31ea6
Packit Service a31ea6