📄 configure.js
字号:
/* Configure script for libxml, specific for Windows with Scripting Host. * * This script will configure the libxml build process and create necessary files. * Run it with an 'help', or an invalid option and it will tell you what options * it accepts. * * March 2002, Igor Zlatkovic <igor@zlatkovic.com> *//* The source directory, relative to the one where this file resides. */var srcDirXml = "..";var srcDirUtils = "..";/* Base name of what we are building. */var baseName = "libxml2";/* Configure file which contains the version and the output file where we can store our build configuration. */var configFile = srcDirXml + "\\configure.in";var versionFile = ".\\config.msvc";/* Input and output files regarding the libxml features. */var optsFileIn = srcDirXml + "\\include\\libxml\\xmlversion.h.in";var optsFile = srcDirXml + "\\include\\libxml\\xmlversion.h";/* Version strings for the binary distribution. Will be filled later in the code. */var verMajor;var verMinor;var verMicro;var verMicroSuffix;var verCvs;var useCvsVer = true;/* Libxml features. */var withTrio = false;var withThreads = "native";var withFtp = true;var withHttp = true;var withHtml = true;var withC14n = true;var withCatalog = true;var withDocb = true;var withXpath = true;var withXptr = true;var withXinclude = true;var withIconv = true;var withIso8859x = false;var withZlib = false;var withDebug = true;var withMemDebug = false;var withSchemas = true;var withRegExps = true;var withModules = true;var withTree = true;var withReader = true;var withWriter = true;var withWalker = true;var withPattern = true;var withPush = true;var withValid = true;var withSax1 = true;var withLegacy = true;var withOutput = true;var withPython = false;/* Win32 build options. */var dirSep = "\\";var compiler = "msvc";var cruntime = "/MD";var dynruntime = true;var buildDebug = 0;var buildStatic = 0;var buildPrefix = ".";var buildBinPrefix = "";var buildIncPrefix = "";var buildLibPrefix = "";var buildSoPrefix = "";var buildInclude = ".";var buildLib = ".";/* Local stuff */var error = 0;/* Helper function, transforms the option variable into the 'Enabled' or 'Disabled' string. */function boolToStr(opt){ if (opt == false) return "no"; else if (opt == true) return "yes"; error = 1; return "*** undefined ***";}/* Helper function, transforms the argument string into a boolean value. */function strToBool(opt){ if (opt == 0 || opt == "no") return false; else if (opt == 1 || opt == "yes") return true; error = 1; return false;}/* Displays the details about how to use this script. */function usage(){ var txt; txt = "Usage:\n"; txt += " cscript " + WScript.ScriptName + " <options>\n"; txt += " cscript " + WScript.ScriptName + " help\n\n"; txt += "Options can be specified in the form <option>=<value>, where the value is\n"; txt += "either 'yes' or 'no', if not stated otherwise.\n\n"; txt += "\nXML processor options, default value given in parentheses:\n\n"; txt += " trio: Enable TRIO string manipulator (" + (withTrio? "yes" : "no") + ")\n"; txt += " threads: Enable thread safety [no|ctls|native|posix] (" + (withThreads) + ") \n"; txt += " ftp: Enable FTP client (" + (withFtp? "yes" : "no") + ")\n"; txt += " http: Enable HTTP client (" + (withHttp? "yes" : "no") + ")\n"; txt += " html: Enable HTML processor (" + (withHtml? "yes" : "no") + ")\n"; txt += " c14n: Enable C14N support (" + (withC14n? "yes" : "no") + ")\n"; txt += " catalog: Enable catalog support (" + (withCatalog? "yes" : "no") + ")\n"; txt += " docb: Enable DocBook support (" + (withDocb? "yes" : "no") + ")\n"; txt += " xpath: Enable XPath support (" + (withXpath? "yes" : "no") + ")\n"; txt += " xptr: Enable XPointer support (" + (withXptr? "yes" : "no") + ")\n"; txt += " xinclude: Enable XInclude support (" + (withXinclude? "yes" : "no") + ")\n"; txt += " iconv: Enable iconv support (" + (withIconv? "yes" : "no") + ")\n"; txt += " iso8859x: Enable ISO8859X support (" + (withIso8859x? "yes" : "no") + ")\n"; txt += " zlib: Enable zlib support (" + (withZlib? "yes" : "no") + ")\n"; txt += " xml_debug: Enable XML debbugging module (" + (withDebug? "yes" : "no") + ")\n"; txt += " mem_debug: Enable memory debugger (" + (withMemDebug? "yes" : "no") + ")\n"; txt += " regexps: Enable regular expressions (" + (withRegExps? "yes" : "no") + ")\n"; txt += " modules: Enable module support (" + (withModules? "yes" : "no") + ")\n"; txt += " tree: Enable tree api (" + (withTree? "yes" : "no") + ")\n"; txt += " reader: Enable xmlReader api (" + (withReader? "yes" : "no") + ")\n"; txt += " writer: Enable xmlWriter api (" + (withWriter? "yes" : "no") + ")\n"; txt += " walker: Enable xmlDocWalker api (" + (withWalker? "yes" : "no") + ")\n"; txt += " pattern: Enable xmlPattern api (" + (withPattern? "yes" : "no") + ")\n"; txt += " push: Enable push api (" + (withPush? "yes" : "no") + ")\n"; txt += " valid: Enable DTD validation support (" + (withValid? "yes" : "no") + ")\n"; txt += " sax1: Enable SAX1 api (" + (withSax1? "yes" : "no") + ")\n"; txt += " legacy: Enable Deprecated api's (" + (withLegacy? "yes" : "no") + ")\n"; txt += " output: Enable serialization support (" + (withOutput? "yes" : "no") + ")\n"; txt += " schemas: Enable XML Schema support (" + (withSchemas? "yes" : "no") + ")\n"; txt += " python: Build Python bindings (" + (withPython? "yes" : "no") + ")\n"; txt += "\nWin32 build options, default value given in parentheses:\n\n"; txt += " compiler: Compiler to be used [msvc|mingw|bcb] (" + compiler + ")\n"; txt += " cruntime: C-runtime compiler option (only msvc) (" + cruntime + ")\n"; txt += " dynruntime: Use the dynamic RTL (only bcb) (" + dynruntime + ")\n"; txt += " debug: Build unoptimised debug executables (" + (buildDebug? "yes" : "no") + ")\n"; txt += " static: Link xmllint statically to libxml2 (" + (buildStatic? "yes" : "no") + ")\n"; txt += " Note: automatically enabled if cruntime is not /MD or /MDd\n"; txt += " prefix: Base directory for the installation (" + buildPrefix + ")\n"; txt += " bindir: Directory where xmllint and friends should be installed\n"; txt += " (" + buildBinPrefix + ")\n"; txt += " incdir: Directory where headers should be installed\n"; txt += " (" + buildIncPrefix + ")\n"; txt += " libdir: Directory where static and import libraries should be\n"; txt += " installed (" + buildLibPrefix + ")\n"; txt += " sodir: Directory where shared libraries should be installed\n"; txt += " (" + buildSoPrefix + ")\n"; txt += " include: Additional search path for the compiler, particularily\n"; txt += " where iconv headers can be found (" + buildInclude + ")\n"; txt += " lib: Additional search path for the linker, particularily\n"; txt += " where iconv library can be found (" + buildLib + ")\n"; WScript.Echo(txt);}/* Discovers the version we are working with by reading the apropriate configuration file. Despite its name, this also writes the configuration file included by our makefile. */function discoverVersion(){ var fso, cf, vf, ln, s, iDot, iSlash; fso = new ActiveXObject("Scripting.FileSystemObject"); verCvs = ""; if (useCvsVer && fso.FileExists("..\\CVS\\Entries")) { cf = fso.OpenTextFile("..\\CVS\\Entries", 1); while (cf.AtEndOfStream != true) { ln = cf.ReadLine(); s = new String(ln); if (s.search(/^\/ChangeLog\//) != -1) { iDot = s.indexOf("."); iSlash = s.indexOf("/", iDot); verCvs = "CVS" + s.substring(iDot + 1, iSlash); break; } } cf.Close(); } cf = fso.OpenTextFile(configFile, 1); if (compiler == "msvc") versionFile = ".\\config.msvc"; else if (compiler == "mingw") versionFile = ".\\config.mingw"; else if (compiler == "bcb") versionFile = ".\\config.bcb"; vf = fso.CreateTextFile(versionFile, true); vf.WriteLine("# " + versionFile); vf.WriteLine("# This file is generated automatically by " + WScript.ScriptName + "."); vf.WriteBlankLines(1); while (cf.AtEndOfStream != true) { ln = cf.ReadLine(); s = new String(ln); if (s.search(/^LIBXML_MAJOR_VERSION=/) != -1) { vf.WriteLine(s); verMajor = s.substring(s.indexOf("=") + 1, s.length) } else if(s.search(/^LIBXML_MINOR_VERSION=/) != -1) { vf.WriteLine(s); verMinor = s.substring(s.indexOf("=") + 1, s.length) } else if(s.search(/^LIBXML_MICRO_VERSION=/) != -1) { vf.WriteLine(s); verMicro = s.substring(s.indexOf("=") + 1, s.length) } else if(s.search(/^LIBXML_MICRO_VERSION_SUFFIX=/) != -1) { vf.WriteLine(s); verMicroSuffix = s.substring(s.indexOf("=") + 1, s.length) } } cf.Close(); vf.WriteLine("XML_SRCDIR=" + srcDirXml); vf.WriteLine("UTILS_SRCDIR=" + srcDirUtils); vf.WriteLine("WITH_TRIO=" + (withTrio? "1" : "0")); vf.WriteLine("WITH_THREADS=" + withThreads); vf.WriteLine("WITH_FTP=" + (withFtp? "1" : "0")); vf.WriteLine("WITH_HTTP=" + (withHttp? "1" : "0")); vf.WriteLine("WITH_HTML=" + (withHtml? "1" : "0")); vf.WriteLine("WITH_C14N=" + (withC14n? "1" : "0")); vf.WriteLine("WITH_CATALOG=" + (withCatalog? "1" : "0")); vf.WriteLine("WITH_DOCB=" + (withDocb? "1" : "0")); vf.WriteLine("WITH_XPATH=" + (withXpath? "1" : "0")); vf.WriteLine("WITH_XPTR=" + (withXptr? "1" : "0")); vf.WriteLine("WITH_XINCLUDE=" + (withXinclude? "1" : "0")); vf.WriteLine("WITH_ICONV=" + (withIconv? "1" : "0")); vf.WriteLine("WITH_ISO8859X=" + (withIso8859x? "1" : "0")); vf.WriteLine("WITH_ZLIB=" + (withZlib? "1" : "0")); vf.WriteLine("WITH_DEBUG=" + (withDebug? "1" : "0")); vf.WriteLine("WITH_MEM_DEBUG=" + (withMemDebug? "1" : "0")); vf.WriteLine("WITH_SCHEMAS=" + (withSchemas? "1" : "0")); vf.WriteLine("WITH_REGEXPS=" + (withRegExps? "1" : "0")); vf.WriteLine("WITH_MODULES=" + (withModules? "1" : "0")); vf.WriteLine("WITH_TREE=" + (withTree? "1" : "0")); vf.WriteLine("WITH_READER=" + (withReader? "1" : "0")); vf.WriteLine("WITH_WRITER=" + (withWriter? "1" : "0")); vf.WriteLine("WITH_WALKER=" + (withWalker? "1" : "0")); vf.WriteLine("WITH_PATTERN=" + (withPattern? "1" : "0")); vf.WriteLine("WITH_PUSH=" + (withPush? "1" : "0")); vf.WriteLine("WITH_VALID=" + (withValid? "1" : "0")); vf.WriteLine("WITH_SAX1=" + (withSax1? "1" : "0")); vf.WriteLine("WITH_LEGACY=" + (withLegacy? "1" : "0")); vf.WriteLine("WITH_OUTPUT=" + (withOutput? "1" : "0")); vf.WriteLine("WITH_PYTHON=" + (withPython? "1" : "0")); vf.WriteLine("DEBUG=" + (buildDebug? "1" : "0")); vf.WriteLine("STATIC=" + (buildStatic? "1" : "0")); vf.WriteLine("PREFIX=" + buildPrefix); vf.WriteLine("BINPREFIX=" + buildBinPrefix); vf.WriteLine("INCPREFIX=" + buildIncPrefix); vf.WriteLine("LIBPREFIX=" + buildLibPrefix); vf.WriteLine("SOPREFIX=" + buildSoPrefix); if (compiler == "msvc") { vf.WriteLine("INCLUDE=$(INCLUDE);" + buildInclude); vf.WriteLine("LIB=$(LIB);" + buildLib); vf.WriteLine("CRUNTIME=" + cruntime); } else if (compiler == "mingw") { vf.WriteLine("INCLUDE+=;" + buildInclude); vf.WriteLine("LIB+=;" + buildLib); } else if (compiler == "bcb") { vf.WriteLine("INCLUDE=" + buildInclude); vf.WriteLine("LIB=" + buildLib); vf.WriteLine("DYNRUNTIME=" + (dynruntime? "1" : "0")); } vf.Close();}/* Configures libxml. This one will generate xmlversion.h from xmlversion.h.in taking what the user passed on the command line into account. */function configureLibxml(){ var fso, ofi, of, ln, s; fso = new ActiveXObject("Scripting.FileSystemObject"); ofi = fso.OpenTextFile(optsFileIn, 1); of = fso.CreateTextFile(optsFile, true); while (ofi.AtEndOfStream != true) { ln = ofi.ReadLine(); s = new String(ln); if (s.search(/\@VERSION\@/) != -1) { of.WriteLine(s.replace(/\@VERSION\@/, verMajor + "." + verMinor + "." + verMicro + verMicroSuffix)); } else if (s.search(/\@LIBXML_VERSION_NUMBER\@/) != -1) { of.WriteLine(s.replace(/\@LIBXML_VERSION_NUMBER\@/, verMajor*10000 + verMinor*100 + verMicro*1)); } else if (s.search(/\@LIBXML_VERSION_EXTRA\@/) != -1) { of.WriteLine(s.replace(/\@LIBXML_VERSION_EXTRA\@/, verCvs)); } else if (s.search(/\@WITH_TRIO\@/) != -1) { of.WriteLine(s.replace(/\@WITH_TRIO\@/, withTrio? "1" : "0")); } else if (s.search(/\@WITH_THREADS\@/) != -1) { of.WriteLine(s.replace(/\@WITH_THREADS\@/, withThreads == "no"? "0" : "1")); } else if (s.search(/\@WITH_FTP\@/) != -1) { of.WriteLine(s.replace(/\@WITH_FTP\@/, withFtp? "1" : "0")); } else if (s.search(/\@WITH_HTTP\@/) != -1) { of.WriteLine(s.replace(/\@WITH_HTTP\@/, withHttp? "1" : "0")); } else if (s.search(/\@WITH_HTML\@/) != -1) { of.WriteLine(s.replace(/\@WITH_HTML\@/, withHtml? "1" : "0")); } else if (s.search(/\@WITH_C14N\@/) != -1) { of.WriteLine(s.replace(/\@WITH_C14N\@/, withC14n? "1" : "0")); } else if (s.search(/\@WITH_CATALOG\@/) != -1) { of.WriteLine(s.replace(/\@WITH_CATALOG\@/, withCatalog? "1" : "0")); } else if (s.search(/\@WITH_DOCB\@/) != -1) { of.WriteLine(s.replace(/\@WITH_DOCB\@/, withDocb? "1" : "0")); } else if (s.search(/\@WITH_XPATH\@/) != -1) { of.WriteLine(s.replace(/\@WITH_XPATH\@/, withXpath? "1" : "0")); } else if (s.search(/\@WITH_XPTR\@/) != -1) { of.WriteLine(s.replace(/\@WITH_XPTR\@/, withXptr? "1" : "0")); } else if (s.search(/\@WITH_XINCLUDE\@/) != -1) { of.WriteLine(s.replace(/\@WITH_XINCLUDE\@/, withXinclude? "1" : "0")); } else if (s.search(/\@WITH_ICONV\@/) != -1) { of.WriteLine(s.replace(/\@WITH_ICONV\@/, withIconv? "1" : "0")); } else if (s.search(/\@WITH_ISO8859X\@/) != -1) { of.WriteLine(s.replace(/\@WITH_ISO8859X\@/, withIso8859x? "1" : "0")); } else if (s.search(/\@WITH_ZLIB\@/) != -1) { of.WriteLine(s.replace(/\@WITH_ZLIB\@/, withZlib? "1" : "0")); } else if (s.search(/\@WITH_DEBUG\@/) != -1) { of.WriteLine(s.replace(/\@WITH_DEBUG\@/, withDebug? "1" : "0")); } else if (s.search(/\@WITH_MEM_DEBUG\@/) != -1) { of.WriteLine(s.replace(/\@WITH_MEM_DEBUG\@/, withMemDebug? "1" : "0")); } else if (s.search(/\@WITH_SCHEMAS\@/) != -1) { of.WriteLine(s.replace(/\@WITH_SCHEMAS\@/, withSchemas? "1" : "0")); } else if (s.search(/\@WITH_REGEXPS\@/) != -1) { of.WriteLine(s.replace(/\@WITH_REGEXPS\@/, withRegExps? "1" : "0")); } else if (s.search(/\@WITH_MODULES\@/) != -1) { of.WriteLine(s.replace(/\@WITH_MODULES\@/, withModules? "1" : "0")); } else if (s.search(/\@MODULE_EXTENSION\@/) != -1) { of.WriteLine(s.replace(/\@MODULE_EXTENSION\@/, ".dll")); } else if (s.search(/\@WITH_TREE\@/) != -1) { of.WriteLine(s.replace(/\@WITH_TREE\@/, withTree? "1" : "0")); } else if (s.search(/\@WITH_READER\@/) != -1) { of.WriteLine(s.replace(/\@WITH_READER\@/, withReader? "1" : "0"));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -