Annotation of embedaddon/libxml2/win32/configure.js, revision 1.1.1.2

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>