blob: c0cb84b7f60826c5f57ef52ea75cb6a46c85e739 [file] [log] [blame]
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +00001/* 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 Veillardbeb70bd2002-12-18 14:53:54 +00007 * March 2002, Igor Zlatkovic <igor@zlatkovic.com>
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +00008 */
9
10/* The source directory, relative to the one where this file resides. */
11var srcDirXml = "..";
12var srcDirUtils = "..";
13/* The directory where we put the binaries after compilation. */
14var binDir = "binaries";
15/* Base name of what we are building. */
16var baseName = "libxml2";
17/* Configure file which contains the version and the output file where
18 we can store our build configuration. */
19var configFile = srcDirXml + "\\configure.in";
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +000020var versionFile = ".\\config.msvc";
Igor Zlatkovic853514f2002-11-22 21:41:09 +000021/* Input and output files regarding the libxml features. */
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000022var optsFileIn = srcDirXml + "\\include\\libxml\\xmlversion.h.in";
23var optsFile = srcDirXml + "\\include\\libxml\\xmlversion.h";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000024/* Version strings for the binary distribution. Will be filled later
25 in the code. */
26var verMajor;
27var verMinor;
28var verMicro;
29/* Libxml features. */
30var withTrio = false;
Igor Zlatkovice38ab532003-05-17 11:30:54 +000031var withThreads = "native";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000032var withFtp = true;
33var withHttp = true;
34var withHtml = true;
35var withC14n = true;
36var withCatalog = true;
37var withDocb = true;
38var withXpath = true;
39var withXptr = true;
40var withXinclude = true;
41var withIconv = true;
William M. Brack6d13f332003-08-08 16:40:36 +000042var withIso8859x = false;
Igor Zlatkovic3acadf42002-09-20 16:40:17 +000043var withZlib = false;
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000044var withDebug = true;
45var withMemDebug = false;
Igor Zlatkovica6f2d902002-04-16 17:57:17 +000046var withSchemas = true;
Igor Zlatkovic8e040972002-09-20 13:39:53 +000047var withRegExps = true;
Igor Zlatkovic853514f2002-11-22 21:41:09 +000048var withPython = false;
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000049/* Win32 build options. */
Igor Zlatkovic01c0ced2003-08-28 10:49:25 +000050var dirSep = "\\";
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +000051var compiler = "msvc";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000052var buildDebug = 0;
53var buildStatic = 0;
54var buildPrefix = ".";
Igor Zlatkovic01c0ced2003-08-28 10:49:25 +000055var buildBinPrefix = "";
56var buildIncPrefix = "";
57var buildLibPrefix = "";
58var buildSoPrefix = "";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000059var buildInclude = ".";
60var buildLib = ".";
61/* Local stuff */
62var error = 0;
63
64/* Helper function, transforms the option variable into the 'Enabled'
65 or 'Disabled' string. */
66function boolToStr(opt)
67{
68 if (opt == false)
Igor Zlatkovic8f536a82002-10-31 16:01:00 +000069 return "no";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000070 else if (opt == true)
Igor Zlatkovic8f536a82002-10-31 16:01:00 +000071 return "yes";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000072 error = 1;
Igor Zlatkovic8f536a82002-10-31 16:01:00 +000073 return "*** undefined ***";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000074}
75
76/* Helper function, transforms the argument string into a boolean
77 value. */
78function strToBool(opt)
79{
80 if (opt == 0 || opt == "no")
81 return false;
82 else if (opt == 1 || opt == "yes")
83 return true;
84 error = 1;
85 return false;
86}
87
88/* Displays the details about how to use this script. */
89function usage()
90{
91 var txt;
92 txt = "Usage:\n";
93 txt += " cscript " + WScript.ScriptName + " <options>\n";
94 txt += " cscript " + WScript.ScriptName + " help\n\n";
95 txt += "Options can be specified in the form <option>=<value>, where the value is\n";
Igor Zlatkovic8f536a82002-10-31 16:01:00 +000096 txt += "either 'yes' or 'no', if not stated otherwise.\n\n";
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +000097 txt += "\nXML processor options, default value given in parentheses:\n\n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000098 txt += " trio: Enable TRIO string manipulator (" + (withTrio? "yes" : "no") + ")\n";
Igor Zlatkovic8f536a82002-10-31 16:01:00 +000099 txt += " threads: Enable thread safety [no|ctls|native|posix] (" + (withThreads) + ") \n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000100 txt += " ftp: Enable FTP client (" + (withFtp? "yes" : "no") + ")\n";
101 txt += " http: Enable HTTP client (" + (withHttp? "yes" : "no") + ")\n";
102 txt += " html: Enable HTML processor (" + (withHtml? "yes" : "no") + ")\n";
103 txt += " c14n: Enable C14N support (" + (withC14n? "yes" : "no") + ")\n";
104 txt += " catalog: Enable catalog support (" + (withCatalog? "yes" : "no") + ")\n";
105 txt += " docb: Enable DocBook support (" + (withDocb? "yes" : "no") + ")\n";
106 txt += " xpath: Enable XPath support (" + (withXpath? "yes" : "no") + ")\n";
107 txt += " xptr: Enable XPointer support (" + (withXptr? "yes" : "no") + ")\n";
108 txt += " xinclude: Enable XInclude support (" + (withXinclude? "yes" : "no") + ")\n";
Igor Zlatkovic3acadf42002-09-20 16:40:17 +0000109 txt += " iconv: Enable iconv support (" + (withIconv? "yes" : "no") + ")\n";
William M. Brack6d13f332003-08-08 16:40:36 +0000110 txt += " iso8859x: Enable ISO8859X support (" + (withIso8859x? "yes" : "no") + ")\n";
Igor Zlatkovic3acadf42002-09-20 16:40:17 +0000111 txt += " zlib: Enable zlib support (" + (withZlib? "yes" : "no") + ")\n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000112 txt += " xml_debug: Enable XML debbugging module (" + (withDebug? "yes" : "no") + ")\n";
113 txt += " mem_debug: Enable memory debugger (" + (withMemDebug? "yes" : "no") + ")\n";
Igor Zlatkovic8e040972002-09-20 13:39:53 +0000114 txt += " regexps: Enable regular expressions (" + (withRegExps? "yes" : "no") + ")\n";
Igor Zlatkovica6f2d902002-04-16 17:57:17 +0000115 txt += " schemas: Enable XML Schema support (" + (withSchemas? "yes" : "no") + ")\n";
Igor Zlatkovic853514f2002-11-22 21:41:09 +0000116 txt += " python: Build Python bindings (" + (withPython? "yes" : "no") + ")\n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000117 txt += "\nWin32 build options, default value given in parentheses:\n\n";
Igor Zlatkovic72f92a82003-06-14 16:48:26 +0000118 txt += " compiler: Compiler to be used [msvc|mingw|bcb] (" + compiler + ")\n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000119 txt += " debug: Build unoptimised debug executables (" + (buildDebug? "yes" : "no") + ")\n";
120 txt += " static: Link xmllint statically to libxml2 (" + (buildStatic? "yes" : "no") + ")\n";
121 txt += " prefix: Base directory for the installation (" + buildPrefix + ")\n";
122 txt += " bindir: Directory where xmllint and friends should be installed\n";
123 txt += " (" + buildBinPrefix + ")\n";
124 txt += " incdir: Directory where headers should be installed\n";
125 txt += " (" + buildIncPrefix + ")\n";
126 txt += " libdir: Directory where static and import libraries should be\n";
127 txt += " installed (" + buildLibPrefix + ")\n";
128 txt += " sodir: Directory where shared libraries should be installed\n";
129 txt += " (" + buildSoPrefix + ")\n";
130 txt += " include: Additional search path for the compiler, particularily\n";
131 txt += " where iconv headers can be found (" + buildInclude + ")\n";
132 txt += " lib: Additional search path for the linker, particularily\n";
133 txt += " where iconv library can be found (" + buildLib + ")\n";
134 WScript.Echo(txt);
135}
136
137/* Discovers the version we are working with by reading the apropriate
138 configuration file. Despite its name, this also writes the configuration
139 file included by our makefile. */
140function discoverVersion()
141{
142 var fso, cf, vf, ln, s;
143 fso = new ActiveXObject("Scripting.FileSystemObject");
144 cf = fso.OpenTextFile(configFile, 1);
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +0000145 if (compiler == "msvc")
146 versionFile = ".\\config.msvc";
147 else if (compiler == "mingw")
148 versionFile = ".\\config.mingw";
Igor Zlatkovic72f92a82003-06-14 16:48:26 +0000149 else if (compiler == "bcb")
150 versionFile = ".\\config.bcb";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000151 vf = fso.CreateTextFile(versionFile, true);
152 vf.WriteLine("# " + versionFile);
153 vf.WriteLine("# This file is generated automatically by " + WScript.ScriptName + ".");
154 vf.WriteBlankLines(1);
155 while (cf.AtEndOfStream != true) {
156 ln = cf.ReadLine();
157 s = new String(ln);
Daniel Veillard70b18562003-09-24 21:45:21 +0000158 if (s.search(/^LIBXML_MAJOR_VERSION=/) != -1) {
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000159 vf.WriteLine(s);
160 verMajor = s.substring(s.indexOf("=") + 1, s.length)
Daniel Veillard70b18562003-09-24 21:45:21 +0000161 } else if(s.search(/^LIBXML_MINOR_VERSION=/) != -1) {
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000162 vf.WriteLine(s);
163 verMinor = s.substring(s.indexOf("=") + 1, s.length)
Daniel Veillard70b18562003-09-24 21:45:21 +0000164 } else if(s.search(/^LIBXML_MICRO_VERSION=/) != -1) {
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000165 vf.WriteLine(s);
166 verMicro = s.substring(s.indexOf("=") + 1, s.length)
Daniel Veillard70b18562003-09-24 21:45:21 +0000167 } else if(s.search(/^LIBXML_MICRO_VERSION_SUFFIX=/) != -1) {
168 vf.WriteLine(s);
169 verMicroSuffix = s.substring(s.indexOf("=") + 1, s.length)
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000170 }
171 }
172 cf.Close();
173 vf.WriteLine("XML_SRCDIR=" + srcDirXml);
174 vf.WriteLine("UTILS_SRCDIR=" + srcDirUtils);
175 vf.WriteLine("BINDIR=" + binDir);
176 vf.WriteLine("WITH_TRIO=" + (withTrio? "1" : "0"));
Igor Zlatkovic8f536a82002-10-31 16:01:00 +0000177 vf.WriteLine("WITH_THREADS=" + withThreads);
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000178 vf.WriteLine("WITH_FTP=" + (withFtp? "1" : "0"));
179 vf.WriteLine("WITH_HTTP=" + (withHttp? "1" : "0"));
180 vf.WriteLine("WITH_HTML=" + (withHtml? "1" : "0"));
181 vf.WriteLine("WITH_C14N=" + (withC14n? "1" : "0"));
182 vf.WriteLine("WITH_CATALOG=" + (withCatalog? "1" : "0"));
183 vf.WriteLine("WITH_DOCB=" + (withDocb? "1" : "0"));
184 vf.WriteLine("WITH_XPATH=" + (withXpath? "1" : "0"));
185 vf.WriteLine("WITH_XPTR=" + (withXptr? "1" : "0"));
186 vf.WriteLine("WITH_XINCLUDE=" + (withXinclude? "1" : "0"));
187 vf.WriteLine("WITH_ICONV=" + (withIconv? "1" : "0"));
William M. Brack6d13f332003-08-08 16:40:36 +0000188 vf.WriteLine("WITH_ISO8859X=" + (withIso8859x? "1" : "0"));
Igor Zlatkovic3acadf42002-09-20 16:40:17 +0000189 vf.WriteLine("WITH_ZLIB=" + (withZlib? "1" : "0"));
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000190 vf.WriteLine("WITH_DEBUG=" + (withDebug? "1" : "0"));
191 vf.WriteLine("WITH_MEM_DEBUG=" + (withMemDebug? "1" : "0"));
Igor Zlatkovica6f2d902002-04-16 17:57:17 +0000192 vf.WriteLine("WITH_SCHEMAS=" + (withSchemas? "1" : "0"));
Igor Zlatkovic8e040972002-09-20 13:39:53 +0000193 vf.WriteLine("WITH_REGEXPS=" + (withRegExps? "1" : "0"));
Igor Zlatkovic853514f2002-11-22 21:41:09 +0000194 vf.WriteLine("WITH_PYTHON=" + (withPython? "1" : "0"));
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000195 vf.WriteLine("DEBUG=" + (buildDebug? "1" : "0"));
196 vf.WriteLine("STATIC=" + (buildStatic? "1" : "0"));
197 vf.WriteLine("PREFIX=" + buildPrefix);
198 vf.WriteLine("BINPREFIX=" + buildBinPrefix);
199 vf.WriteLine("INCPREFIX=" + buildIncPrefix);
200 vf.WriteLine("LIBPREFIX=" + buildLibPrefix);
201 vf.WriteLine("SOPREFIX=" + buildSoPrefix);
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +0000202 if (compiler == "msvc") {
203 vf.WriteLine("INCLUDE=$(INCLUDE);" + buildInclude);
204 vf.WriteLine("LIB=$(LIB);" + buildLib);
205 } else if (compiler == "mingw") {
206 vf.WriteLine("INCLUDE+=;" + buildInclude);
207 vf.WriteLine("LIB+=;" + buildLib);
Igor Zlatkovic72f92a82003-06-14 16:48:26 +0000208 } else if (compiler == "bcb") {
209 vf.WriteLine("INCLUDE=" + buildInclude);
210 vf.WriteLine("LIB=" + buildLib);
211 }
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000212 vf.Close();
213}
214
215/* Configures libxml. This one will generate xmlversion.h from xmlversion.h.in
216 taking what the user passed on the command line into account. */
217function configureLibxml()
218{
219 var fso, ofi, of, ln, s;
220 fso = new ActiveXObject("Scripting.FileSystemObject");
221 ofi = fso.OpenTextFile(optsFileIn, 1);
222 of = fso.CreateTextFile(optsFile, true);
223 while (ofi.AtEndOfStream != true) {
224 ln = ofi.ReadLine();
225 s = new String(ln);
226 if (s.search(/\@VERSION\@/) != -1) {
227 of.WriteLine(s.replace(/\@VERSION\@/,
Daniel Veillard70b18562003-09-24 21:45:21 +0000228 verMajor + "." + verMinor + "." + verMicro + verMicroSuffix));
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000229 } else if (s.search(/\@LIBXML_VERSION_NUMBER\@/) != -1) {
230 of.WriteLine(s.replace(/\@LIBXML_VERSION_NUMBER\@/,
231 verMajor*10000 + verMinor*100 + verMicro*1));
232 } else if (s.search(/\@WITH_TRIO\@/) != -1) {
233 of.WriteLine(s.replace(/\@WITH_TRIO\@/, withTrio? "1" : "0"));
234 } else if (s.search(/\@WITH_THREADS\@/) != -1) {
Igor Zlatkovic8f536a82002-10-31 16:01:00 +0000235 of.WriteLine(s.replace(/\@WITH_THREADS\@/, withThreads == "no"? "0" : "1"));
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000236 } else if (s.search(/\@WITH_FTP\@/) != -1) {
237 of.WriteLine(s.replace(/\@WITH_FTP\@/, withFtp? "1" : "0"));
238 } else if (s.search(/\@WITH_HTTP\@/) != -1) {
239 of.WriteLine(s.replace(/\@WITH_HTTP\@/, withHttp? "1" : "0"));
240 } else if (s.search(/\@WITH_HTML\@/) != -1) {
241 of.WriteLine(s.replace(/\@WITH_HTML\@/, withHtml? "1" : "0"));
242 } else if (s.search(/\@WITH_C14N\@/) != -1) {
243 of.WriteLine(s.replace(/\@WITH_C14N\@/, withC14n? "1" : "0"));
244 } else if (s.search(/\@WITH_CATALOG\@/) != -1) {
245 of.WriteLine(s.replace(/\@WITH_CATALOG\@/, withCatalog? "1" : "0"));
246 } else if (s.search(/\@WITH_DOCB\@/) != -1) {
247 of.WriteLine(s.replace(/\@WITH_DOCB\@/, withDocb? "1" : "0"));
248 } else if (s.search(/\@WITH_XPATH\@/) != -1) {
249 of.WriteLine(s.replace(/\@WITH_XPATH\@/, withXpath? "1" : "0"));
250 } else if (s.search(/\@WITH_XPTR\@/) != -1) {
251 of.WriteLine(s.replace(/\@WITH_XPTR\@/, withXptr? "1" : "0"));
252 } else if (s.search(/\@WITH_XINCLUDE\@/) != -1) {
253 of.WriteLine(s.replace(/\@WITH_XINCLUDE\@/, withXinclude? "1" : "0"));
254 } else if (s.search(/\@WITH_ICONV\@/) != -1) {
255 of.WriteLine(s.replace(/\@WITH_ICONV\@/, withIconv? "1" : "0"));
William M. Brack6d13f332003-08-08 16:40:36 +0000256 } else if (s.search(/\@WITH_ISO8859X\@/) != -1) {
257 of.WriteLine(s.replace(/\@WITH_ISO8859X\@/, withIso8859x? "1" : "0"));
Igor Zlatkovic3acadf42002-09-20 16:40:17 +0000258 } else if (s.search(/\@WITH_ZLIB\@/) != -1) {
259 of.WriteLine(s.replace(/\@WITH_ZLIB\@/, withZlib? "1" : "0"));
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000260 } else if (s.search(/\@WITH_DEBUG\@/) != -1) {
261 of.WriteLine(s.replace(/\@WITH_DEBUG\@/, withDebug? "1" : "0"));
262 } else if (s.search(/\@WITH_MEM_DEBUG\@/) != -1) {
263 of.WriteLine(s.replace(/\@WITH_MEM_DEBUG\@/, withMemDebug? "1" : "0"));
Igor Zlatkovica6f2d902002-04-16 17:57:17 +0000264 } else if (s.search(/\@WITH_SCHEMAS\@/) != -1) {
265 of.WriteLine(s.replace(/\@WITH_SCHEMAS\@/, withSchemas? "1" : "0"));
Igor Zlatkovic8e040972002-09-20 13:39:53 +0000266 } else if (s.search(/\@WITH_REGEXPS\@/) != -1) {
267 of.WriteLine(s.replace(/\@WITH_REGEXPS\@/, withRegExps? "1" : "0"));
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000268 } else
269 of.WriteLine(ln);
270 }
271 ofi.Close();
272 of.Close();
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000273}
Igor Zlatkovic853514f2002-11-22 21:41:09 +0000274/* Configures Python bindings. Otherwise identical to the above */
275function configureLibxmlPy()
276{
277 var pyOptsFileIn = srcDirXml + "\\python\\setup.py.in";
278 var pyOptsFile = srcDirXml + "\\python\\setup.py";
279 var fso, ofi, of, ln, s;
280 fso = new ActiveXObject("Scripting.FileSystemObject");
281 ofi = fso.OpenTextFile(pyOptsFileIn, 1);
282 of = fso.CreateTextFile(pyOptsFile, true);
283 while (ofi.AtEndOfStream != true) {
284 ln = ofi.ReadLine();
285 s = new String(ln);
286 if (s.search(/\@LIBXML_VERSION\@/) != -1) {
287 of.WriteLine(s.replace(/\@LIBXML_VERSION\@/,
288 verMajor + "." + verMinor + "." + verMicro));
289 } else if (s.search(/\@prefix\@/) != -1) {
290 of.WriteLine(s.replace(/\@prefix\@/, buildPrefix));
Daniel Veillard94bb2f12003-04-27 22:14:07 +0000291 } else if (s.search(/\@WITH_THREADS\@/) != -1) {
292 of.WriteLine(s.replace(/\@WITH_THREADS\@/, withThreads == "no"? "0" : "1"));
Igor Zlatkovic853514f2002-11-22 21:41:09 +0000293 } else
294 of.WriteLine(ln);
295 }
296 ofi.Close();
297 of.Close();
298}
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000299
300/* Creates the readme file for the binary distribution of 'bname', for the
301 version 'ver' in the file 'file'. This one is called from the Makefile when
302 generating a binary distribution. The parameters are passed by make. */
303function genReadme(bname, ver, file)
304{
305 var fso, f;
306 fso = new ActiveXObject("Scripting.FileSystemObject");
307 f = fso.CreateTextFile(file, true);
308 f.WriteLine(" " + bname + " " + ver);
309 f.WriteLine(" --------------");
310 f.WriteBlankLines(1);
311 f.WriteLine(" This is " + bname + ", version " + ver + ", binary package for the native Win32/IA32");
312 f.WriteLine("platform.");
313 f.WriteBlankLines(1);
314 f.WriteLine(" The directory named 'include' contains the header files. Place its");
315 f.WriteLine("contents somewhere where it can be found by the compiler.");
316 f.WriteLine(" The directory which answers to the name 'lib' contains the static and");
317 f.WriteLine("dynamic libraries. Place them somewhere where they can be found by the");
318 f.WriteLine("linker. The files whose names end with '_a.lib' are aimed for static");
319 f.WriteLine("linking, the other files are lib/dll pairs.");
320 f.WriteLine(" The directory called 'util' contains various programs which count as a");
321 f.WriteLine("part of " + bname + ".");
322 f.WriteBlankLines(1);
Igor Zlatkovic0ceeb8e2002-09-10 19:07:02 +0000323 f.WriteLine(" If you plan to develop your own programme, in C, which uses " + bname + ", then");
324 f.WriteLine("you should know what to do with the files in the binary package. If you don't,");
325 f.WriteLine("know this, then please, please do some research on how to use a");
326 f.WriteLine("third-party library in a C programme. The topic belongs to the very basics");
327 f.WriteLine("and you will not be able to do much without that knowledge.");
328 f.WriteBlankLines(1);
329 f.WriteLine(" If you wish to use " + bname + " solely through the supplied utilities, such as");
330 f.WriteLine("xmllint or xsltproc, then all you need to do is place the");
331 f.WriteLine("contents of the 'lib' and 'util' directories from the binary package in a");
332 f.WriteLine("directory on your disc which is mentioned in your PATH environment");
333 f.WriteLine("variable. You can use an existing directory which is allready in the");
334 f.WriteLine("path, such as 'C:\WINDOWS', or 'C:\WINNT'. You can also create a new");
335 f.WriteLine("directory for " + bname + " and place the files there, but be sure to modify");
336 f.WriteLine("the PATH environment variable and add that new directory to its list.");
337 f.WriteBlankLines(1);
338 f.WriteLine(" If you use other software which needs " + bname + ", such as Apache");
339 f.WriteLine("Web Server in certain configurations, then please consult the");
340 f.WriteLine("documentation of that software and see if it mentions something about");
341 f.WriteLine("how it uses " + bname + " and how it expects it to be installed. If you find");
342 f.WriteLine("nothing, then the default installation, as described in the previous");
343 f.WriteLine("paragraph, should be suficient.");
344 f.WriteBlankLines(1);
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000345 f.WriteLine(" If there is something you cannot keep for yourself, such as a problem,");
346 f.WriteLine("a cheer of joy, a comment or a suggestion, feel free to contact me using");
347 f.WriteLine("the address below.");
348 f.WriteBlankLines(1);
Daniel Veillardbeb70bd2002-12-18 14:53:54 +0000349 f.WriteLine(" Igor Zlatkovic (igor@zlatkovic.com)");
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000350 f.Close();
351}
352
William M. Brack6d13f332003-08-08 16:40:36 +0000353
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000354/*
355 * main(),
356 * Execution begins here.
357 */
358
359// Parse the command-line arguments.
360for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) {
361 var arg, opt;
362 arg = WScript.Arguments(i);
363 opt = arg.substring(0, arg.indexOf("="));
364 if (opt.length == 0)
365 opt = arg.substring(0, arg.indexOf(":"));
366 if (opt.length > 0) {
367 if (opt == "trio")
368 withTrio = strToBool(arg.substring(opt.length + 1, arg.length));
369 else if (opt == "threads")
Igor Zlatkovic8f536a82002-10-31 16:01:00 +0000370 withThreads = arg.substring(opt.length + 1, arg.length);
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000371 else if (opt == "ftp")
372 withFtp = strToBool(arg.substring(opt.length + 1, arg.length));
373 else if (opt == "http")
374 withHttp = strToBool(arg.substring(opt.length + 1, arg.length));
375 else if (opt == "html")
376 withHtml = strToBool(arg.substring(opt.length + 1, arg.length));
Igor Zlatkovic9425ce22002-04-10 21:57:11 +0000377 else if (opt == "c14n")
378 withC14n = strToBool(arg.substring(opt.length + 1, arg.length));
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000379 else if (opt == "catalog")
380 withCatalog = strToBool(arg.substring(opt.length + 1, arg.length));
381 else if (opt == "docb")
382 withDocb = strToBool(arg.substring(opt.length + 1, arg.length));
383 else if (opt == "xpath")
384 withXpath = strToBool(arg.substring(opt.length + 1, arg.length));
385 else if (opt == "xptr")
386 withXptr = strToBool(arg.substring(opt.length + 1, arg.length));
387 else if (opt == "xinclude")
388 withXinclude = strToBool(arg.substring(opt.length + 1, arg.length));
389 else if (opt == "iconv")
390 withIconv = strToBool(arg.substring(opt.length + 1, arg.length));
William M. Brack6d13f332003-08-08 16:40:36 +0000391 else if (opt == "iso8859x")
392 withIso8859x = strToBool(arg.substring(opt.length + 1, arg.length));
Igor Zlatkovic3acadf42002-09-20 16:40:17 +0000393 else if (opt == "zlib")
394 withZlib = strToBool(arg.substring(opt.length + 1, arg.length));
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000395 else if (opt == "xml_debug")
396 withDebug = strToBool(arg.substring(opt.length + 1, arg.length));
397 else if (opt == "mem_debug")
398 withMemDebug = strToBool(arg.substring(opt.length + 1, arg.length));
Igor Zlatkovica6f2d902002-04-16 17:57:17 +0000399 else if (opt == "schemas")
400 withSchemas = strToBool(arg.substring(opt.length + 1, arg.length));
Igor Zlatkovic8e040972002-09-20 13:39:53 +0000401 else if (opt == "regexps")
402 withRegExps = strToBool(arg.substring(opt.length + 1, arg.length));
Igor Zlatkovic853514f2002-11-22 21:41:09 +0000403 else if (opt == "python")
404 withPython = strToBool(arg.substring(opt.length + 1, arg.length));
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +0000405 else if (opt == "compiler")
406 compiler = arg.substring(opt.length + 1, arg.length);
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000407 else if (opt == "debug")
408 buildDebug = strToBool(arg.substring(opt.length + 1, arg.length));
409 else if (opt == "static")
410 buildStatic = strToBool(arg.substring(opt.length + 1, arg.length));
411 else if (opt == "prefix")
412 buildPrefix = arg.substring(opt.length + 1, arg.length);
413 else if (opt == "incdir")
414 buildIncPrefix = arg.substring(opt.length + 1, arg.length);
415 else if (opt == "bindir")
416 buildBinPrefix = arg.substring(opt.length + 1, arg.length);
417 else if (opt == "libdir")
418 buildLibPrefix = arg.substring(opt.length + 1, arg.length);
419 else if (opt == "sodir")
420 buildSoPrefix = arg.substring(opt.length + 1, arg.length);
421 else if (opt == "incdir")
422 buildIncPrefix = arg.substring(opt.length + 1, arg.length);
423 else if (opt == "include")
424 buildInclude = arg.substring(opt.length + 1, arg.length);
425 else if (opt == "lib")
426 buildLib = arg.substring(opt.length + 1, arg.length);
427 else
428 error = 1;
429 } else if (i == 0) {
430 if (arg == "genreadme") {
431 // This command comes from the Makefile and will not be checked
432 // for errors, because Makefile will always supply right the parameters.
433 genReadme(WScript.Arguments(1), WScript.Arguments(2), WScript.Arguments(3));
434 WScript.Quit(0);
435 } else if (arg == "help") {
436 usage();
437 WScript.Quit(0);
438 }
William M. Brack6d13f332003-08-08 16:40:36 +0000439
Igor Zlatkovic01c0ced2003-08-28 10:49:25 +0000440 } else {
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000441 error = 1;
Igor Zlatkovic01c0ced2003-08-28 10:49:25 +0000442 }
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000443}
444
William M. Brack6d13f332003-08-08 16:40:36 +0000445
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000446// If we fail here, it is because the user supplied an unrecognised argument.
447if (error != 0) {
448 usage();
449 WScript.Quit(error);
450}
Igor Zlatkovic01c0ced2003-08-28 10:49:25 +0000451dirSep = "\\";
452if (compiler == "mingw")
453 dirSep = "/";
454if (buildBinPrefix == "")
455 buildBinPrefix = "$(PREFIX)" + dirSep + "bin";
456if (buildIncPrefix == "")
457 buildIncPrefix = "$(PREFIX)" + dirSep + "include";
458if (buildLibPrefix == "")
459 buildLibPrefix = "$(PREFIX)" + dirSep + "lib";
460if (buildSoPrefix == "")
461 buildSoPrefix = "$(PREFIX)" + dirSep + "lib";
William M. Brack6d13f332003-08-08 16:40:36 +0000462
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000463// Discover the version.
464discoverVersion();
465if (error != 0) {
466 WScript.Echo("Version discovery failed, aborting.");
467 WScript.Quit(error);
468}
William M. Brack6d13f332003-08-08 16:40:36 +0000469
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000470WScript.Echo(baseName + " version: " + verMajor + "." + verMinor + "." + verMicro);
471
472// Configure libxml.
473configureLibxml();
474if (error != 0) {
475 WScript.Echo("Configuration failed, aborting.");
476 WScript.Quit(error);
477}
William M. Brack6d13f332003-08-08 16:40:36 +0000478
Igor Zlatkovic853514f2002-11-22 21:41:09 +0000479if (withPython == true) {
480 configureLibxmlPy();
481 if (error != 0) {
482 WScript.Echo("Configuration failed, aborting.");
483 WScript.Quit(error);
484 }
William M. Brack6d13f332003-08-08 16:40:36 +0000485
Igor Zlatkovic853514f2002-11-22 21:41:09 +0000486}
487
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000488// Create the makefile.
489var fso = new ActiveXObject("Scripting.FileSystemObject");
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +0000490var makefile = ".\\Makefile.msvc";
491if (compiler == "mingw")
492 makefile = ".\\Makefile.mingw";
Igor Zlatkovice8b5b0f2003-06-16 07:12:50 +0000493else if (compiler == "bcb")
494 makefile = ".\\Makefile.bcb";
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +0000495fso.CopyFile(makefile, ".\\Makefile", true);
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000496WScript.Echo("Created Makefile.");
Igor Zlatkovic1bab92d2003-08-28 10:24:40 +0000497// Create the config.h.
498var confighsrc = "..\\include\\win32config.h";
499var configh = "..\\config.h";
500fso.CopyFile(confighsrc, configh, true);
501WScript.Echo("Created config.h.");
502
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000503
504// Display the final configuration.
505var txtOut = "\nXML processor configuration\n";
506txtOut += "---------------------------\n";
507txtOut += " Trio: " + boolToStr(withTrio) + "\n";
Igor Zlatkovic8f536a82002-10-31 16:01:00 +0000508txtOut += " Thread safety: " + withThreads + "\n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000509txtOut += " FTP client: " + boolToStr(withFtp) + "\n";
510txtOut += " HTTP client: " + boolToStr(withHttp) + "\n";
511txtOut += " HTML processor: " + boolToStr(withHtml) + "\n";
512txtOut += " C14N support: " + boolToStr(withC14n) + "\n";
513txtOut += " Catalog support: " + boolToStr(withCatalog) + "\n";
514txtOut += " DocBook support: " + boolToStr(withDocb) + "\n";
515txtOut += " XPath support: " + boolToStr(withXpath) + "\n";
516txtOut += " XPointer support: " + boolToStr(withXptr) + "\n";
517txtOut += " XInclude support: " + boolToStr(withXinclude) + "\n";
Igor Zlatkovic3acadf42002-09-20 16:40:17 +0000518txtOut += " iconv support: " + boolToStr(withIconv) + "\n";
William M. Brack6d13f332003-08-08 16:40:36 +0000519txtOut += " iso8859x support: " + boolToStr(withIso8859x) + "\n";
Igor Zlatkovic3acadf42002-09-20 16:40:17 +0000520txtOut += " zlib support: " + boolToStr(withZlib) + "\n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000521txtOut += " Debugging module: " + boolToStr(withDebug) + "\n";
522txtOut += " Memory debugging: " + boolToStr(withMemDebug) + "\n";
Igor Zlatkovic8e040972002-09-20 13:39:53 +0000523txtOut += " Regexp support: " + boolToStr(withRegExps) + "\n";
Igor Zlatkovica6f2d902002-04-16 17:57:17 +0000524txtOut += "XML Schema support: " + boolToStr(withSchemas) + "\n";
Igor Zlatkovic853514f2002-11-22 21:41:09 +0000525txtOut += " Python bindings: " + boolToStr(withPython) + "\n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000526txtOut += "\n";
527txtOut += "Win32 build configuration\n";
528txtOut += "-------------------------\n";
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +0000529txtOut += " Compiler: " + compiler + "\n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000530txtOut += " Debug symbols: " + boolToStr(buildDebug) + "\n";
531txtOut += " Static xmllint: " + boolToStr(buildStatic) + "\n";
532txtOut += " Install prefix: " + buildPrefix + "\n";
533txtOut += " Put tools in: " + buildBinPrefix + "\n";
534txtOut += " Put headers in: " + buildIncPrefix + "\n";
535txtOut += "Put static libs in: " + buildLibPrefix + "\n";
536txtOut += "Put shared libs in: " + buildSoPrefix + "\n";
537txtOut += " Include path: " + buildInclude + "\n";
538txtOut += " Lib path: " + buildLib + "\n";
539WScript.Echo(txtOut);
540
William M. Brack6d13f332003-08-08 16:40:36 +0000541//
542