VirtualBox

source: vbox/trunk/src/libs/libxml2-2.13.2/win32/configure.js@ 105770

Last change on this file since 105770 was 105420, checked in by vboxsync, 8 months ago

libxml2-2.12.6: Applied and adjusted our libxml2 changes to 2.12.6. bugref:10730

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette