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