1 | /* Configure script for libxslt, specific for Windows with Scripting Host.
|
---|
2 | *
|
---|
3 | * This script will configure the libxslt 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 <[email protected]>
|
---|
8 | */
|
---|
9 |
|
---|
10 | /* The source directory, relative to the one where this file resides. */
|
---|
11 | var baseDir = "..";
|
---|
12 | var srcDirXslt = baseDir + "\\libxslt";
|
---|
13 | var srcDirExslt = baseDir + "\\libexslt";
|
---|
14 | var srcDirUtils = baseDir + "\\xsltproc";
|
---|
15 | /* The directory where we put the binaries after compilation. */
|
---|
16 | var binDir = "binaries";
|
---|
17 | /* Base name of what we are building. */
|
---|
18 | var baseNameXslt = "libxslt";
|
---|
19 | var baseNameExslt = "libexslt";
|
---|
20 | /* Configure file which contains the version and the output file where
|
---|
21 | we can store our build configuration. */
|
---|
22 | var configFile = baseDir + "\\configure.in";
|
---|
23 | var versionFile = ".\\config.msvc";
|
---|
24 | /* Input and output files regarding the lib(e)xml features. The second
|
---|
25 | output file is there for the compatibility reasons, otherwise it
|
---|
26 | is identical to the first. */
|
---|
27 | var optsFileInXslt = srcDirXslt + "\\xsltconfig.h.in";
|
---|
28 | var optsFileXslt = srcDirXslt + "\\xsltconfig.h";
|
---|
29 | var optsFileInExslt = srcDirExslt + "\\exsltconfig.h.in";
|
---|
30 | var optsFileExslt = srcDirExslt + "\\exsltconfig.h";
|
---|
31 | /* Version strings for the binary distribution. Will be filled later
|
---|
32 | in the code. */
|
---|
33 | var verMajorXslt;
|
---|
34 | var verMinorXslt;
|
---|
35 | var verMicroXslt;
|
---|
36 | var verMajorExslt;
|
---|
37 | var verMinorExslt;
|
---|
38 | var verMicroExslt;
|
---|
39 | var verCvs;
|
---|
40 | var useCvsVer = true;
|
---|
41 | /* Libxslt features. */
|
---|
42 | var withTrio = false;
|
---|
43 | var withXsltDebug = true;
|
---|
44 | var withMemDebug = false;
|
---|
45 | var withDebugger = true;
|
---|
46 | var withIconv = true;
|
---|
47 | var withZlib = false;
|
---|
48 | var withCrypto = true;
|
---|
49 | var withModules = false;
|
---|
50 | /* Win32 build options. */
|
---|
51 | var dirSep = "\\";
|
---|
52 | var compiler = "msvc";
|
---|
53 | var cruntime = "/MD";
|
---|
54 | var vcmanifest = false;
|
---|
55 | var buildDebug = 0;
|
---|
56 | var buildStatic = 0;
|
---|
57 | var buildPrefix = ".";
|
---|
58 | var buildBinPrefix = "";
|
---|
59 | var buildIncPrefix = "";
|
---|
60 | var buildLibPrefix = "";
|
---|
61 | var buildSoPrefix = "";
|
---|
62 | var buildInclude = ".";
|
---|
63 | var buildLib = ".";
|
---|
64 | /* Local stuff */
|
---|
65 | var error = 0;
|
---|
66 |
|
---|
67 | /* Helper function, transforms the option variable into the 'Enabled'
|
---|
68 | or 'Disabled' string. */
|
---|
69 | function boolToStr(opt)
|
---|
70 | {
|
---|
71 | if (opt == false)
|
---|
72 | return "no";
|
---|
73 | else if (opt == true)
|
---|
74 | return "yes";
|
---|
75 | error = 1;
|
---|
76 | return "*** undefined ***";
|
---|
77 | }
|
---|
78 |
|
---|
79 | /* Helper function, transforms the argument string into the boolean
|
---|
80 | value. */
|
---|
81 | function strToBool(opt)
|
---|
82 | {
|
---|
83 | if (opt == "0" || opt == "no")
|
---|
84 | return false;
|
---|
85 | else if (opt == "1" || opt == "yes")
|
---|
86 | return true;
|
---|
87 | error = 1;
|
---|
88 | return false;
|
---|
89 | }
|
---|
90 |
|
---|
91 | /* Displays the details about how to use this script. */
|
---|
92 | function usage()
|
---|
93 | {
|
---|
94 | var txt;
|
---|
95 | txt = "Usage:\n";
|
---|
96 | txt += " cscript " + WScript.ScriptName + " <options>\n";
|
---|
97 | txt += " cscript " + WScript.ScriptName + " help\n\n";
|
---|
98 | txt += "Options can be specified in the form <option>=<value>, where the value is\n";
|
---|
99 | txt += "either 'yes' or 'no'.\n\n";
|
---|
100 | txt += "XSLT processor options, default value given in parentheses:\n\n";
|
---|
101 | txt += " trio: Enable TRIO string manipulator (" + (withTrio? "yes" : "no") + ")\n";
|
---|
102 | txt += " xslt_debug: Enable XSLT debbugging module (" + (withXsltDebug? "yes" : "no") + ")\n";
|
---|
103 | txt += " mem_debug: Enable memory debugger (" + (withMemDebug? "yes" : "no") + ")\n";
|
---|
104 | txt += " debugger: Enable external debugger support (" + (withDebugger? "yes" : "no") + ")\n";
|
---|
105 | txt += " iconv: Use iconv library (" + (withIconv? "yes" : "no") + ")\n";
|
---|
106 | txt += " zlib: Use zlib library (" + (withZlib? "yes" : "no") + ")\n";
|
---|
107 | txt += " crypto: Enable Crypto support (" + (withCrypto? "yes" : "no") + ")\n";
|
---|
108 | txt += " modules: Enable Module support (" + (withModules? "yes" : "no") + ")\n";
|
---|
109 | txt += "\nWin32 build options, default value given in parentheses:\n\n";
|
---|
110 | txt += " compiler: Compiler to be used [msvc|mingw] (" + compiler + ")\n";
|
---|
111 | txt += " cruntime: C-runtime compiler option (only msvc) (" + cruntime + ")\n";
|
---|
112 | txt += " vcmanifest: Embed VC manifest (only msvc) (" + (vcmanifest? "yes" : "no") + ")\n";
|
---|
113 | txt += " debug: Build unoptimised debug executables (" + (buildDebug? "yes" : "no") + ")\n";
|
---|
114 | txt += " static: Link xsltproc statically to libxslt (" + (buildStatic? "yes" : "no") + ")\n";
|
---|
115 | txt += " Note: automatically enabled if cruntime is not /MD or /MDd\n";
|
---|
116 | txt += " prefix: Base directory for the installation (" + buildPrefix + ")\n";
|
---|
117 | txt += " bindir: Directory where xsltproc and friends should be installed\n";
|
---|
118 | txt += " (" + buildBinPrefix + ")\n";
|
---|
119 | txt += " incdir: Directory where headers should be installed\n";
|
---|
120 | txt += " (" + buildIncPrefix + ")\n";
|
---|
121 | txt += " libdir: Directory where static and import libraries should be\n";
|
---|
122 | txt += " installed (" + buildLibPrefix + ")\n";
|
---|
123 | txt += " sodir: Directory where shared libraries should be installed\n";
|
---|
124 | txt += " (" + buildSoPrefix + ")\n";
|
---|
125 | txt += " include: Additional search path for the compiler, particularily\n";
|
---|
126 | txt += " where libxml headers can be found (" + buildInclude + ")\n";
|
---|
127 | txt += " lib: Additional search path for the linker, particularily\n";
|
---|
128 | txt += " where libxml library can be found (" + buildLib + ")\n";
|
---|
129 | WScript.Echo(txt);
|
---|
130 | }
|
---|
131 |
|
---|
132 | /* Discovers the version we are working with by reading the apropriate
|
---|
133 | configuration file. Despite its name, this also writes the configuration
|
---|
134 | file included by our makefile. */
|
---|
135 | function discoverVersion()
|
---|
136 | {
|
---|
137 | var fso, cf, vf, ln, s;
|
---|
138 | fso = new ActiveXObject("Scripting.FileSystemObject");
|
---|
139 | verCvs = "";
|
---|
140 | if (useCvsVer && fso.FileExists("..\\CVS\\Entries")) {
|
---|
141 | cf = fso.OpenTextFile("..\\CVS\\Entries", 1);
|
---|
142 | while (cf.AtEndOfStream != true) {
|
---|
143 | ln = cf.ReadLine();
|
---|
144 | s = new String(ln);
|
---|
145 | if (s.search(/^\/ChangeLog\//) != -1) {
|
---|
146 | iDot = s.indexOf(".");
|
---|
147 | iSlash = s.indexOf("/", iDot);
|
---|
148 | verCvs = "CVS" + s.substring(iDot + 1, iSlash);
|
---|
149 | break;
|
---|
150 | }
|
---|
151 | }
|
---|
152 | cf.Close();
|
---|
153 | }
|
---|
154 | cf = fso.OpenTextFile(configFile, 1);
|
---|
155 | if (compiler == "msvc")
|
---|
156 | versionFile = ".\\config.msvc";
|
---|
157 | else if (compiler == "mingw")
|
---|
158 | versionFile = ".\\config.mingw";
|
---|
159 | vf = fso.CreateTextFile(versionFile, true);
|
---|
160 | vf.WriteLine("# " + versionFile);
|
---|
161 | vf.WriteLine("# This file is generated automatically by " + WScript.ScriptName + ".");
|
---|
162 | vf.WriteBlankLines(1);
|
---|
163 | while (cf.AtEndOfStream != true) {
|
---|
164 | ln = cf.ReadLine();
|
---|
165 | s = new String(ln);
|
---|
166 | if (s.search(/^LIBXSLT_MAJOR_VERSION=/) != -1) {
|
---|
167 | vf.WriteLine(s);
|
---|
168 | verMajorXslt = s.substring(s.indexOf("=") + 1, s.length)
|
---|
169 | } else if(s.search(/^LIBXSLT_MINOR_VERSION=/) != -1) {
|
---|
170 | vf.WriteLine(s);
|
---|
171 | verMinorXslt = s.substring(s.indexOf("=") + 1, s.length)
|
---|
172 | } else if(s.search(/^LIBXSLT_MICRO_VERSION=/) != -1) {
|
---|
173 | vf.WriteLine(s);
|
---|
174 | verMicroXslt = s.substring(s.indexOf("=") + 1, s.length)
|
---|
175 | } else if (s.search(/^LIBEXSLT_MAJOR_VERSION=/) != -1) {
|
---|
176 | vf.WriteLine(s);
|
---|
177 | verMajorExslt = s.substring(s.indexOf("=") + 1, s.length)
|
---|
178 | } else if(s.search(/^LIBEXSLT_MINOR_VERSION=/) != -1) {
|
---|
179 | vf.WriteLine(s);
|
---|
180 | verMinorExslt = s.substring(s.indexOf("=") + 1, s.length)
|
---|
181 | } else if(s.search(/^LIBEXSLT_MICRO_VERSION=/) != -1) {
|
---|
182 | vf.WriteLine(s);
|
---|
183 | verMicroExslt = s.substring(s.indexOf("=") + 1, s.length)
|
---|
184 | }
|
---|
185 | }
|
---|
186 | cf.Close();
|
---|
187 | vf.WriteLine("WITH_TRIO=" + (withTrio? "1" : "0"));
|
---|
188 | vf.WriteLine("WITH_DEBUG=" + (withXsltDebug? "1" : "0"));
|
---|
189 | vf.WriteLine("WITH_MEM_DEBUG=" + (withMemDebug? "1" : "0"));
|
---|
190 | vf.WriteLine("WITH_DEBUGGER=" + (withDebugger? "1" : "0"));
|
---|
191 | vf.WriteLine("WITH_ICONV=" + (withIconv? "1" : "0"));
|
---|
192 | vf.WriteLine("WITH_ZLIB=" + (withZlib? "1" : "0"));
|
---|
193 | vf.WriteLine("WITH_CRYPTO=" + (withCrypto? "1" : "0"));
|
---|
194 | vf.WriteLine("WITH_MODULES=" + (withModules? "1" : "0"));
|
---|
195 | 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);
|
---|
202 | if (compiler == "msvc") {
|
---|
203 | vf.WriteLine("INCLUDE=$(INCLUDE);" + buildInclude);
|
---|
204 | vf.WriteLine("LIB=$(LIB);" + buildLib);
|
---|
205 | vf.WriteLine("CRUNTIME=" + cruntime);
|
---|
206 | vf.WriteLine("VCMANIFEST=" + (vcmanifest? "1" : "0"));
|
---|
207 | } else if (compiler == "mingw") {
|
---|
208 | vf.WriteLine("INCLUDE+=;" + buildInclude);
|
---|
209 | vf.WriteLine("LIB+=;" + buildLib);
|
---|
210 | }
|
---|
211 | vf.Close();
|
---|
212 | }
|
---|
213 |
|
---|
214 | /* Configures libxslt. This one will generate xsltconfig.h from xsltconfig.h.in
|
---|
215 | taking what the user passed on the command line into account. */
|
---|
216 | function configureXslt()
|
---|
217 | {
|
---|
218 | var fso, ofi, of, ln, s;
|
---|
219 | fso = new ActiveXObject("Scripting.FileSystemObject");
|
---|
220 | ofi = fso.OpenTextFile(optsFileInXslt, 1);
|
---|
221 | of = fso.CreateTextFile(optsFileXslt, true);
|
---|
222 | while (ofi.AtEndOfStream != true) {
|
---|
223 | ln = ofi.ReadLine();
|
---|
224 | s = new String(ln);
|
---|
225 | if (s.search(/\@VERSION\@/) != -1) {
|
---|
226 | of.WriteLine(s.replace(/\@VERSION\@/,
|
---|
227 | verMajorXslt + "." + verMinorXslt + "." + verMicroXslt));
|
---|
228 | } else if (s.search(/\@LIBXSLT_VERSION_NUMBER\@/) != -1) {
|
---|
229 | of.WriteLine(s.replace(/\@LIBXSLT_VERSION_NUMBER\@/,
|
---|
230 | verMajorXslt*10000 + verMinorXslt*100 + verMicroXslt*1));
|
---|
231 | } else if (s.search(/\@LIBXSLT_VERSION_EXTRA\@/) != -1) {
|
---|
232 | of.WriteLine(s.replace(/\@LIBXSLT_VERSION_EXTRA\@/, verCvs));
|
---|
233 | } else if (s.search(/\@WITH_TRIO\@/) != -1) {
|
---|
234 | of.WriteLine(s.replace(/\@WITH_TRIO\@/, withTrio? "1" : "0"));
|
---|
235 | } else if (s.search(/\@WITH_XSLT_DEBUG\@/) != -1) {
|
---|
236 | of.WriteLine(s.replace(/\@WITH_XSLT_DEBUG\@/, withXsltDebug? "1" : "0"));
|
---|
237 | } else if (s.search(/\@WITH_MEM_DEBUG\@/) != -1) {
|
---|
238 | of.WriteLine(s.replace(/\@WITH_MEM_DEBUG\@/, withMemDebug? "1" : "0"));
|
---|
239 | } else if (s.search(/\@WITH_DEBUGGER\@/) != -1) {
|
---|
240 | of.WriteLine(s.replace(/\@WITH_DEBUGGER\@/, withDebugger? "1" : "0"));
|
---|
241 | } else if (s.search(/\@WITH_MODULES\@/) != -1) {
|
---|
242 | of.WriteLine(s.replace(/\@WITH_MODULES\@/, withModules? "1" : "0"));
|
---|
243 | } else if (s.search(/\@LIBXSLT_DEFAULT_PLUGINS_PATH\@/) != -1) {
|
---|
244 | of.WriteLine(s.replace(/\@LIBXSLT_DEFAULT_PLUGINS_PATH\@/, "NULL"));
|
---|
245 | } else
|
---|
246 | of.WriteLine(ln);
|
---|
247 | }
|
---|
248 | ofi.Close();
|
---|
249 | of.Close();
|
---|
250 | }
|
---|
251 |
|
---|
252 | /* Configures libexslt. This one will generate exsltconfig.h from exsltconfig.h.in
|
---|
253 | taking what the user passed on the command line into account. */
|
---|
254 | function configureExslt()
|
---|
255 | {
|
---|
256 | var fso, ofi, of, ln, s;
|
---|
257 | fso = new ActiveXObject("Scripting.FileSystemObject");
|
---|
258 | ofi = fso.OpenTextFile(optsFileInExslt, 1);
|
---|
259 | of = fso.CreateTextFile(optsFileExslt, true);
|
---|
260 | while (ofi.AtEndOfStream != true) {
|
---|
261 | ln = ofi.ReadLine();
|
---|
262 | s = new String(ln);
|
---|
263 | if (s.search(/\@VERSION\@/) != -1) {
|
---|
264 | of.WriteLine(s.replace(/\@VERSION\@/,
|
---|
265 | verMajorExslt + "." + verMinorExslt + "." + verMicroExslt));
|
---|
266 | } else if (s.search(/\@LIBEXSLT_VERSION_NUMBER\@/) != -1) {
|
---|
267 | of.WriteLine(s.replace(/\@LIBEXSLT_VERSION_NUMBER\@/,
|
---|
268 | verMajorExslt*10000 + verMinorExslt*100 + verMicroExslt*1));
|
---|
269 | } else if (s.search(/\@LIBEXSLT_VERSION_EXTRA\@/) != -1) {
|
---|
270 | of.WriteLine(s.replace(/\@LIBEXSLT_VERSION_EXTRA\@/, verCvs));
|
---|
271 | } else if (s.search(/\@WITH_CRYPTO\@/) != -1) {
|
---|
272 | of.WriteLine(s.replace(/\@WITH_CRYPTO\@/, withCrypto? "1" : "0"));
|
---|
273 | } else if (s.search(/\@WITH_MODULES\@/) != -1) {
|
---|
274 | of.WriteLine(s.replace(/\@WITH_MODULES\@/, withModules? "1" : "0"));
|
---|
275 | } else
|
---|
276 | of.WriteLine(ln);
|
---|
277 | }
|
---|
278 | ofi.Close();
|
---|
279 | of.Close();
|
---|
280 | }
|
---|
281 |
|
---|
282 | /* Creates the readme file for the binary distribution of 'bname', for the
|
---|
283 | version 'ver' in the file 'file'. This one is called from the Makefile when
|
---|
284 | generating a binary distribution. The parameters are passed by make. */
|
---|
285 | function genReadme(bname, ver, file)
|
---|
286 | {
|
---|
287 | var fso, f;
|
---|
288 | fso = new ActiveXObject("Scripting.FileSystemObject");
|
---|
289 | f = fso.CreateTextFile(file, true);
|
---|
290 | f.WriteLine(" " + bname + " " + ver);
|
---|
291 | f.WriteLine(" --------------");
|
---|
292 | f.WriteBlankLines(1);
|
---|
293 | f.WriteLine(" This is " + bname + ", version " + ver + ", binary package for the native Win32/IA32");
|
---|
294 | f.WriteLine("platform.");
|
---|
295 | f.WriteBlankLines(1);
|
---|
296 | f.WriteLine(" The files in this package do not require any special installation");
|
---|
297 | f.WriteLine("steps. Extract the contents of the archive whereever you wish and");
|
---|
298 | f.WriteLine("make sure that your tools which use " + bname + " can find it.");
|
---|
299 | f.WriteBlankLines(1);
|
---|
300 | f.WriteLine(" For example, if you want to run the supplied utilities from the command");
|
---|
301 | f.WriteLine("line, you can, if you wish, add the 'bin' subdirectory to the PATH");
|
---|
302 | f.WriteLine("environment variable.");
|
---|
303 | f.WriteLine(" If you want to make programmes in C which use " + bname + ", you'll");
|
---|
304 | f.WriteLine("likely know how to use the contents of this package. If you don't, please");
|
---|
305 | f.WriteLine("refer to your compiler's documentation.");
|
---|
306 | f.WriteBlankLines(1);
|
---|
307 | f.WriteLine(" If there is something you cannot keep for yourself, such as a problem,");
|
---|
308 | f.WriteLine("a cheer of joy, a comment or a suggestion, feel free to contact me using");
|
---|
309 | f.WriteLine("the address below.");
|
---|
310 | f.WriteBlankLines(1);
|
---|
311 | f.WriteLine(" Igor Zlatkovic ([email protected])");
|
---|
312 | f.Close();
|
---|
313 | }
|
---|
314 |
|
---|
315 | /*
|
---|
316 | * main(),
|
---|
317 | * Execution begins here.
|
---|
318 | */
|
---|
319 |
|
---|
320 | /* Parse the command-line arguments. */
|
---|
321 | for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) {
|
---|
322 | var arg, opt;
|
---|
323 | arg = WScript.Arguments(i);
|
---|
324 | opt = arg.substring(0, arg.indexOf("="));
|
---|
325 | if (opt.length == 0)
|
---|
326 | opt = arg.substring(0, arg.indexOf(":"));
|
---|
327 | if (opt.length > 0) {
|
---|
328 | if (opt == "xslt_debug")
|
---|
329 | withXsltDebug = strToBool(arg.substring(opt.length + 1, arg.length));
|
---|
330 | else if (opt == "trio")
|
---|
331 | withTrio = strToBool(arg.substring(opt.length + 1, arg.length));
|
---|
332 | else if (opt == "mem_debug")
|
---|
333 | withMemDebug = strToBool(arg.substring(opt.length + 1, arg.length));
|
---|
334 | else if (opt == "debugger")
|
---|
335 | withDebugger = strToBool(arg.substring(opt.length + 1, arg.length));
|
---|
336 | else if (opt == "debug")
|
---|
337 | buildDebug = strToBool(arg.substring(opt.length + 1, arg.length));
|
---|
338 | else if (opt == "iconv")
|
---|
339 | withIconv = strToBool(arg.substring(opt.length + 1, arg.length));
|
---|
340 | else if (opt == "zlib")
|
---|
341 | withZlib = strToBool(arg.substring(opt.length + 1, arg.length));
|
---|
342 | else if (opt == "crypto")
|
---|
343 | withCrypto = strToBool(arg.substring(opt.length + 1, arg.length));
|
---|
344 | else if (opt == "modules")
|
---|
345 | withModules = strToBool(arg.substring(opt.length + 1, arg.length));
|
---|
346 | else if (opt == "compiler")
|
---|
347 | compiler = arg.substring(opt.length + 1, arg.length);
|
---|
348 | else if (opt == "cruntime")
|
---|
349 | cruntime = arg.substring(opt.length + 1, arg.length);
|
---|
350 | else if (opt == "vcmanifest")
|
---|
351 | vcmanifest = strToBool(arg.substring(opt.length + 1, arg.length));
|
---|
352 | else if (opt == "static")
|
---|
353 | buildStatic = strToBool(arg.substring(opt.length + 1, arg.length));
|
---|
354 | else if (opt == "prefix")
|
---|
355 | buildPrefix = arg.substring(opt.length + 1, arg.length);
|
---|
356 | else if (opt == "incdir")
|
---|
357 | buildIncPrefix = arg.substring(opt.length + 1, arg.length);
|
---|
358 | else if (opt == "bindir")
|
---|
359 | buildBinPrefix = arg.substring(opt.length + 1, arg.length);
|
---|
360 | else if (opt == "libdir")
|
---|
361 | buildLibPrefix = arg.substring(opt.length + 1, arg.length);
|
---|
362 | else if (opt == "sodir")
|
---|
363 | buildSoPrefix = arg.substring(opt.length + 1, arg.length);
|
---|
364 | else if (opt == "incdir")
|
---|
365 | buildIncPrefix = arg.substring(opt.length + 1, arg.length);
|
---|
366 | else if (opt == "include")
|
---|
367 | buildInclude = arg.substring(opt.length + 1, arg.length);
|
---|
368 | else if (opt == "lib")
|
---|
369 | buildLib = arg.substring(opt.length + 1, arg.length);
|
---|
370 | else if (opt == "release")
|
---|
371 | useCvsVer = false;
|
---|
372 | else
|
---|
373 | error = 1;
|
---|
374 | } else if (i == 0) {
|
---|
375 | if (arg == "genreadme") {
|
---|
376 | // This command comes from the Makefile and will not be checked
|
---|
377 | // for errors, because Makefile will always supply right parameters.
|
---|
378 | genReadme(WScript.Arguments(1), WScript.Arguments(2), WScript.Arguments(3));
|
---|
379 | WScript.Quit(0);
|
---|
380 | } else if (arg == "help") {
|
---|
381 | usage();
|
---|
382 | WScript.Quit(0);
|
---|
383 | }
|
---|
384 | } else
|
---|
385 | error = 1;
|
---|
386 | }
|
---|
387 | // If we have an error here, it is because the user supplied bad parameters.
|
---|
388 | if (error != 0) {
|
---|
389 | usage();
|
---|
390 | WScript.Quit(error);
|
---|
391 | }
|
---|
392 |
|
---|
393 | // if user choses to link the c-runtime library statically into libxslt
|
---|
394 | // with /MT and friends, then we need to enable static linking for xsltproc
|
---|
395 | if (cruntime == "/MT" || cruntime == "/MTd" ||
|
---|
396 | cruntime == "/ML" || cruntime == "/MLd") {
|
---|
397 | buildStatic = 1;
|
---|
398 | }
|
---|
399 |
|
---|
400 | if (buildStatic == 1 && withModules == 1) {
|
---|
401 | WScript.Echo("Warning: Disabling plugin support.");
|
---|
402 | WScript.Echo("");
|
---|
403 | WScript.Echo("Modules cannot be enabled when a statically linked cruntime has");
|
---|
404 | WScript.Echo("been selected, or when xsltproc.exe is linked statically to libxslt.");
|
---|
405 | WScript.Echo("");
|
---|
406 | withModules=0;
|
---|
407 | }
|
---|
408 |
|
---|
409 | dirSep = "\\";
|
---|
410 | //if (compiler == "mingw")
|
---|
411 | // dirSep = "/";
|
---|
412 | if (buildBinPrefix == "")
|
---|
413 | buildBinPrefix = "$(PREFIX)" + dirSep + "bin";
|
---|
414 | if (buildIncPrefix == "")
|
---|
415 | buildIncPrefix = "$(PREFIX)" + dirSep + "include";
|
---|
416 | if (buildLibPrefix == "")
|
---|
417 | buildLibPrefix = "$(PREFIX)" + dirSep + "lib";
|
---|
418 | if (buildSoPrefix == "")
|
---|
419 | buildSoPrefix = "$(PREFIX)" + dirSep + "lib";
|
---|
420 |
|
---|
421 | // Discover the version.
|
---|
422 | discoverVersion();
|
---|
423 | if (error != 0) {
|
---|
424 | WScript.Echo("Version discovery failed, aborting.");
|
---|
425 | WScript.Quit(error);
|
---|
426 | }
|
---|
427 |
|
---|
428 | var outVerString = baseNameXslt + " version: " + verMajorXslt + "." + verMinorXslt + "." + verMicroXslt;
|
---|
429 | if (verCvs && verCvs != "")
|
---|
430 | outVerString += "-" + verCvs;
|
---|
431 | WScript.Echo(outVerString);
|
---|
432 | outVerString = baseNameExslt + " version: " + verMajorExslt + "." + verMinorExslt + "." + verMicroExslt;
|
---|
433 | if (verCvs && verCvs != "")
|
---|
434 | outVerString += "-" + verCvs;
|
---|
435 | WScript.Echo(outVerString);
|
---|
436 |
|
---|
437 | // Configure libxslt.
|
---|
438 | configureXslt();
|
---|
439 | if (error != 0) {
|
---|
440 | WScript.Echo("Configuration failed, aborting.");
|
---|
441 | WScript.Quit(error);
|
---|
442 | }
|
---|
443 |
|
---|
444 | // Configure libexslt.
|
---|
445 | configureExslt();
|
---|
446 | if (error != 0) {
|
---|
447 | WScript.Echo("Configuration failed, aborting.");
|
---|
448 | WScript.Quit(error);
|
---|
449 | }
|
---|
450 |
|
---|
451 | // Create the Makefile.
|
---|
452 | var fso = new ActiveXObject("Scripting.FileSystemObject");
|
---|
453 | var makefile = ".\\Makefile.msvc";
|
---|
454 | if (compiler == "mingw")
|
---|
455 | makefile = ".\\Makefile.mingw";
|
---|
456 | fso.CopyFile(makefile, ".\\Makefile", true);
|
---|
457 | WScript.Echo("Created Makefile.");
|
---|
458 | // Create the config.h.
|
---|
459 | var confighsrc = "..\\libxslt\\win32config.h";
|
---|
460 | var configh = "..\\config.h";
|
---|
461 | var f = fso.FileExists(configh);
|
---|
462 | if (f) {
|
---|
463 | var t = fso.GetFile(configh);
|
---|
464 | t.Attributes =0;
|
---|
465 | }
|
---|
466 | fso.CopyFile(confighsrc, configh, true);
|
---|
467 | WScript.Echo("Created config.h.");
|
---|
468 |
|
---|
469 | // Display the final configuration.
|
---|
470 | var txtOut = "\nXSLT processor configuration\n";
|
---|
471 | txtOut += "----------------------------\n";
|
---|
472 | txtOut += " Trio: " + boolToStr(withTrio) + "\n";
|
---|
473 | txtOut += " Debugging module: " + boolToStr(withXsltDebug) + "\n";
|
---|
474 | txtOut += " Memory debugging: " + boolToStr(withMemDebug) + "\n";
|
---|
475 | txtOut += " Debugger support: " + boolToStr(withDebugger) + "\n";
|
---|
476 | txtOut += " Use iconv: " + boolToStr(withIconv) + "\n";
|
---|
477 | txtOut += " With zlib: " + boolToStr(withZlib) + "\n";
|
---|
478 | txtOut += " Crypto: " + boolToStr(withCrypto) + "\n";
|
---|
479 | txtOut += " Modules: " + boolToStr(withModules) + "\n";
|
---|
480 | txtOut += "\n";
|
---|
481 | txtOut += "Win32 build configuration\n";
|
---|
482 | txtOut += "-------------------------\n";
|
---|
483 | txtOut += " Compiler: " + compiler + "\n";
|
---|
484 | if (compiler == "msvc")
|
---|
485 | txtOut += " C-Runtime option: " + cruntime + "\n";
|
---|
486 | txtOut += " Embed Manifest: " + boolToStr(vcmanifest) + "\n";
|
---|
487 | txtOut += " Debug symbols: " + boolToStr(buildDebug) + "\n";
|
---|
488 | txtOut += " Static xsltproc: " + boolToStr(buildStatic) + "\n";
|
---|
489 | txtOut += " Install prefix: " + buildPrefix + "\n";
|
---|
490 | txtOut += " Put tools in: " + buildBinPrefix + "\n";
|
---|
491 | txtOut += " Put headers in: " + buildIncPrefix + "\n";
|
---|
492 | txtOut += "Put static libs in: " + buildLibPrefix + "\n";
|
---|
493 | txtOut += "Put shared libs in: " + buildSoPrefix + "\n";
|
---|
494 | txtOut += " Include path: " + buildInclude + "\n";
|
---|
495 | txtOut += " Lib path: " + buildLib + "\n";
|
---|
496 | WScript.Echo(txtOut);
|
---|
497 |
|
---|
498 | // Done.
|
---|