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