1*7c568831SAndroid Build Coastguard Worker/* Configure script for libxml, specific for Windows with Scripting Host. 2*7c568831SAndroid Build Coastguard Worker * 3*7c568831SAndroid Build Coastguard Worker * This script will configure the libxml build process and create necessary files. 4*7c568831SAndroid Build Coastguard Worker * Run it with an 'help', or an invalid option and it will tell you what options 5*7c568831SAndroid Build Coastguard Worker * it accepts. 6*7c568831SAndroid Build Coastguard Worker * 7*7c568831SAndroid Build Coastguard Worker * March 2002, Igor Zlatkovic <[email protected]> 8*7c568831SAndroid Build Coastguard Worker */ 9*7c568831SAndroid Build Coastguard Worker 10*7c568831SAndroid Build Coastguard Worker/* The source directory, relative to the one where this file resides. */ 11*7c568831SAndroid Build Coastguard Workervar srcDirXml = ".."; 12*7c568831SAndroid Build Coastguard Workervar srcDirUtils = ".."; 13*7c568831SAndroid Build Coastguard Worker/* Base name of what we are building. */ 14*7c568831SAndroid Build Coastguard Workervar baseName = "libxml2"; 15*7c568831SAndroid Build Coastguard Worker/* Configure file which contains the version and the output file where 16*7c568831SAndroid Build Coastguard Worker we can store our build configuration. */ 17*7c568831SAndroid Build Coastguard Workervar configFile = srcDirXml + "\\configure.ac"; 18*7c568831SAndroid Build Coastguard Workervar versionFile = ".\\config.msvc"; 19*7c568831SAndroid Build Coastguard Worker/* Input and output files regarding the libxml features. */ 20*7c568831SAndroid Build Coastguard Workervar optsFileIn = srcDirXml + "\\include\\libxml\\xmlversion.h.in"; 21*7c568831SAndroid Build Coastguard Workervar optsFile = srcDirXml + "\\include\\libxml\\xmlversion.h"; 22*7c568831SAndroid Build Coastguard Worker/* Version strings for the binary distribution. Will be filled later 23*7c568831SAndroid Build Coastguard Worker in the code. */ 24*7c568831SAndroid Build Coastguard Workervar verMajor; 25*7c568831SAndroid Build Coastguard Workervar verMinor; 26*7c568831SAndroid Build Coastguard Workervar verMicro; 27*7c568831SAndroid Build Coastguard Workervar verMicroSuffix; 28*7c568831SAndroid Build Coastguard Workervar verCvs; 29*7c568831SAndroid Build Coastguard Workervar useCvsVer = true; 30*7c568831SAndroid Build Coastguard Worker/* Libxml features. */ 31*7c568831SAndroid Build Coastguard Workervar withThreads = "native"; 32*7c568831SAndroid Build Coastguard Workervar withHttp = true; 33*7c568831SAndroid Build Coastguard Workervar withHtml = true; 34*7c568831SAndroid Build Coastguard Workervar withC14n = true; 35*7c568831SAndroid Build Coastguard Workervar withCatalog = true; 36*7c568831SAndroid Build Coastguard Workervar withXpath = true; 37*7c568831SAndroid Build Coastguard Workervar withXptr = true; 38*7c568831SAndroid Build Coastguard Workervar withXinclude = true; 39*7c568831SAndroid Build Coastguard Workervar withIconv = true; 40*7c568831SAndroid Build Coastguard Workervar withIcu = false; 41*7c568831SAndroid Build Coastguard Workervar withIso8859x = false; 42*7c568831SAndroid Build Coastguard Workervar withZlib = false; 43*7c568831SAndroid Build Coastguard Workervar withLzma = false; 44*7c568831SAndroid Build Coastguard Workervar withDebug = true; 45*7c568831SAndroid Build Coastguard Workervar withSchemas = true; 46*7c568831SAndroid Build Coastguard Workervar withSchematron = true; 47*7c568831SAndroid Build Coastguard Workervar withRegExps = true; 48*7c568831SAndroid Build Coastguard Workervar withModules = true; 49*7c568831SAndroid Build Coastguard Workervar withTree = true; 50*7c568831SAndroid Build Coastguard Workervar withReader = true; 51*7c568831SAndroid Build Coastguard Workervar withWriter = true; 52*7c568831SAndroid Build Coastguard Workervar withWalker = true; 53*7c568831SAndroid Build Coastguard Workervar withPattern = true; 54*7c568831SAndroid Build Coastguard Workervar withPush = true; 55*7c568831SAndroid Build Coastguard Workervar withValid = true; 56*7c568831SAndroid Build Coastguard Workervar withSax1 = true; 57*7c568831SAndroid Build Coastguard Workervar withLegacy = true; 58*7c568831SAndroid Build Coastguard Workervar withOutput = true; 59*7c568831SAndroid Build Coastguard Workervar withPython = false; 60*7c568831SAndroid Build Coastguard Worker/* Win32 build options. */ 61*7c568831SAndroid Build Coastguard Workervar dirSep = "\\"; 62*7c568831SAndroid Build Coastguard Workervar compiler = "msvc"; 63*7c568831SAndroid Build Coastguard Workervar cruntime = "/MD"; 64*7c568831SAndroid Build Coastguard Workervar dynruntime = true; 65*7c568831SAndroid Build Coastguard Workervar vcmanifest = false; 66*7c568831SAndroid Build Coastguard Workervar buildDebug = 0; 67*7c568831SAndroid Build Coastguard Workervar buildStatic = 0; 68*7c568831SAndroid Build Coastguard Workervar buildPrefix = "."; 69*7c568831SAndroid Build Coastguard Workervar buildBinPrefix = ""; 70*7c568831SAndroid Build Coastguard Workervar buildIncPrefix = ""; 71*7c568831SAndroid Build Coastguard Workervar buildLibPrefix = ""; 72*7c568831SAndroid Build Coastguard Workervar buildSoPrefix = ""; 73*7c568831SAndroid Build Coastguard Workervar buildInclude = "."; 74*7c568831SAndroid Build Coastguard Workervar buildLib = "."; 75*7c568831SAndroid Build Coastguard Worker/* Local stuff */ 76*7c568831SAndroid Build Coastguard Workervar error = 0; 77*7c568831SAndroid Build Coastguard Worker 78*7c568831SAndroid Build Coastguard Worker/* Helper function, transforms the option variable into the 'Enabled' 79*7c568831SAndroid Build Coastguard Worker or 'Disabled' string. */ 80*7c568831SAndroid Build Coastguard Workerfunction boolToStr(opt) 81*7c568831SAndroid Build Coastguard Worker{ 82*7c568831SAndroid Build Coastguard Worker if (opt == false) 83*7c568831SAndroid Build Coastguard Worker return "no"; 84*7c568831SAndroid Build Coastguard Worker else if (opt == true) 85*7c568831SAndroid Build Coastguard Worker return "yes"; 86*7c568831SAndroid Build Coastguard Worker error = 1; 87*7c568831SAndroid Build Coastguard Worker return "*** undefined ***"; 88*7c568831SAndroid Build Coastguard Worker} 89*7c568831SAndroid Build Coastguard Worker 90*7c568831SAndroid Build Coastguard Worker/* Helper function, transforms the argument string into a boolean 91*7c568831SAndroid Build Coastguard Worker value. */ 92*7c568831SAndroid Build Coastguard Workerfunction strToBool(opt) 93*7c568831SAndroid Build Coastguard Worker{ 94*7c568831SAndroid Build Coastguard Worker if (opt == 0 || opt == "no") 95*7c568831SAndroid Build Coastguard Worker return false; 96*7c568831SAndroid Build Coastguard Worker else if (opt == 1 || opt == "yes") 97*7c568831SAndroid Build Coastguard Worker return true; 98*7c568831SAndroid Build Coastguard Worker error = 1; 99*7c568831SAndroid Build Coastguard Worker return false; 100*7c568831SAndroid Build Coastguard Worker} 101*7c568831SAndroid Build Coastguard Worker 102*7c568831SAndroid Build Coastguard Worker/* Displays the details about how to use this script. */ 103*7c568831SAndroid Build Coastguard Workerfunction usage() 104*7c568831SAndroid Build Coastguard Worker{ 105*7c568831SAndroid Build Coastguard Worker var txt; 106*7c568831SAndroid Build Coastguard Worker txt = "Usage:\n"; 107*7c568831SAndroid Build Coastguard Worker txt += " cscript " + WScript.ScriptName + " <options>\n"; 108*7c568831SAndroid Build Coastguard Worker txt += " cscript " + WScript.ScriptName + " help\n\n"; 109*7c568831SAndroid Build Coastguard Worker txt += "Options can be specified in the form <option>=<value>, where the value is\n"; 110*7c568831SAndroid Build Coastguard Worker txt += "either 'yes' or 'no', if not stated otherwise.\n\n"; 111*7c568831SAndroid Build Coastguard Worker txt += "\nXML processor options, default value given in parentheses:\n\n"; 112*7c568831SAndroid Build Coastguard Worker txt += " threads: Enable thread safety [no|ctls|native|posix] (" + (withThreads) + ") \n"; 113*7c568831SAndroid Build Coastguard Worker txt += " http: Enable HTTP client (" + (withHttp? "yes" : "no") + ")\n"; 114*7c568831SAndroid Build Coastguard Worker txt += " html: Enable HTML processor (" + (withHtml? "yes" : "no") + ")\n"; 115*7c568831SAndroid Build Coastguard Worker txt += " c14n: Enable C14N support (" + (withC14n? "yes" : "no") + ")\n"; 116*7c568831SAndroid Build Coastguard Worker txt += " catalog: Enable catalog support (" + (withCatalog? "yes" : "no") + ")\n"; 117*7c568831SAndroid Build Coastguard Worker txt += " xpath: Enable XPath support (" + (withXpath? "yes" : "no") + ")\n"; 118*7c568831SAndroid Build Coastguard Worker txt += " xptr: Enable XPointer support (" + (withXptr? "yes" : "no") + ")\n"; 119*7c568831SAndroid Build Coastguard Worker txt += " xinclude: Enable XInclude support (" + (withXinclude? "yes" : "no") + ")\n"; 120*7c568831SAndroid Build Coastguard Worker txt += " iconv: Enable iconv support (" + (withIconv? "yes" : "no") + ")\n"; 121*7c568831SAndroid Build Coastguard Worker txt += " icu: Enable icu support (" + (withIcu? "yes" : "no") + ")\n"; 122*7c568831SAndroid Build Coastguard Worker txt += " iso8859x: Enable ISO8859X support (" + (withIso8859x? "yes" : "no") + ")\n"; 123*7c568831SAndroid Build Coastguard Worker txt += " zlib: Enable zlib support (" + (withZlib? "yes" : "no") + ")\n"; 124*7c568831SAndroid Build Coastguard Worker txt += " lzma: Enable lzma support (" + (withLzma? "yes" : "no") + ")\n"; 125*7c568831SAndroid Build Coastguard Worker txt += " xml_debug: Enable XML debbugging module (" + (withDebug? "yes" : "no") + ")\n"; 126*7c568831SAndroid Build Coastguard Worker txt += " regexps: Enable regular expressions (" + (withRegExps? "yes" : "no") + ")\n"; 127*7c568831SAndroid Build Coastguard Worker txt += " modules: Enable module support (" + (withModules? "yes" : "no") + ")\n"; 128*7c568831SAndroid Build Coastguard Worker txt += " tree: Enable tree api (" + (withTree? "yes" : "no") + ")\n"; 129*7c568831SAndroid Build Coastguard Worker txt += " reader: Enable xmlReader api (" + (withReader? "yes" : "no") + ")\n"; 130*7c568831SAndroid Build Coastguard Worker txt += " writer: Enable xmlWriter api (" + (withWriter? "yes" : "no") + ")\n"; 131*7c568831SAndroid Build Coastguard Worker txt += " walker: Enable xmlDocWalker api (" + (withWalker? "yes" : "no") + ")\n"; 132*7c568831SAndroid Build Coastguard Worker txt += " pattern: Enable xmlPattern api (" + (withPattern? "yes" : "no") + ")\n"; 133*7c568831SAndroid Build Coastguard Worker txt += " push: Enable push api (" + (withPush? "yes" : "no") + ")\n"; 134*7c568831SAndroid Build Coastguard Worker txt += " valid: Enable DTD validation support (" + (withValid? "yes" : "no") + ")\n"; 135*7c568831SAndroid Build Coastguard Worker txt += " sax1: Enable SAX1 api (" + (withSax1? "yes" : "no") + ")\n"; 136*7c568831SAndroid Build Coastguard Worker txt += " legacy: Enable Deprecated api's (" + (withLegacy? "yes" : "no") + ")\n"; 137*7c568831SAndroid Build Coastguard Worker txt += " output: Enable serialization support (" + (withOutput? "yes" : "no") + ")\n"; 138*7c568831SAndroid Build Coastguard Worker txt += " schemas: Enable XML Schema support (" + (withSchemas? "yes" : "no") + ")\n"; 139*7c568831SAndroid Build Coastguard Worker txt += " schematron: Enable Schematron support (" + (withSchematron? "yes" : "no") + ")\n"; 140*7c568831SAndroid Build Coastguard Worker txt += " python: Build Python bindings (" + (withPython? "yes" : "no") + ")\n"; 141*7c568831SAndroid Build Coastguard Worker txt += "\nWin32 build options, default value given in parentheses:\n\n"; 142*7c568831SAndroid Build Coastguard Worker txt += " compiler: Compiler to be used [msvc|mingw|bcb] (" + compiler + ")\n"; 143*7c568831SAndroid Build Coastguard Worker txt += " cruntime: C-runtime compiler option (only msvc) (" + cruntime + ")\n"; 144*7c568831SAndroid Build Coastguard Worker txt += " dynruntime: Use the dynamic RTL (only bcb) (" + dynruntime + ")\n"; 145*7c568831SAndroid Build Coastguard Worker txt += " vcmanifest: Embed VC manifest (only msvc) (" + (vcmanifest? "yes" : "no") + ")\n"; 146*7c568831SAndroid Build Coastguard Worker txt += " debug: Build unoptimised debug executables (" + (buildDebug? "yes" : "no") + ")\n"; 147*7c568831SAndroid Build Coastguard Worker txt += " static: Link xmllint statically to libxml2 (" + (buildStatic? "yes" : "no") + ")\n"; 148*7c568831SAndroid Build Coastguard Worker txt += " Note: automatically enabled if cruntime is not /MD or /MDd\n"; 149*7c568831SAndroid Build Coastguard Worker txt += " prefix: Base directory for the installation (" + buildPrefix + ")\n"; 150*7c568831SAndroid Build Coastguard Worker txt += " bindir: Directory where xmllint and friends should be installed\n"; 151*7c568831SAndroid Build Coastguard Worker txt += " (" + buildBinPrefix + ")\n"; 152*7c568831SAndroid Build Coastguard Worker txt += " incdir: Directory where headers should be installed\n"; 153*7c568831SAndroid Build Coastguard Worker txt += " (" + buildIncPrefix + ")\n"; 154*7c568831SAndroid Build Coastguard Worker txt += " libdir: Directory where static and import libraries should be\n"; 155*7c568831SAndroid Build Coastguard Worker txt += " installed (" + buildLibPrefix + ")\n"; 156*7c568831SAndroid Build Coastguard Worker txt += " sodir: Directory where shared libraries should be installed\n"; 157*7c568831SAndroid Build Coastguard Worker txt += " (" + buildSoPrefix + ")\n"; 158*7c568831SAndroid Build Coastguard Worker txt += " include: Additional search path for the compiler, particularly\n"; 159*7c568831SAndroid Build Coastguard Worker txt += " where iconv headers can be found (" + buildInclude + ")\n"; 160*7c568831SAndroid Build Coastguard Worker txt += " lib: Additional search path for the linker, particularly\n"; 161*7c568831SAndroid Build Coastguard Worker txt += " where iconv library can be found (" + buildLib + ")\n"; 162*7c568831SAndroid Build Coastguard Worker WScript.Echo(txt); 163*7c568831SAndroid Build Coastguard Worker} 164*7c568831SAndroid Build Coastguard Worker 165*7c568831SAndroid Build Coastguard Worker/* Discovers the version we are working with by reading the appropriate 166*7c568831SAndroid Build Coastguard Worker configuration file. Despite its name, this also writes the configuration 167*7c568831SAndroid Build Coastguard Worker file included by our makefile. */ 168*7c568831SAndroid Build Coastguard Workerfunction discoverVersion() 169*7c568831SAndroid Build Coastguard Worker{ 170*7c568831SAndroid Build Coastguard Worker var fso, cf, vf, ln, s, iDot, iSlash; 171*7c568831SAndroid Build Coastguard Worker fso = new ActiveXObject("Scripting.FileSystemObject"); 172*7c568831SAndroid Build Coastguard Worker verCvs = ""; 173*7c568831SAndroid Build Coastguard Worker cf = fso.OpenTextFile(configFile, 1); 174*7c568831SAndroid Build Coastguard Worker if (compiler == "msvc") 175*7c568831SAndroid Build Coastguard Worker versionFile = ".\\config.msvc"; 176*7c568831SAndroid Build Coastguard Worker else if (compiler == "mingw") 177*7c568831SAndroid Build Coastguard Worker versionFile = ".\\config.mingw"; 178*7c568831SAndroid Build Coastguard Worker else if (compiler == "bcb") 179*7c568831SAndroid Build Coastguard Worker versionFile = ".\\config.bcb"; 180*7c568831SAndroid Build Coastguard Worker vf = fso.CreateTextFile(versionFile, true); 181*7c568831SAndroid Build Coastguard Worker vf.WriteLine("# " + versionFile); 182*7c568831SAndroid Build Coastguard Worker vf.WriteLine("# This file is generated automatically by " + WScript.ScriptName + "."); 183*7c568831SAndroid Build Coastguard Worker vf.WriteBlankLines(1); 184*7c568831SAndroid Build Coastguard Worker while (cf.AtEndOfStream != true) { 185*7c568831SAndroid Build Coastguard Worker ln = cf.ReadLine(); 186*7c568831SAndroid Build Coastguard Worker s = new String(ln); 187*7c568831SAndroid Build Coastguard Worker if (m = s.match(/^m4_define\(\[MAJOR_VERSION\], (\w+)\)/)) { 188*7c568831SAndroid Build Coastguard Worker vf.WriteLine("LIBXML_MAJOR_VERSION=" + m[1]); 189*7c568831SAndroid Build Coastguard Worker verMajor = m[1]; 190*7c568831SAndroid Build Coastguard Worker } else if(m = s.match(/^m4_define\(\[MINOR_VERSION\], (\w+)\)/)) { 191*7c568831SAndroid Build Coastguard Worker vf.WriteLine("LIBXML_MINOR_VERSION=" + m[1]); 192*7c568831SAndroid Build Coastguard Worker verMinor = m[1]; 193*7c568831SAndroid Build Coastguard Worker } else if(m = s.match(/^m4_define\(\[MICRO_VERSION\], (\w+)\)/)) { 194*7c568831SAndroid Build Coastguard Worker vf.WriteLine("LIBXML_MICRO_VERSION=" + m[1]); 195*7c568831SAndroid Build Coastguard Worker verMicro = m[1]; 196*7c568831SAndroid Build Coastguard Worker } else if(s.search(/^LIBXML_MICRO_VERSION_SUFFIX=/) != -1) { 197*7c568831SAndroid Build Coastguard Worker vf.WriteLine(s); 198*7c568831SAndroid Build Coastguard Worker verMicroSuffix = s.substring(s.indexOf("=") + 1, s.length); 199*7c568831SAndroid Build Coastguard Worker } 200*7c568831SAndroid Build Coastguard Worker } 201*7c568831SAndroid Build Coastguard Worker cf.Close(); 202*7c568831SAndroid Build Coastguard Worker vf.WriteLine("XML_SRCDIR=" + srcDirXml); 203*7c568831SAndroid Build Coastguard Worker vf.WriteLine("UTILS_SRCDIR=" + srcDirUtils); 204*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_THREADS=" + withThreads); 205*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_HTTP=" + (withHttp? "1" : "0")); 206*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_HTML=" + (withHtml? "1" : "0")); 207*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_C14N=" + (withC14n? "1" : "0")); 208*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_CATALOG=" + (withCatalog? "1" : "0")); 209*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_XPATH=" + (withXpath? "1" : "0")); 210*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_XPTR=" + (withXptr? "1" : "0")); 211*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_XINCLUDE=" + (withXinclude? "1" : "0")); 212*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_ICONV=" + (withIconv? "1" : "0")); 213*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_ICU=" + (withIcu? "1" : "0")); 214*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_ISO8859X=" + (withIso8859x? "1" : "0")); 215*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_ZLIB=" + (withZlib? "1" : "0")); 216*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_LZMA=" + (withLzma? "1" : "0")); 217*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_DEBUG=" + (withDebug? "1" : "0")); 218*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_SCHEMAS=" + (withSchemas? "1" : "0")); 219*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_SCHEMATRON=" + (withSchematron? "1" : "0")); 220*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_REGEXPS=" + (withRegExps? "1" : "0")); 221*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_MODULES=" + (withModules? "1" : "0")); 222*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_TREE=" + (withTree? "1" : "0")); 223*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_READER=" + (withReader? "1" : "0")); 224*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_WRITER=" + (withWriter? "1" : "0")); 225*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_WALKER=" + (withWalker? "1" : "0")); 226*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_PATTERN=" + (withPattern? "1" : "0")); 227*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_PUSH=" + (withPush? "1" : "0")); 228*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_VALID=" + (withValid? "1" : "0")); 229*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_SAX1=" + (withSax1? "1" : "0")); 230*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_LEGACY=" + (withLegacy? "1" : "0")); 231*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_OUTPUT=" + (withOutput? "1" : "0")); 232*7c568831SAndroid Build Coastguard Worker vf.WriteLine("WITH_PYTHON=" + (withPython? "1" : "0")); 233*7c568831SAndroid Build Coastguard Worker vf.WriteLine("DEBUG=" + (buildDebug? "1" : "0")); 234*7c568831SAndroid Build Coastguard Worker vf.WriteLine("STATIC=" + (buildStatic? "1" : "0")); 235*7c568831SAndroid Build Coastguard Worker vf.WriteLine("PREFIX=" + buildPrefix); 236*7c568831SAndroid Build Coastguard Worker vf.WriteLine("BINPREFIX=" + buildBinPrefix); 237*7c568831SAndroid Build Coastguard Worker vf.WriteLine("INCPREFIX=" + buildIncPrefix); 238*7c568831SAndroid Build Coastguard Worker vf.WriteLine("LIBPREFIX=" + buildLibPrefix); 239*7c568831SAndroid Build Coastguard Worker vf.WriteLine("SOPREFIX=" + buildSoPrefix); 240*7c568831SAndroid Build Coastguard Worker if (compiler == "msvc") { 241*7c568831SAndroid Build Coastguard Worker vf.WriteLine("INCLUDE=$(INCLUDE);" + buildInclude); 242*7c568831SAndroid Build Coastguard Worker vf.WriteLine("LIB=$(LIB);" + buildLib); 243*7c568831SAndroid Build Coastguard Worker vf.WriteLine("CRUNTIME=" + cruntime); 244*7c568831SAndroid Build Coastguard Worker vf.WriteLine("VCMANIFEST=" + (vcmanifest? "1" : "0")); 245*7c568831SAndroid Build Coastguard Worker } else if (compiler == "mingw") { 246*7c568831SAndroid Build Coastguard Worker vf.WriteLine("INCLUDE+= -I" + buildInclude); 247*7c568831SAndroid Build Coastguard Worker vf.WriteLine("LIB+= -L" + buildLib); 248*7c568831SAndroid Build Coastguard Worker } else if (compiler == "bcb") { 249*7c568831SAndroid Build Coastguard Worker vf.WriteLine("INCLUDE=" + buildInclude); 250*7c568831SAndroid Build Coastguard Worker vf.WriteLine("LIB=" + buildLib); 251*7c568831SAndroid Build Coastguard Worker vf.WriteLine("DYNRUNTIME=" + (dynruntime? "1" : "0")); 252*7c568831SAndroid Build Coastguard Worker } 253*7c568831SAndroid Build Coastguard Worker vf.Close(); 254*7c568831SAndroid Build Coastguard Worker versionFile = "rcVersion.h"; 255*7c568831SAndroid Build Coastguard Worker vf = fso.CreateTextFile(versionFile, true); 256*7c568831SAndroid Build Coastguard Worker vf.WriteLine("/*"); 257*7c568831SAndroid Build Coastguard Worker vf.WriteLine(" " + versionFile); 258*7c568831SAndroid Build Coastguard Worker vf.WriteLine(" This file is generated automatically by " + WScript.ScriptName + "."); 259*7c568831SAndroid Build Coastguard Worker vf.WriteLine("*/"); 260*7c568831SAndroid Build Coastguard Worker vf.WriteBlankLines(1); 261*7c568831SAndroid Build Coastguard Worker vf.WriteLine("#define LIBXML_MAJOR_VERSION " + verMajor); 262*7c568831SAndroid Build Coastguard Worker vf.WriteLine("#define LIBXML_MINOR_VERSION " + verMinor); 263*7c568831SAndroid Build Coastguard Worker vf.WriteLine("#define LIBXML_MICRO_VERSION " + verMicro); 264*7c568831SAndroid Build Coastguard Worker vf.WriteLine("#define LIBXML_DOTTED_VERSION " + "\"" + verMajor + "." + verMinor + "." + verMicro + "\""); 265*7c568831SAndroid Build Coastguard Worker vf.Close(); 266*7c568831SAndroid Build Coastguard Worker} 267*7c568831SAndroid Build Coastguard Worker 268*7c568831SAndroid Build Coastguard Worker/* Configures libxml. This one will generate xmlversion.h from xmlversion.h.in 269*7c568831SAndroid Build Coastguard Worker taking what the user passed on the command line into account. */ 270*7c568831SAndroid Build Coastguard Workerfunction configureLibxml() 271*7c568831SAndroid Build Coastguard Worker{ 272*7c568831SAndroid Build Coastguard Worker var fso, ofi, of, ln, s; 273*7c568831SAndroid Build Coastguard Worker fso = new ActiveXObject("Scripting.FileSystemObject"); 274*7c568831SAndroid Build Coastguard Worker ofi = fso.OpenTextFile(optsFileIn, 1); 275*7c568831SAndroid Build Coastguard Worker of = fso.CreateTextFile(optsFile, true); 276*7c568831SAndroid Build Coastguard Worker while (ofi.AtEndOfStream != true) { 277*7c568831SAndroid Build Coastguard Worker ln = ofi.ReadLine(); 278*7c568831SAndroid Build Coastguard Worker s = new String(ln); 279*7c568831SAndroid Build Coastguard Worker if (s.search(/\@VERSION\@/) != -1) { 280*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@VERSION\@/, 281*7c568831SAndroid Build Coastguard Worker verMajor + "." + verMinor + "." + verMicro + verMicroSuffix)); 282*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@LIBXML_VERSION_NUMBER\@/) != -1) { 283*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@LIBXML_VERSION_NUMBER\@/, 284*7c568831SAndroid Build Coastguard Worker verMajor*10000 + verMinor*100 + verMicro*1)); 285*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@LIBXML_VERSION_EXTRA\@/) != -1) { 286*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@LIBXML_VERSION_EXTRA\@/, verCvs)); 287*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_THREADS\@/) != -1) { 288*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_THREADS\@/, withThreads == "no"? "0" : "1")); 289*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_THREAD_ALLOC\@/) != -1) { 290*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_THREAD_ALLOC\@/, "0")); 291*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_HTTP\@/) != -1) { 292*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_HTTP\@/, withHttp? "1" : "0")); 293*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_HTML\@/) != -1) { 294*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_HTML\@/, withHtml? "1" : "0")); 295*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_C14N\@/) != -1) { 296*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_C14N\@/, withC14n? "1" : "0")); 297*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_CATALOG\@/) != -1) { 298*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_CATALOG\@/, withCatalog? "1" : "0")); 299*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_XPATH\@/) != -1) { 300*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_XPATH\@/, withXpath? "1" : "0")); 301*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_XPTR\@/) != -1) { 302*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_XPTR\@/, withXptr? "1" : "0")); 303*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_XINCLUDE\@/) != -1) { 304*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_XINCLUDE\@/, withXinclude? "1" : "0")); 305*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_ICONV\@/) != -1) { 306*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_ICONV\@/, withIconv? "1" : "0")); 307*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_ICU\@/) != -1) { 308*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_ICU\@/, withIcu? "1" : "0")); 309*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_ISO8859X\@/) != -1) { 310*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_ISO8859X\@/, withIso8859x? "1" : "0")); 311*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_ZLIB\@/) != -1) { 312*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_ZLIB\@/, withZlib? "1" : "0")); 313*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_LZMA\@/) != -1) { 314*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_LZMA\@/, withLzma? "1" : "0")); 315*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_DEBUG\@/) != -1) { 316*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_DEBUG\@/, withDebug? "1" : "0")); 317*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_SCHEMAS\@/) != -1) { 318*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_SCHEMAS\@/, withSchemas? "1" : "0")); 319*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_SCHEMATRON\@/) != -1) { 320*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_SCHEMATRON\@/, withSchematron? "1" : "0")); 321*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_REGEXPS\@/) != -1) { 322*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_REGEXPS\@/, withRegExps? "1" : "0")); 323*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_MODULES\@/) != -1) { 324*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_MODULES\@/, withModules? "1" : "0")); 325*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@MODULE_EXTENSION\@/) != -1) { 326*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@MODULE_EXTENSION\@/, ".dll")); 327*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_TREE\@/) != -1) { 328*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_TREE\@/, withTree? "1" : "0")); 329*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_READER\@/) != -1) { 330*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_READER\@/, withReader? "1" : "0")); 331*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_WRITER\@/) != -1) { 332*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_WRITER\@/, withWriter? "1" : "0")); 333*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_WALKER\@/) != -1) { 334*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_WALKER\@/, withWalker? "1" : "0")); 335*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_PATTERN\@/) != -1) { 336*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_PATTERN\@/, withPattern? "1" : "0")); 337*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_PUSH\@/) != -1) { 338*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_PUSH\@/, withPush? "1" : "0")); 339*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_VALID\@/) != -1) { 340*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_VALID\@/, withValid? "1" : "0")); 341*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_SAX1\@/) != -1) { 342*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_SAX1\@/, withSax1? "1" : "0")); 343*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_LEGACY\@/) != -1) { 344*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_LEGACY\@/, withLegacy? "1" : "0")); 345*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_OUTPUT\@/) != -1) { 346*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_OUTPUT\@/, withOutput? "1" : "0")); 347*7c568831SAndroid Build Coastguard Worker } else 348*7c568831SAndroid Build Coastguard Worker of.WriteLine(ln); 349*7c568831SAndroid Build Coastguard Worker } 350*7c568831SAndroid Build Coastguard Worker ofi.Close(); 351*7c568831SAndroid Build Coastguard Worker of.Close(); 352*7c568831SAndroid Build Coastguard Worker} 353*7c568831SAndroid Build Coastguard Worker/* Configures Python bindings. Otherwise identical to the above */ 354*7c568831SAndroid Build Coastguard Workerfunction configureLibxmlPy() 355*7c568831SAndroid Build Coastguard Worker{ 356*7c568831SAndroid Build Coastguard Worker var pyOptsFileIn = srcDirXml + "\\python\\setup.py.in"; 357*7c568831SAndroid Build Coastguard Worker var pyOptsFile = srcDirXml + "\\python\\setup.py"; 358*7c568831SAndroid Build Coastguard Worker var fso, ofi, of, ln, s; 359*7c568831SAndroid Build Coastguard Worker fso = new ActiveXObject("Scripting.FileSystemObject"); 360*7c568831SAndroid Build Coastguard Worker ofi = fso.OpenTextFile(pyOptsFileIn, 1); 361*7c568831SAndroid Build Coastguard Worker of = fso.CreateTextFile(pyOptsFile, true); 362*7c568831SAndroid Build Coastguard Worker while (ofi.AtEndOfStream != true) { 363*7c568831SAndroid Build Coastguard Worker ln = ofi.ReadLine(); 364*7c568831SAndroid Build Coastguard Worker s = new String(ln); 365*7c568831SAndroid Build Coastguard Worker if (s.search(/\@LIBXML_VERSION\@/) != -1) { 366*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@LIBXML_VERSION\@/, 367*7c568831SAndroid Build Coastguard Worker verMajor + "." + verMinor + "." + verMicro)); 368*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@prefix\@/) != -1) { 369*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@prefix\@/, buildPrefix)); 370*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_THREADS\@/) != -1) { 371*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_THREADS\@/, withThreads == "no"? "0" : "1")); 372*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_ZLIB\@/) != -1) { 373*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_ZLIB\@/, withZlib? "1" : "0")); 374*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_LZMA\@/) != -1) { 375*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_LZMA\@/, withLzma? "1" : "0")); 376*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_ICONV\@/) != -1) { 377*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_ICONV\@/, withIconv? "1" : "0")); 378*7c568831SAndroid Build Coastguard Worker } else if (s.search(/\@WITH_ICU\@/) != -1) { 379*7c568831SAndroid Build Coastguard Worker of.WriteLine(s.replace(/\@WITH_ICU\@/, withIcu? "1" : "0")); 380*7c568831SAndroid Build Coastguard Worker } else 381*7c568831SAndroid Build Coastguard Worker of.WriteLine(ln); 382*7c568831SAndroid Build Coastguard Worker } 383*7c568831SAndroid Build Coastguard Worker ofi.Close(); 384*7c568831SAndroid Build Coastguard Worker of.Close(); 385*7c568831SAndroid Build Coastguard Worker} 386*7c568831SAndroid Build Coastguard Worker 387*7c568831SAndroid Build Coastguard Worker/* Creates the readme file for the binary distribution of 'bname', for the 388*7c568831SAndroid Build Coastguard Worker version 'ver' in the file 'file'. This one is called from the Makefile when 389*7c568831SAndroid Build Coastguard Worker generating a binary distribution. The parameters are passed by make. */ 390*7c568831SAndroid Build Coastguard Workerfunction genReadme(bname, ver, file) 391*7c568831SAndroid Build Coastguard Worker{ 392*7c568831SAndroid Build Coastguard Worker var fso, f; 393*7c568831SAndroid Build Coastguard Worker fso = new ActiveXObject("Scripting.FileSystemObject"); 394*7c568831SAndroid Build Coastguard Worker f = fso.CreateTextFile(file, true); 395*7c568831SAndroid Build Coastguard Worker f.WriteLine(" " + bname + " " + ver); 396*7c568831SAndroid Build Coastguard Worker f.WriteLine(" --------------"); 397*7c568831SAndroid Build Coastguard Worker f.WriteBlankLines(1); 398*7c568831SAndroid Build Coastguard Worker f.WriteLine(" This is " + bname + ", version " + ver + ", binary package for the native Win32/IA32"); 399*7c568831SAndroid Build Coastguard Worker f.WriteLine("platform."); 400*7c568831SAndroid Build Coastguard Worker f.WriteBlankLines(1); 401*7c568831SAndroid Build Coastguard Worker f.WriteLine(" The files in this package do not require any special installation"); 402*7c568831SAndroid Build Coastguard Worker f.WriteLine("steps. Extract the contents of the archive wherever you wish and"); 403*7c568831SAndroid Build Coastguard Worker f.WriteLine("make sure that your tools which use " + bname + " can find it."); 404*7c568831SAndroid Build Coastguard Worker f.WriteBlankLines(1); 405*7c568831SAndroid Build Coastguard Worker f.WriteLine(" For example, if you want to run the supplied utilities from the command"); 406*7c568831SAndroid Build Coastguard Worker f.WriteLine("line, you can, if you wish, add the 'bin' subdirectory to the PATH"); 407*7c568831SAndroid Build Coastguard Worker f.WriteLine("environment variable."); 408*7c568831SAndroid Build Coastguard Worker f.WriteLine(" If you want to make programmes in C which use " + bname + ", you'll"); 409*7c568831SAndroid Build Coastguard Worker f.WriteLine("likely know how to use the contents of this package. If you don't, please"); 410*7c568831SAndroid Build Coastguard Worker f.WriteLine("refer to your compiler's documentation."); 411*7c568831SAndroid Build Coastguard Worker f.WriteBlankLines(1); 412*7c568831SAndroid Build Coastguard Worker f.WriteLine(" If there is something you cannot keep for yourself, such as a problem,"); 413*7c568831SAndroid Build Coastguard Worker f.WriteLine("a cheer of joy, a comment or a suggestion, feel free to contact me using"); 414*7c568831SAndroid Build Coastguard Worker f.WriteLine("the address below."); 415*7c568831SAndroid Build Coastguard Worker f.WriteBlankLines(1); 416*7c568831SAndroid Build Coastguard Worker f.WriteLine(" Igor Zlatkovic ([email protected])"); 417*7c568831SAndroid Build Coastguard Worker f.Close(); 418*7c568831SAndroid Build Coastguard Worker} 419*7c568831SAndroid Build Coastguard Worker 420*7c568831SAndroid Build Coastguard Worker 421*7c568831SAndroid Build Coastguard Worker/* 422*7c568831SAndroid Build Coastguard Worker * main(), 423*7c568831SAndroid Build Coastguard Worker * Execution begins here. 424*7c568831SAndroid Build Coastguard Worker */ 425*7c568831SAndroid Build Coastguard Worker 426*7c568831SAndroid Build Coastguard Worker// Parse the command-line arguments. 427*7c568831SAndroid Build Coastguard Workerfor (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) { 428*7c568831SAndroid Build Coastguard Worker var arg, opt; 429*7c568831SAndroid Build Coastguard Worker arg = WScript.Arguments(i); 430*7c568831SAndroid Build Coastguard Worker opt = arg.substring(0, arg.indexOf("=")); 431*7c568831SAndroid Build Coastguard Worker if (opt.length == 0) 432*7c568831SAndroid Build Coastguard Worker opt = arg.substring(0, arg.indexOf(":")); 433*7c568831SAndroid Build Coastguard Worker if (opt.length > 0) { 434*7c568831SAndroid Build Coastguard Worker if (opt == "threads") 435*7c568831SAndroid Build Coastguard Worker withThreads = arg.substring(opt.length + 1, arg.length); 436*7c568831SAndroid Build Coastguard Worker else if (opt == "http") 437*7c568831SAndroid Build Coastguard Worker withHttp = strToBool(arg.substring(opt.length + 1, arg.length)); 438*7c568831SAndroid Build Coastguard Worker else if (opt == "html") 439*7c568831SAndroid Build Coastguard Worker withHtml = strToBool(arg.substring(opt.length + 1, arg.length)); 440*7c568831SAndroid Build Coastguard Worker else if (opt == "c14n") 441*7c568831SAndroid Build Coastguard Worker withC14n = strToBool(arg.substring(opt.length + 1, arg.length)); 442*7c568831SAndroid Build Coastguard Worker else if (opt == "catalog") 443*7c568831SAndroid Build Coastguard Worker withCatalog = strToBool(arg.substring(opt.length + 1, arg.length)); 444*7c568831SAndroid Build Coastguard Worker else if (opt == "xpath") 445*7c568831SAndroid Build Coastguard Worker withXpath = strToBool(arg.substring(opt.length + 1, arg.length)); 446*7c568831SAndroid Build Coastguard Worker else if (opt == "xptr") 447*7c568831SAndroid Build Coastguard Worker withXptr = strToBool(arg.substring(opt.length + 1, arg.length)); 448*7c568831SAndroid Build Coastguard Worker else if (opt == "xinclude") 449*7c568831SAndroid Build Coastguard Worker withXinclude = strToBool(arg.substring(opt.length + 1, arg.length)); 450*7c568831SAndroid Build Coastguard Worker else if (opt == "iconv") 451*7c568831SAndroid Build Coastguard Worker withIconv = strToBool(arg.substring(opt.length + 1, arg.length)); 452*7c568831SAndroid Build Coastguard Worker else if (opt == "icu") 453*7c568831SAndroid Build Coastguard Worker withIcu = strToBool(arg.substring(opt.length + 1, arg.length)); 454*7c568831SAndroid Build Coastguard Worker else if (opt == "iso8859x") 455*7c568831SAndroid Build Coastguard Worker withIso8859x = strToBool(arg.substring(opt.length + 1, arg.length)); 456*7c568831SAndroid Build Coastguard Worker else if (opt == "zlib") 457*7c568831SAndroid Build Coastguard Worker withZlib = strToBool(arg.substring(opt.length + 1, arg.length)); 458*7c568831SAndroid Build Coastguard Worker else if (opt == "lzma") 459*7c568831SAndroid Build Coastguard Worker withLzma = strToBool(arg.substring(opt.length + 1, arg.length)); 460*7c568831SAndroid Build Coastguard Worker else if (opt == "xml_debug") 461*7c568831SAndroid Build Coastguard Worker withDebug = strToBool(arg.substring(opt.length + 1, arg.length)); 462*7c568831SAndroid Build Coastguard Worker else if (opt == "schemas") 463*7c568831SAndroid Build Coastguard Worker withSchemas = strToBool(arg.substring(opt.length + 1, arg.length)); 464*7c568831SAndroid Build Coastguard Worker else if (opt == "schematron") 465*7c568831SAndroid Build Coastguard Worker withSchematron = strToBool(arg.substring(opt.length + 1, arg.length)); 466*7c568831SAndroid Build Coastguard Worker else if (opt == "regexps") 467*7c568831SAndroid Build Coastguard Worker withRegExps = strToBool(arg.substring(opt.length + 1, arg.length)); 468*7c568831SAndroid Build Coastguard Worker else if (opt == "modules") 469*7c568831SAndroid Build Coastguard Worker withModules = strToBool(arg.substring(opt.length + 1, arg.length)); 470*7c568831SAndroid Build Coastguard Worker else if (opt == "tree") 471*7c568831SAndroid Build Coastguard Worker withTree = strToBool(arg.substring(opt.length + 1, arg.length)); 472*7c568831SAndroid Build Coastguard Worker else if (opt == "reader") 473*7c568831SAndroid Build Coastguard Worker withReader = strToBool(arg.substring(opt.length + 1, arg.length)); 474*7c568831SAndroid Build Coastguard Worker else if (opt == "writer") 475*7c568831SAndroid Build Coastguard Worker withWriter = strToBool(arg.substring(opt.length + 1, arg.length)); 476*7c568831SAndroid Build Coastguard Worker else if (opt == "walker") 477*7c568831SAndroid Build Coastguard Worker withWalker = strToBool(arg.substring(opt.length + 1, arg.length)); 478*7c568831SAndroid Build Coastguard Worker else if (opt == "pattern") 479*7c568831SAndroid Build Coastguard Worker withPattern = strToBool(arg.substring(opt.length + 1, arg.length)); 480*7c568831SAndroid Build Coastguard Worker else if (opt == "push") 481*7c568831SAndroid Build Coastguard Worker withPush = strToBool(arg.substring(opt.length + 1, arg.length)); 482*7c568831SAndroid Build Coastguard Worker else if (opt == "valid") 483*7c568831SAndroid Build Coastguard Worker withValid = strToBool(arg.substring(opt.length + 1, arg.length)); 484*7c568831SAndroid Build Coastguard Worker else if (opt == "sax1") 485*7c568831SAndroid Build Coastguard Worker withSax1 = strToBool(arg.substring(opt.length + 1, arg.length)); 486*7c568831SAndroid Build Coastguard Worker else if (opt == "legacy") 487*7c568831SAndroid Build Coastguard Worker withLegacy = strToBool(arg.substring(opt.length + 1, arg.length)); 488*7c568831SAndroid Build Coastguard Worker else if (opt == "output") 489*7c568831SAndroid Build Coastguard Worker withOutput = strToBool(arg.substring(opt.length + 1, arg.length)); 490*7c568831SAndroid Build Coastguard Worker else if (opt == "python") 491*7c568831SAndroid Build Coastguard Worker withPython = strToBool(arg.substring(opt.length + 1, arg.length)); 492*7c568831SAndroid Build Coastguard Worker else if (opt == "compiler") 493*7c568831SAndroid Build Coastguard Worker compiler = arg.substring(opt.length + 1, arg.length); 494*7c568831SAndroid Build Coastguard Worker else if (opt == "cruntime") 495*7c568831SAndroid Build Coastguard Worker cruntime = arg.substring(opt.length + 1, arg.length); 496*7c568831SAndroid Build Coastguard Worker else if (opt == "dynruntime") 497*7c568831SAndroid Build Coastguard Worker dynruntime = strToBool(arg.substring(opt.length + 1, arg.length)); 498*7c568831SAndroid Build Coastguard Worker else if (opt == "vcmanifest") 499*7c568831SAndroid Build Coastguard Worker vcmanifest = strToBool(arg.substring(opt.length + 1, arg.length)); 500*7c568831SAndroid Build Coastguard Worker else if (opt == "debug") 501*7c568831SAndroid Build Coastguard Worker buildDebug = strToBool(arg.substring(opt.length + 1, arg.length)); 502*7c568831SAndroid Build Coastguard Worker else if (opt == "static") 503*7c568831SAndroid Build Coastguard Worker buildStatic = strToBool(arg.substring(opt.length + 1, arg.length)); 504*7c568831SAndroid Build Coastguard Worker else if (opt == "prefix") 505*7c568831SAndroid Build Coastguard Worker buildPrefix = arg.substring(opt.length + 1, arg.length); 506*7c568831SAndroid Build Coastguard Worker else if (opt == "bindir") 507*7c568831SAndroid Build Coastguard Worker buildBinPrefix = arg.substring(opt.length + 1, arg.length); 508*7c568831SAndroid Build Coastguard Worker else if (opt == "libdir") 509*7c568831SAndroid Build Coastguard Worker buildLibPrefix = arg.substring(opt.length + 1, arg.length); 510*7c568831SAndroid Build Coastguard Worker else if (opt == "sodir") 511*7c568831SAndroid Build Coastguard Worker buildSoPrefix = arg.substring(opt.length + 1, arg.length); 512*7c568831SAndroid Build Coastguard Worker else if (opt == "incdir") 513*7c568831SAndroid Build Coastguard Worker buildIncPrefix = arg.substring(opt.length + 1, arg.length); 514*7c568831SAndroid Build Coastguard Worker else if (opt == "include") 515*7c568831SAndroid Build Coastguard Worker buildInclude = arg.substring(opt.length + 1, arg.length); 516*7c568831SAndroid Build Coastguard Worker else if (opt == "lib") 517*7c568831SAndroid Build Coastguard Worker buildLib = arg.substring(opt.length + 1, arg.length); 518*7c568831SAndroid Build Coastguard Worker else if (opt == "release") 519*7c568831SAndroid Build Coastguard Worker useCvsVer = false; 520*7c568831SAndroid Build Coastguard Worker else 521*7c568831SAndroid Build Coastguard Worker error = 1; 522*7c568831SAndroid Build Coastguard Worker } else if (i == 0) { 523*7c568831SAndroid Build Coastguard Worker if (arg == "genreadme") { 524*7c568831SAndroid Build Coastguard Worker // This command comes from the Makefile and will not be checked 525*7c568831SAndroid Build Coastguard Worker // for errors, because Makefile will always supply right the parameters. 526*7c568831SAndroid Build Coastguard Worker genReadme(WScript.Arguments(1), WScript.Arguments(2), WScript.Arguments(3)); 527*7c568831SAndroid Build Coastguard Worker WScript.Quit(0); 528*7c568831SAndroid Build Coastguard Worker } else if (arg == "help") { 529*7c568831SAndroid Build Coastguard Worker usage(); 530*7c568831SAndroid Build Coastguard Worker WScript.Quit(0); 531*7c568831SAndroid Build Coastguard Worker } 532*7c568831SAndroid Build Coastguard Worker 533*7c568831SAndroid Build Coastguard Worker } else { 534*7c568831SAndroid Build Coastguard Worker error = 1; 535*7c568831SAndroid Build Coastguard Worker } 536*7c568831SAndroid Build Coastguard Worker} 537*7c568831SAndroid Build Coastguard Worker 538*7c568831SAndroid Build Coastguard Worker 539*7c568831SAndroid Build Coastguard Worker// If we fail here, it is because the user supplied an unrecognised argument. 540*7c568831SAndroid Build Coastguard Workerif (error != 0) { 541*7c568831SAndroid Build Coastguard Worker usage(); 542*7c568831SAndroid Build Coastguard Worker WScript.Quit(error); 543*7c568831SAndroid Build Coastguard Worker} 544*7c568831SAndroid Build Coastguard Worker 545*7c568831SAndroid Build Coastguard Worker// if user choses to link the c-runtime library statically into libxml2 546*7c568831SAndroid Build Coastguard Worker// with /MT and friends, then we need to enable static linking for xmllint 547*7c568831SAndroid Build Coastguard Workerif (cruntime == "/MT" || cruntime == "/MTd" || 548*7c568831SAndroid Build Coastguard Worker cruntime == "/ML" || cruntime == "/MLd") { 549*7c568831SAndroid Build Coastguard Worker buildStatic = 1; 550*7c568831SAndroid Build Coastguard Worker} 551*7c568831SAndroid Build Coastguard Worker 552*7c568831SAndroid Build Coastguard WorkerdirSep = "\\"; 553*7c568831SAndroid Build Coastguard Workerif (buildBinPrefix == "") 554*7c568831SAndroid Build Coastguard Worker buildBinPrefix = "$(PREFIX)" + dirSep + "bin"; 555*7c568831SAndroid Build Coastguard Workerif (buildIncPrefix == "") 556*7c568831SAndroid Build Coastguard Worker buildIncPrefix = "$(PREFIX)" + dirSep + "include"; 557*7c568831SAndroid Build Coastguard Workerif (buildLibPrefix == "") 558*7c568831SAndroid Build Coastguard Worker buildLibPrefix = "$(PREFIX)" + dirSep + "lib"; 559*7c568831SAndroid Build Coastguard Workerif (buildSoPrefix == "") 560*7c568831SAndroid Build Coastguard Worker buildSoPrefix = "$(PREFIX)" + dirSep + "bin"; 561*7c568831SAndroid Build Coastguard Worker 562*7c568831SAndroid Build Coastguard Worker// Discover the version. 563*7c568831SAndroid Build Coastguard WorkerdiscoverVersion(); 564*7c568831SAndroid Build Coastguard Workerif (error != 0) { 565*7c568831SAndroid Build Coastguard Worker WScript.Echo("Version discovery failed, aborting."); 566*7c568831SAndroid Build Coastguard Worker WScript.Quit(error); 567*7c568831SAndroid Build Coastguard Worker} 568*7c568831SAndroid Build Coastguard Worker 569*7c568831SAndroid Build Coastguard Workervar outVerString = baseName + " version: " + verMajor + "." + verMinor + "." + verMicro; 570*7c568831SAndroid Build Coastguard Workerif (verMicroSuffix && verMicroSuffix != "") 571*7c568831SAndroid Build Coastguard Worker outVerString += "-" + verMicroSuffix; 572*7c568831SAndroid Build Coastguard Workerif (verCvs && verCvs != "") 573*7c568831SAndroid Build Coastguard Worker outVerString += "-" + verCvs; 574*7c568831SAndroid Build Coastguard WorkerWScript.Echo(outVerString); 575*7c568831SAndroid Build Coastguard Worker 576*7c568831SAndroid Build Coastguard Worker// Configure libxml. 577*7c568831SAndroid Build Coastguard WorkerconfigureLibxml(); 578*7c568831SAndroid Build Coastguard Workerif (error != 0) { 579*7c568831SAndroid Build Coastguard Worker WScript.Echo("Configuration failed, aborting."); 580*7c568831SAndroid Build Coastguard Worker WScript.Quit(error); 581*7c568831SAndroid Build Coastguard Worker} 582*7c568831SAndroid Build Coastguard Worker 583*7c568831SAndroid Build Coastguard Workerif (withPython == true) { 584*7c568831SAndroid Build Coastguard Worker configureLibxmlPy(); 585*7c568831SAndroid Build Coastguard Worker if (error != 0) { 586*7c568831SAndroid Build Coastguard Worker WScript.Echo("Configuration failed, aborting."); 587*7c568831SAndroid Build Coastguard Worker WScript.Quit(error); 588*7c568831SAndroid Build Coastguard Worker } 589*7c568831SAndroid Build Coastguard Worker 590*7c568831SAndroid Build Coastguard Worker} 591*7c568831SAndroid Build Coastguard Worker 592*7c568831SAndroid Build Coastguard Worker// Create the makefile. 593*7c568831SAndroid Build Coastguard Workervar fso = new ActiveXObject("Scripting.FileSystemObject"); 594*7c568831SAndroid Build Coastguard Workervar makefile = ".\\Makefile.msvc"; 595*7c568831SAndroid Build Coastguard Workerif (compiler == "mingw") 596*7c568831SAndroid Build Coastguard Worker makefile = ".\\Makefile.mingw"; 597*7c568831SAndroid Build Coastguard Workerelse if (compiler == "bcb") 598*7c568831SAndroid Build Coastguard Worker makefile = ".\\Makefile.bcb"; 599*7c568831SAndroid Build Coastguard Workervar new_makefile = ".\\Makefile"; 600*7c568831SAndroid Build Coastguard Workervar f = fso.FileExists(new_makefile); 601*7c568831SAndroid Build Coastguard Workerif (f) { 602*7c568831SAndroid Build Coastguard Worker var t = fso.GetFile(new_makefile); 603*7c568831SAndroid Build Coastguard Worker t.Attributes =0; 604*7c568831SAndroid Build Coastguard Worker} 605*7c568831SAndroid Build Coastguard Workerfso.CopyFile(makefile, new_makefile, true); 606*7c568831SAndroid Build Coastguard WorkerWScript.Echo("Created Makefile."); 607*7c568831SAndroid Build Coastguard Worker// Create the config.h. 608*7c568831SAndroid Build Coastguard Workervar confighsrc = "win32config.h"; 609*7c568831SAndroid Build Coastguard Workervar configh = "..\\config.h"; 610*7c568831SAndroid Build Coastguard Workervar f = fso.FileExists(configh); 611*7c568831SAndroid Build Coastguard Workerif (f) { 612*7c568831SAndroid Build Coastguard Worker var t = fso.GetFile(configh); 613*7c568831SAndroid Build Coastguard Worker t.Attributes =0; 614*7c568831SAndroid Build Coastguard Worker} 615*7c568831SAndroid Build Coastguard Workerfso.CopyFile(confighsrc, configh, true); 616*7c568831SAndroid Build Coastguard WorkerWScript.Echo("Created config.h."); 617*7c568831SAndroid Build Coastguard Worker 618*7c568831SAndroid Build Coastguard Worker 619*7c568831SAndroid Build Coastguard Worker// Display the final configuration. 620*7c568831SAndroid Build Coastguard Workervar txtOut = "\nXML processor configuration\n"; 621*7c568831SAndroid Build Coastguard WorkertxtOut += "---------------------------\n"; 622*7c568831SAndroid Build Coastguard WorkertxtOut += " Thread safety: " + withThreads + "\n"; 623*7c568831SAndroid Build Coastguard WorkertxtOut += " HTTP client: " + boolToStr(withHttp) + "\n"; 624*7c568831SAndroid Build Coastguard WorkertxtOut += " HTML processor: " + boolToStr(withHtml) + "\n"; 625*7c568831SAndroid Build Coastguard WorkertxtOut += " C14N support: " + boolToStr(withC14n) + "\n"; 626*7c568831SAndroid Build Coastguard WorkertxtOut += " Catalog support: " + boolToStr(withCatalog) + "\n"; 627*7c568831SAndroid Build Coastguard WorkertxtOut += " XPath support: " + boolToStr(withXpath) + "\n"; 628*7c568831SAndroid Build Coastguard WorkertxtOut += " XPointer support: " + boolToStr(withXptr) + "\n"; 629*7c568831SAndroid Build Coastguard WorkertxtOut += " XInclude support: " + boolToStr(withXinclude) + "\n"; 630*7c568831SAndroid Build Coastguard WorkertxtOut += " iconv support: " + boolToStr(withIconv) + "\n"; 631*7c568831SAndroid Build Coastguard WorkertxtOut += " icu support: " + boolToStr(withIcu) + "\n"; 632*7c568831SAndroid Build Coastguard WorkertxtOut += " iso8859x support: " + boolToStr(withIso8859x) + "\n"; 633*7c568831SAndroid Build Coastguard WorkertxtOut += " zlib support: " + boolToStr(withZlib) + "\n"; 634*7c568831SAndroid Build Coastguard WorkertxtOut += " lzma support: " + boolToStr(withLzma) + "\n"; 635*7c568831SAndroid Build Coastguard WorkertxtOut += " Debugging module: " + boolToStr(withDebug) + "\n"; 636*7c568831SAndroid Build Coastguard WorkertxtOut += " Regexp support: " + boolToStr(withRegExps) + "\n"; 637*7c568831SAndroid Build Coastguard WorkertxtOut += " Module support: " + boolToStr(withModules) + "\n"; 638*7c568831SAndroid Build Coastguard WorkertxtOut += " Tree support: " + boolToStr(withTree) + "\n"; 639*7c568831SAndroid Build Coastguard WorkertxtOut += " Reader support: " + boolToStr(withReader) + "\n"; 640*7c568831SAndroid Build Coastguard WorkertxtOut += " Writer support: " + boolToStr(withWriter) + "\n"; 641*7c568831SAndroid Build Coastguard WorkertxtOut += " Walker support: " + boolToStr(withWalker) + "\n"; 642*7c568831SAndroid Build Coastguard WorkertxtOut += " Pattern support: " + boolToStr(withPattern) + "\n"; 643*7c568831SAndroid Build Coastguard WorkertxtOut += " Push support: " + boolToStr(withPush) + "\n"; 644*7c568831SAndroid Build Coastguard WorkertxtOut += "Validation support: " + boolToStr(withValid) + "\n"; 645*7c568831SAndroid Build Coastguard WorkertxtOut += " SAX1 support: " + boolToStr(withSax1) + "\n"; 646*7c568831SAndroid Build Coastguard WorkertxtOut += " Legacy support: " + boolToStr(withLegacy) + "\n"; 647*7c568831SAndroid Build Coastguard WorkertxtOut += " Output support: " + boolToStr(withOutput) + "\n"; 648*7c568831SAndroid Build Coastguard WorkertxtOut += "XML Schema support: " + boolToStr(withSchemas) + "\n"; 649*7c568831SAndroid Build Coastguard WorkertxtOut += "Schematron support: " + boolToStr(withSchematron) + "\n"; 650*7c568831SAndroid Build Coastguard WorkertxtOut += " Python bindings: " + boolToStr(withPython) + "\n"; 651*7c568831SAndroid Build Coastguard WorkertxtOut += "\n"; 652*7c568831SAndroid Build Coastguard WorkertxtOut += "Win32 build configuration\n"; 653*7c568831SAndroid Build Coastguard WorkertxtOut += "-------------------------\n"; 654*7c568831SAndroid Build Coastguard WorkertxtOut += " Compiler: " + compiler + "\n"; 655*7c568831SAndroid Build Coastguard Workerif (compiler == "msvc") { 656*7c568831SAndroid Build Coastguard Worker txtOut += " C-Runtime option: " + cruntime + "\n"; 657*7c568831SAndroid Build Coastguard Worker txtOut += " Embed Manifest: " + boolToStr(vcmanifest) + "\n"; 658*7c568831SAndroid Build Coastguard Worker} else if (compiler == "bcb") 659*7c568831SAndroid Build Coastguard Worker txtOut += " Use dynamic RTL: " + dynruntime + "\n"; 660*7c568831SAndroid Build Coastguard WorkertxtOut += " Debug symbols: " + boolToStr(buildDebug) + "\n"; 661*7c568831SAndroid Build Coastguard WorkertxtOut += " Static xmllint: " + boolToStr(buildStatic) + "\n"; 662*7c568831SAndroid Build Coastguard WorkertxtOut += " Install prefix: " + buildPrefix + "\n"; 663*7c568831SAndroid Build Coastguard WorkertxtOut += " Put tools in: " + buildBinPrefix + "\n"; 664*7c568831SAndroid Build Coastguard WorkertxtOut += " Put headers in: " + buildIncPrefix + "\n"; 665*7c568831SAndroid Build Coastguard WorkertxtOut += "Put static libs in: " + buildLibPrefix + "\n"; 666*7c568831SAndroid Build Coastguard WorkertxtOut += "Put shared libs in: " + buildSoPrefix + "\n"; 667*7c568831SAndroid Build Coastguard WorkertxtOut += " Include path: " + buildInclude + "\n"; 668*7c568831SAndroid Build Coastguard WorkertxtOut += " Lib path: " + buildLib + "\n"; 669*7c568831SAndroid Build Coastguard WorkertxtOut += "\n"; 670*7c568831SAndroid Build Coastguard WorkertxtOut += "DEPRECATION WARNING: The build system in the win32 directory is\n"; 671*7c568831SAndroid Build Coastguard WorkertxtOut += "deprecated and will be removed in a future release. Please switch\n"; 672*7c568831SAndroid Build Coastguard WorkertxtOut += "to CMake.\n"; 673*7c568831SAndroid Build Coastguard WorkerWScript.Echo(txtOut); 674*7c568831SAndroid Build Coastguard Worker 675*7c568831SAndroid Build Coastguard Worker// 676*7c568831SAndroid Build Coastguard Worker 677