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