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 | * |
| 7 | * March 2002, Igor Zlatkovic <igor@stud.fh-frankfurt.de> |
| 8 | */ |
| 9 | |
| 10 | /* The source directory, relative to the one where this file resides. */ |
| 11 | var srcDirXml = ".."; |
| 12 | var srcDirUtils = ".."; |
| 13 | /* The directory where we put the binaries after compilation. */ |
| 14 | var binDir = "binaries"; |
| 15 | /* Base name of what we are building. */ |
| 16 | var baseName = "libxml2"; |
| 17 | /* Configure file which contains the version and the output file where |
| 18 | we can store our build configuration. */ |
| 19 | var configFile = srcDirXml + "\\configure.in"; |
Igor Zlatkovic | bd1a306 | 2002-11-14 17:43:24 +0000 | [diff] [blame^] | 20 | var versionFile = ".\\config.msvc"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 21 | /* Input and output files regarding the libxml features. The second |
| 22 | output file is there for the compatibility reasons, otherwise it |
| 23 | is identical to the first. */ |
| 24 | var optsFileIn = srcDirXml + "\\include\\libxml\\xmlversion.h.in"; |
| 25 | var optsFile = srcDirXml + "\\include\\libxml\\xmlversion.h"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 26 | /* Version strings for the binary distribution. Will be filled later |
| 27 | in the code. */ |
| 28 | var verMajor; |
| 29 | var verMinor; |
| 30 | var verMicro; |
| 31 | /* Libxml features. */ |
| 32 | var withTrio = false; |
Igor Zlatkovic | 8f536a8 | 2002-10-31 16:01:00 +0000 | [diff] [blame] | 33 | var withThreads = "no"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 34 | var withFtp = true; |
| 35 | var withHttp = true; |
| 36 | var withHtml = true; |
| 37 | var withC14n = true; |
| 38 | var withCatalog = true; |
| 39 | var withDocb = true; |
| 40 | var withXpath = true; |
| 41 | var withXptr = true; |
| 42 | var withXinclude = true; |
| 43 | var withIconv = true; |
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; |
Igor Zlatkovic | 8e04097 | 2002-09-20 13:39:53 +0000 | [diff] [blame] | 48 | var withRegExps = true; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 49 | /* Win32 build options. */ |
Igor Zlatkovic | bd1a306 | 2002-11-14 17:43:24 +0000 | [diff] [blame^] | 50 | var compiler = "msvc"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 51 | var buildDebug = 0; |
| 52 | var buildStatic = 0; |
| 53 | var buildPrefix = "."; |
| 54 | var buildBinPrefix = "$(PREFIX)\\bin"; |
| 55 | var buildIncPrefix = "$(PREFIX)\\include"; |
| 56 | var buildLibPrefix = "$(PREFIX)\\lib"; |
| 57 | var buildSoPrefix = "$(PREFIX)\\lib"; |
| 58 | var buildInclude = "."; |
| 59 | var buildLib = "."; |
| 60 | /* Local stuff */ |
| 61 | var error = 0; |
| 62 | |
| 63 | /* Helper function, transforms the option variable into the 'Enabled' |
| 64 | or 'Disabled' string. */ |
| 65 | function boolToStr(opt) |
| 66 | { |
| 67 | if (opt == false) |
Igor Zlatkovic | 8f536a8 | 2002-10-31 16:01:00 +0000 | [diff] [blame] | 68 | return "no"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 69 | else if (opt == true) |
Igor Zlatkovic | 8f536a8 | 2002-10-31 16:01:00 +0000 | [diff] [blame] | 70 | return "yes"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 71 | error = 1; |
Igor Zlatkovic | 8f536a8 | 2002-10-31 16:01:00 +0000 | [diff] [blame] | 72 | return "*** undefined ***"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | /* Helper function, transforms the argument string into a boolean |
| 76 | value. */ |
| 77 | function strToBool(opt) |
| 78 | { |
| 79 | if (opt == 0 || opt == "no") |
| 80 | return false; |
| 81 | else if (opt == 1 || opt == "yes") |
| 82 | return true; |
| 83 | error = 1; |
| 84 | return false; |
| 85 | } |
| 86 | |
| 87 | /* Displays the details about how to use this script. */ |
| 88 | function usage() |
| 89 | { |
| 90 | var txt; |
| 91 | txt = "Usage:\n"; |
| 92 | txt += " cscript " + WScript.ScriptName + " <options>\n"; |
| 93 | txt += " cscript " + WScript.ScriptName + " help\n\n"; |
| 94 | 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] | 95 | txt += "either 'yes' or 'no', if not stated otherwise.\n\n"; |
Igor Zlatkovic | bd1a306 | 2002-11-14 17:43:24 +0000 | [diff] [blame^] | 96 | txt += "\nXML processor options, default value given in parentheses:\n\n"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 97 | txt += " trio: Enable TRIO string manipulator (" + (withTrio? "yes" : "no") + ")\n"; |
Igor Zlatkovic | 8f536a8 | 2002-10-31 16:01:00 +0000 | [diff] [blame] | 98 | txt += " threads: Enable thread safety [no|ctls|native|posix] (" + (withThreads) + ") \n"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 99 | txt += " ftp: Enable FTP client (" + (withFtp? "yes" : "no") + ")\n"; |
| 100 | txt += " http: Enable HTTP client (" + (withHttp? "yes" : "no") + ")\n"; |
| 101 | txt += " html: Enable HTML processor (" + (withHtml? "yes" : "no") + ")\n"; |
| 102 | txt += " c14n: Enable C14N support (" + (withC14n? "yes" : "no") + ")\n"; |
| 103 | txt += " catalog: Enable catalog support (" + (withCatalog? "yes" : "no") + ")\n"; |
| 104 | txt += " docb: Enable DocBook support (" + (withDocb? "yes" : "no") + ")\n"; |
| 105 | txt += " xpath: Enable XPath support (" + (withXpath? "yes" : "no") + ")\n"; |
| 106 | txt += " xptr: Enable XPointer support (" + (withXptr? "yes" : "no") + ")\n"; |
| 107 | txt += " xinclude: Enable XInclude support (" + (withXinclude? "yes" : "no") + ")\n"; |
Igor Zlatkovic | 3acadf4 | 2002-09-20 16:40:17 +0000 | [diff] [blame] | 108 | txt += " iconv: Enable iconv support (" + (withIconv? "yes" : "no") + ")\n"; |
| 109 | txt += " zlib: Enable zlib support (" + (withZlib? "yes" : "no") + ")\n"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 110 | txt += " xml_debug: Enable XML debbugging module (" + (withDebug? "yes" : "no") + ")\n"; |
| 111 | txt += " mem_debug: Enable memory debugger (" + (withMemDebug? "yes" : "no") + ")\n"; |
Igor Zlatkovic | 8e04097 | 2002-09-20 13:39:53 +0000 | [diff] [blame] | 112 | txt += " regexps: Enable regular expressions (" + (withRegExps? "yes" : "no") + ")\n"; |
Igor Zlatkovic | a6f2d90 | 2002-04-16 17:57:17 +0000 | [diff] [blame] | 113 | txt += " schemas: Enable XML Schema support (" + (withSchemas? "yes" : "no") + ")\n"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 114 | txt += "\nWin32 build options, default value given in parentheses:\n\n"; |
Igor Zlatkovic | bd1a306 | 2002-11-14 17:43:24 +0000 | [diff] [blame^] | 115 | txt += " compiler: Compiler to be used [msvc|mingw] (" + compiler + ")\n"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 116 | txt += " debug: Build unoptimised debug executables (" + (buildDebug? "yes" : "no") + ")\n"; |
| 117 | txt += " static: Link xmllint statically to libxml2 (" + (buildStatic? "yes" : "no") + ")\n"; |
| 118 | txt += " prefix: Base directory for the installation (" + buildPrefix + ")\n"; |
| 119 | txt += " bindir: Directory where xmllint and friends should be installed\n"; |
| 120 | txt += " (" + buildBinPrefix + ")\n"; |
| 121 | txt += " incdir: Directory where headers should be installed\n"; |
| 122 | txt += " (" + buildIncPrefix + ")\n"; |
| 123 | txt += " libdir: Directory where static and import libraries should be\n"; |
| 124 | txt += " installed (" + buildLibPrefix + ")\n"; |
| 125 | txt += " sodir: Directory where shared libraries should be installed\n"; |
| 126 | txt += " (" + buildSoPrefix + ")\n"; |
| 127 | txt += " include: Additional search path for the compiler, particularily\n"; |
| 128 | txt += " where iconv headers can be found (" + buildInclude + ")\n"; |
| 129 | txt += " lib: Additional search path for the linker, particularily\n"; |
| 130 | txt += " where iconv library can be found (" + buildLib + ")\n"; |
| 131 | WScript.Echo(txt); |
| 132 | } |
| 133 | |
| 134 | /* Discovers the version we are working with by reading the apropriate |
| 135 | configuration file. Despite its name, this also writes the configuration |
| 136 | file included by our makefile. */ |
| 137 | function discoverVersion() |
| 138 | { |
| 139 | var fso, cf, vf, ln, s; |
| 140 | fso = new ActiveXObject("Scripting.FileSystemObject"); |
| 141 | cf = fso.OpenTextFile(configFile, 1); |
Igor Zlatkovic | bd1a306 | 2002-11-14 17:43:24 +0000 | [diff] [blame^] | 142 | if (compiler == "msvc") |
| 143 | versionFile = ".\\config.msvc"; |
| 144 | else if (compiler == "mingw") |
| 145 | versionFile = ".\\config.mingw"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 146 | vf = fso.CreateTextFile(versionFile, true); |
| 147 | vf.WriteLine("# " + versionFile); |
| 148 | vf.WriteLine("# This file is generated automatically by " + WScript.ScriptName + "."); |
| 149 | vf.WriteBlankLines(1); |
| 150 | while (cf.AtEndOfStream != true) { |
| 151 | ln = cf.ReadLine(); |
| 152 | s = new String(ln); |
| 153 | if (s.search(/^LIBXML_MAJOR_VERSION/) != -1) { |
| 154 | vf.WriteLine(s); |
| 155 | verMajor = s.substring(s.indexOf("=") + 1, s.length) |
| 156 | } else if(s.search(/^LIBXML_MINOR_VERSION/) != -1) { |
| 157 | vf.WriteLine(s); |
| 158 | verMinor = s.substring(s.indexOf("=") + 1, s.length) |
| 159 | } else if(s.search(/^LIBXML_MICRO_VERSION/) != -1) { |
| 160 | vf.WriteLine(s); |
| 161 | verMicro = s.substring(s.indexOf("=") + 1, s.length) |
| 162 | } |
| 163 | } |
| 164 | cf.Close(); |
| 165 | vf.WriteLine("XML_SRCDIR=" + srcDirXml); |
| 166 | vf.WriteLine("UTILS_SRCDIR=" + srcDirUtils); |
| 167 | vf.WriteLine("BINDIR=" + binDir); |
| 168 | vf.WriteLine("WITH_TRIO=" + (withTrio? "1" : "0")); |
Igor Zlatkovic | 8f536a8 | 2002-10-31 16:01:00 +0000 | [diff] [blame] | 169 | vf.WriteLine("WITH_THREADS=" + withThreads); |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 170 | vf.WriteLine("WITH_FTP=" + (withFtp? "1" : "0")); |
| 171 | vf.WriteLine("WITH_HTTP=" + (withHttp? "1" : "0")); |
| 172 | vf.WriteLine("WITH_HTML=" + (withHtml? "1" : "0")); |
| 173 | vf.WriteLine("WITH_C14N=" + (withC14n? "1" : "0")); |
| 174 | vf.WriteLine("WITH_CATALOG=" + (withCatalog? "1" : "0")); |
| 175 | vf.WriteLine("WITH_DOCB=" + (withDocb? "1" : "0")); |
| 176 | vf.WriteLine("WITH_XPATH=" + (withXpath? "1" : "0")); |
| 177 | vf.WriteLine("WITH_XPTR=" + (withXptr? "1" : "0")); |
| 178 | vf.WriteLine("WITH_XINCLUDE=" + (withXinclude? "1" : "0")); |
| 179 | vf.WriteLine("WITH_ICONV=" + (withIconv? "1" : "0")); |
Igor Zlatkovic | 3acadf4 | 2002-09-20 16:40:17 +0000 | [diff] [blame] | 180 | vf.WriteLine("WITH_ZLIB=" + (withZlib? "1" : "0")); |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 181 | vf.WriteLine("WITH_DEBUG=" + (withDebug? "1" : "0")); |
| 182 | vf.WriteLine("WITH_MEM_DEBUG=" + (withMemDebug? "1" : "0")); |
Igor Zlatkovic | a6f2d90 | 2002-04-16 17:57:17 +0000 | [diff] [blame] | 183 | vf.WriteLine("WITH_SCHEMAS=" + (withSchemas? "1" : "0")); |
Igor Zlatkovic | 8e04097 | 2002-09-20 13:39:53 +0000 | [diff] [blame] | 184 | vf.WriteLine("WITH_REGEXPS=" + (withRegExps? "1" : "0")); |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 185 | vf.WriteLine("DEBUG=" + (buildDebug? "1" : "0")); |
| 186 | vf.WriteLine("STATIC=" + (buildStatic? "1" : "0")); |
| 187 | vf.WriteLine("PREFIX=" + buildPrefix); |
| 188 | vf.WriteLine("BINPREFIX=" + buildBinPrefix); |
| 189 | vf.WriteLine("INCPREFIX=" + buildIncPrefix); |
| 190 | vf.WriteLine("LIBPREFIX=" + buildLibPrefix); |
| 191 | vf.WriteLine("SOPREFIX=" + buildSoPrefix); |
Igor Zlatkovic | bd1a306 | 2002-11-14 17:43:24 +0000 | [diff] [blame^] | 192 | if (compiler == "msvc") { |
| 193 | vf.WriteLine("INCLUDE=$(INCLUDE);" + buildInclude); |
| 194 | vf.WriteLine("LIB=$(LIB);" + buildLib); |
| 195 | } else if (compiler == "mingw") { |
| 196 | vf.WriteLine("INCLUDE+=;" + buildInclude); |
| 197 | vf.WriteLine("LIB+=;" + buildLib); |
| 198 | } |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 199 | vf.Close(); |
| 200 | } |
| 201 | |
| 202 | /* Configures libxml. This one will generate xmlversion.h from xmlversion.h.in |
| 203 | taking what the user passed on the command line into account. */ |
| 204 | function configureLibxml() |
| 205 | { |
| 206 | var fso, ofi, of, ln, s; |
| 207 | fso = new ActiveXObject("Scripting.FileSystemObject"); |
| 208 | ofi = fso.OpenTextFile(optsFileIn, 1); |
| 209 | of = fso.CreateTextFile(optsFile, true); |
| 210 | while (ofi.AtEndOfStream != true) { |
| 211 | ln = ofi.ReadLine(); |
| 212 | s = new String(ln); |
| 213 | if (s.search(/\@VERSION\@/) != -1) { |
| 214 | of.WriteLine(s.replace(/\@VERSION\@/, |
| 215 | verMajor + "." + verMinor + "." + verMicro)); |
| 216 | } else if (s.search(/\@LIBXML_VERSION_NUMBER\@/) != -1) { |
| 217 | of.WriteLine(s.replace(/\@LIBXML_VERSION_NUMBER\@/, |
| 218 | verMajor*10000 + verMinor*100 + verMicro*1)); |
| 219 | } else if (s.search(/\@WITH_TRIO\@/) != -1) { |
| 220 | of.WriteLine(s.replace(/\@WITH_TRIO\@/, withTrio? "1" : "0")); |
| 221 | } else if (s.search(/\@WITH_THREADS\@/) != -1) { |
Igor Zlatkovic | 8f536a8 | 2002-10-31 16:01:00 +0000 | [diff] [blame] | 222 | of.WriteLine(s.replace(/\@WITH_THREADS\@/, withThreads == "no"? "0" : "1")); |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 223 | } else if (s.search(/\@WITH_FTP\@/) != -1) { |
| 224 | of.WriteLine(s.replace(/\@WITH_FTP\@/, withFtp? "1" : "0")); |
| 225 | } else if (s.search(/\@WITH_HTTP\@/) != -1) { |
| 226 | of.WriteLine(s.replace(/\@WITH_HTTP\@/, withHttp? "1" : "0")); |
| 227 | } else if (s.search(/\@WITH_HTML\@/) != -1) { |
| 228 | of.WriteLine(s.replace(/\@WITH_HTML\@/, withHtml? "1" : "0")); |
| 229 | } else if (s.search(/\@WITH_C14N\@/) != -1) { |
| 230 | of.WriteLine(s.replace(/\@WITH_C14N\@/, withC14n? "1" : "0")); |
| 231 | } else if (s.search(/\@WITH_CATALOG\@/) != -1) { |
| 232 | of.WriteLine(s.replace(/\@WITH_CATALOG\@/, withCatalog? "1" : "0")); |
| 233 | } else if (s.search(/\@WITH_DOCB\@/) != -1) { |
| 234 | of.WriteLine(s.replace(/\@WITH_DOCB\@/, withDocb? "1" : "0")); |
| 235 | } else if (s.search(/\@WITH_XPATH\@/) != -1) { |
| 236 | of.WriteLine(s.replace(/\@WITH_XPATH\@/, withXpath? "1" : "0")); |
| 237 | } else if (s.search(/\@WITH_XPTR\@/) != -1) { |
| 238 | of.WriteLine(s.replace(/\@WITH_XPTR\@/, withXptr? "1" : "0")); |
| 239 | } else if (s.search(/\@WITH_XINCLUDE\@/) != -1) { |
| 240 | of.WriteLine(s.replace(/\@WITH_XINCLUDE\@/, withXinclude? "1" : "0")); |
| 241 | } else if (s.search(/\@WITH_ICONV\@/) != -1) { |
| 242 | of.WriteLine(s.replace(/\@WITH_ICONV\@/, withIconv? "1" : "0")); |
Igor Zlatkovic | 3acadf4 | 2002-09-20 16:40:17 +0000 | [diff] [blame] | 243 | } else if (s.search(/\@WITH_ZLIB\@/) != -1) { |
| 244 | of.WriteLine(s.replace(/\@WITH_ZLIB\@/, withZlib? "1" : "0")); |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 245 | } else if (s.search(/\@WITH_DEBUG\@/) != -1) { |
| 246 | of.WriteLine(s.replace(/\@WITH_DEBUG\@/, withDebug? "1" : "0")); |
| 247 | } else if (s.search(/\@WITH_MEM_DEBUG\@/) != -1) { |
| 248 | of.WriteLine(s.replace(/\@WITH_MEM_DEBUG\@/, withMemDebug? "1" : "0")); |
Igor Zlatkovic | a6f2d90 | 2002-04-16 17:57:17 +0000 | [diff] [blame] | 249 | } else if (s.search(/\@WITH_SCHEMAS\@/) != -1) { |
| 250 | of.WriteLine(s.replace(/\@WITH_SCHEMAS\@/, withSchemas? "1" : "0")); |
Igor Zlatkovic | 8e04097 | 2002-09-20 13:39:53 +0000 | [diff] [blame] | 251 | } else if (s.search(/\@WITH_REGEXPS\@/) != -1) { |
| 252 | of.WriteLine(s.replace(/\@WITH_REGEXPS\@/, withRegExps? "1" : "0")); |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 253 | } else |
| 254 | of.WriteLine(ln); |
| 255 | } |
| 256 | ofi.Close(); |
| 257 | of.Close(); |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | /* Creates the readme file for the binary distribution of 'bname', for the |
| 261 | version 'ver' in the file 'file'. This one is called from the Makefile when |
| 262 | generating a binary distribution. The parameters are passed by make. */ |
| 263 | function genReadme(bname, ver, file) |
| 264 | { |
| 265 | var fso, f; |
| 266 | fso = new ActiveXObject("Scripting.FileSystemObject"); |
| 267 | f = fso.CreateTextFile(file, true); |
| 268 | f.WriteLine(" " + bname + " " + ver); |
| 269 | f.WriteLine(" --------------"); |
| 270 | f.WriteBlankLines(1); |
| 271 | f.WriteLine(" This is " + bname + ", version " + ver + ", binary package for the native Win32/IA32"); |
| 272 | f.WriteLine("platform."); |
| 273 | f.WriteBlankLines(1); |
| 274 | f.WriteLine(" The directory named 'include' contains the header files. Place its"); |
| 275 | f.WriteLine("contents somewhere where it can be found by the compiler."); |
| 276 | f.WriteLine(" The directory which answers to the name 'lib' contains the static and"); |
| 277 | f.WriteLine("dynamic libraries. Place them somewhere where they can be found by the"); |
| 278 | f.WriteLine("linker. The files whose names end with '_a.lib' are aimed for static"); |
| 279 | f.WriteLine("linking, the other files are lib/dll pairs."); |
| 280 | f.WriteLine(" The directory called 'util' contains various programs which count as a"); |
| 281 | f.WriteLine("part of " + bname + "."); |
| 282 | f.WriteBlankLines(1); |
Igor Zlatkovic | 0ceeb8e | 2002-09-10 19:07:02 +0000 | [diff] [blame] | 283 | f.WriteLine(" If you plan to develop your own programme, in C, which uses " + bname + ", then"); |
| 284 | f.WriteLine("you should know what to do with the files in the binary package. If you don't,"); |
| 285 | f.WriteLine("know this, then please, please do some research on how to use a"); |
| 286 | f.WriteLine("third-party library in a C programme. The topic belongs to the very basics"); |
| 287 | f.WriteLine("and you will not be able to do much without that knowledge."); |
| 288 | f.WriteBlankLines(1); |
| 289 | f.WriteLine(" If you wish to use " + bname + " solely through the supplied utilities, such as"); |
| 290 | f.WriteLine("xmllint or xsltproc, then all you need to do is place the"); |
| 291 | f.WriteLine("contents of the 'lib' and 'util' directories from the binary package in a"); |
| 292 | f.WriteLine("directory on your disc which is mentioned in your PATH environment"); |
| 293 | f.WriteLine("variable. You can use an existing directory which is allready in the"); |
| 294 | f.WriteLine("path, such as 'C:\WINDOWS', or 'C:\WINNT'. You can also create a new"); |
| 295 | f.WriteLine("directory for " + bname + " and place the files there, but be sure to modify"); |
| 296 | f.WriteLine("the PATH environment variable and add that new directory to its list."); |
| 297 | f.WriteBlankLines(1); |
| 298 | f.WriteLine(" If you use other software which needs " + bname + ", such as Apache"); |
| 299 | f.WriteLine("Web Server in certain configurations, then please consult the"); |
| 300 | f.WriteLine("documentation of that software and see if it mentions something about"); |
| 301 | f.WriteLine("how it uses " + bname + " and how it expects it to be installed. If you find"); |
| 302 | f.WriteLine("nothing, then the default installation, as described in the previous"); |
| 303 | f.WriteLine("paragraph, should be suficient."); |
| 304 | f.WriteBlankLines(1); |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 305 | f.WriteLine(" If there is something you cannot keep for yourself, such as a problem,"); |
| 306 | f.WriteLine("a cheer of joy, a comment or a suggestion, feel free to contact me using"); |
| 307 | f.WriteLine("the address below."); |
| 308 | f.WriteBlankLines(1); |
| 309 | f.WriteLine(" Igor Zlatkovic (igor@stud.fh-frankfurt.de)"); |
| 310 | f.Close(); |
| 311 | } |
| 312 | |
| 313 | /* |
| 314 | * main(), |
| 315 | * Execution begins here. |
| 316 | */ |
| 317 | |
| 318 | // Parse the command-line arguments. |
| 319 | for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) { |
| 320 | var arg, opt; |
| 321 | arg = WScript.Arguments(i); |
| 322 | opt = arg.substring(0, arg.indexOf("=")); |
| 323 | if (opt.length == 0) |
| 324 | opt = arg.substring(0, arg.indexOf(":")); |
| 325 | if (opt.length > 0) { |
| 326 | if (opt == "trio") |
| 327 | withTrio = strToBool(arg.substring(opt.length + 1, arg.length)); |
| 328 | else if (opt == "threads") |
Igor Zlatkovic | 8f536a8 | 2002-10-31 16:01:00 +0000 | [diff] [blame] | 329 | withThreads = arg.substring(opt.length + 1, arg.length); |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 330 | else if (opt == "ftp") |
| 331 | withFtp = strToBool(arg.substring(opt.length + 1, arg.length)); |
| 332 | else if (opt == "http") |
| 333 | withHttp = strToBool(arg.substring(opt.length + 1, arg.length)); |
| 334 | else if (opt == "html") |
| 335 | withHtml = strToBool(arg.substring(opt.length + 1, arg.length)); |
Igor Zlatkovic | 9425ce2 | 2002-04-10 21:57:11 +0000 | [diff] [blame] | 336 | else if (opt == "c14n") |
| 337 | withC14n = strToBool(arg.substring(opt.length + 1, arg.length)); |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 338 | else if (opt == "catalog") |
| 339 | withCatalog = strToBool(arg.substring(opt.length + 1, arg.length)); |
| 340 | else if (opt == "docb") |
| 341 | withDocb = strToBool(arg.substring(opt.length + 1, arg.length)); |
| 342 | else if (opt == "xpath") |
| 343 | withXpath = strToBool(arg.substring(opt.length + 1, arg.length)); |
| 344 | else if (opt == "xptr") |
| 345 | withXptr = strToBool(arg.substring(opt.length + 1, arg.length)); |
| 346 | else if (opt == "xinclude") |
| 347 | withXinclude = strToBool(arg.substring(opt.length + 1, arg.length)); |
| 348 | else if (opt == "iconv") |
| 349 | withIconv = strToBool(arg.substring(opt.length + 1, arg.length)); |
Igor Zlatkovic | 3acadf4 | 2002-09-20 16:40:17 +0000 | [diff] [blame] | 350 | else if (opt == "zlib") |
| 351 | withZlib = strToBool(arg.substring(opt.length + 1, arg.length)); |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 352 | else if (opt == "xml_debug") |
| 353 | withDebug = strToBool(arg.substring(opt.length + 1, arg.length)); |
| 354 | else if (opt == "mem_debug") |
| 355 | withMemDebug = strToBool(arg.substring(opt.length + 1, arg.length)); |
Igor Zlatkovic | a6f2d90 | 2002-04-16 17:57:17 +0000 | [diff] [blame] | 356 | else if (opt == "schemas") |
| 357 | withSchemas = strToBool(arg.substring(opt.length + 1, arg.length)); |
Igor Zlatkovic | 8e04097 | 2002-09-20 13:39:53 +0000 | [diff] [blame] | 358 | else if (opt == "regexps") |
| 359 | withRegExps = strToBool(arg.substring(opt.length + 1, arg.length)); |
Igor Zlatkovic | bd1a306 | 2002-11-14 17:43:24 +0000 | [diff] [blame^] | 360 | else if (opt == "compiler") |
| 361 | compiler = arg.substring(opt.length + 1, arg.length); |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 362 | else if (opt == "debug") |
| 363 | buildDebug = strToBool(arg.substring(opt.length + 1, arg.length)); |
| 364 | else if (opt == "static") |
| 365 | buildStatic = strToBool(arg.substring(opt.length + 1, arg.length)); |
| 366 | else if (opt == "prefix") |
| 367 | buildPrefix = arg.substring(opt.length + 1, arg.length); |
| 368 | else if (opt == "incdir") |
| 369 | buildIncPrefix = arg.substring(opt.length + 1, arg.length); |
| 370 | else if (opt == "bindir") |
| 371 | buildBinPrefix = arg.substring(opt.length + 1, arg.length); |
| 372 | else if (opt == "libdir") |
| 373 | buildLibPrefix = arg.substring(opt.length + 1, arg.length); |
| 374 | else if (opt == "sodir") |
| 375 | buildSoPrefix = arg.substring(opt.length + 1, arg.length); |
| 376 | else if (opt == "incdir") |
| 377 | buildIncPrefix = arg.substring(opt.length + 1, arg.length); |
| 378 | else if (opt == "include") |
| 379 | buildInclude = arg.substring(opt.length + 1, arg.length); |
| 380 | else if (opt == "lib") |
| 381 | buildLib = arg.substring(opt.length + 1, arg.length); |
| 382 | else |
| 383 | error = 1; |
| 384 | } else if (i == 0) { |
| 385 | if (arg == "genreadme") { |
| 386 | // This command comes from the Makefile and will not be checked |
| 387 | // for errors, because Makefile will always supply right the parameters. |
| 388 | genReadme(WScript.Arguments(1), WScript.Arguments(2), WScript.Arguments(3)); |
| 389 | WScript.Quit(0); |
| 390 | } else if (arg == "help") { |
| 391 | usage(); |
| 392 | WScript.Quit(0); |
| 393 | } |
| 394 | } else |
| 395 | error = 1; |
| 396 | } |
| 397 | |
| 398 | // If we fail here, it is because the user supplied an unrecognised argument. |
| 399 | if (error != 0) { |
| 400 | usage(); |
| 401 | WScript.Quit(error); |
| 402 | } |
| 403 | |
| 404 | // Discover the version. |
| 405 | discoverVersion(); |
| 406 | if (error != 0) { |
| 407 | WScript.Echo("Version discovery failed, aborting."); |
| 408 | WScript.Quit(error); |
| 409 | } |
| 410 | WScript.Echo(baseName + " version: " + verMajor + "." + verMinor + "." + verMicro); |
| 411 | |
| 412 | // Configure libxml. |
| 413 | configureLibxml(); |
| 414 | if (error != 0) { |
| 415 | WScript.Echo("Configuration failed, aborting."); |
| 416 | WScript.Quit(error); |
| 417 | } |
| 418 | |
| 419 | // Create the makefile. |
| 420 | var fso = new ActiveXObject("Scripting.FileSystemObject"); |
Igor Zlatkovic | bd1a306 | 2002-11-14 17:43:24 +0000 | [diff] [blame^] | 421 | var makefile = ".\\Makefile.msvc"; |
| 422 | if (compiler == "mingw") |
| 423 | makefile = ".\\Makefile.mingw"; |
| 424 | fso.CopyFile(makefile, ".\\Makefile", true); |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 425 | WScript.Echo("Created Makefile."); |
| 426 | |
| 427 | // Display the final configuration. |
| 428 | var txtOut = "\nXML processor configuration\n"; |
| 429 | txtOut += "---------------------------\n"; |
| 430 | txtOut += " Trio: " + boolToStr(withTrio) + "\n"; |
Igor Zlatkovic | 8f536a8 | 2002-10-31 16:01:00 +0000 | [diff] [blame] | 431 | txtOut += " Thread safety: " + withThreads + "\n"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 432 | txtOut += " FTP client: " + boolToStr(withFtp) + "\n"; |
| 433 | txtOut += " HTTP client: " + boolToStr(withHttp) + "\n"; |
| 434 | txtOut += " HTML processor: " + boolToStr(withHtml) + "\n"; |
| 435 | txtOut += " C14N support: " + boolToStr(withC14n) + "\n"; |
| 436 | txtOut += " Catalog support: " + boolToStr(withCatalog) + "\n"; |
| 437 | txtOut += " DocBook support: " + boolToStr(withDocb) + "\n"; |
| 438 | txtOut += " XPath support: " + boolToStr(withXpath) + "\n"; |
| 439 | txtOut += " XPointer support: " + boolToStr(withXptr) + "\n"; |
| 440 | txtOut += " XInclude support: " + boolToStr(withXinclude) + "\n"; |
Igor Zlatkovic | 3acadf4 | 2002-09-20 16:40:17 +0000 | [diff] [blame] | 441 | txtOut += " iconv support: " + boolToStr(withIconv) + "\n"; |
| 442 | txtOut += " zlib support: " + boolToStr(withZlib) + "\n"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 443 | txtOut += " Debugging module: " + boolToStr(withDebug) + "\n"; |
| 444 | txtOut += " Memory debugging: " + boolToStr(withMemDebug) + "\n"; |
Igor Zlatkovic | 8e04097 | 2002-09-20 13:39:53 +0000 | [diff] [blame] | 445 | txtOut += " Regexp support: " + boolToStr(withRegExps) + "\n"; |
Igor Zlatkovic | a6f2d90 | 2002-04-16 17:57:17 +0000 | [diff] [blame] | 446 | txtOut += "XML Schema support: " + boolToStr(withSchemas) + "\n"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 447 | txtOut += "\n"; |
| 448 | txtOut += "Win32 build configuration\n"; |
| 449 | txtOut += "-------------------------\n"; |
Igor Zlatkovic | bd1a306 | 2002-11-14 17:43:24 +0000 | [diff] [blame^] | 450 | txtOut += " Compiler: " + compiler + "\n"; |
Igor Zlatkovic | ac97f6e | 2002-03-24 21:00:26 +0000 | [diff] [blame] | 451 | txtOut += " Debug symbols: " + boolToStr(buildDebug) + "\n"; |
| 452 | txtOut += " Static xmllint: " + boolToStr(buildStatic) + "\n"; |
| 453 | txtOut += " Install prefix: " + buildPrefix + "\n"; |
| 454 | txtOut += " Put tools in: " + buildBinPrefix + "\n"; |
| 455 | txtOut += " Put headers in: " + buildIncPrefix + "\n"; |
| 456 | txtOut += "Put static libs in: " + buildLibPrefix + "\n"; |
| 457 | txtOut += "Put shared libs in: " + buildSoPrefix + "\n"; |
| 458 | txtOut += " Include path: " + buildInclude + "\n"; |
| 459 | txtOut += " Lib path: " + buildLib + "\n"; |
| 460 | WScript.Echo(txtOut); |
| 461 | |
| 462 | // Done. |