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