Blame win32/Readme.txt

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