⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configure.js

📁 一个类似windows
💻 JS
📖 第 1 页 / 共 2 页
字号:
		} else if (s.search(/\@WITH_WRITER\@/) != -1) {
			of.WriteLine(s.replace(/\@WITH_WRITER\@/, withWriter? "1" : "0"));
		} else if (s.search(/\@WITH_WALKER\@/) != -1) {
			of.WriteLine(s.replace(/\@WITH_WALKER\@/, withWalker? "1" : "0"));
		} else if (s.search(/\@WITH_PATTERN\@/) != -1) {
			of.WriteLine(s.replace(/\@WITH_PATTERN\@/, withPattern? "1" : "0"));
		} else if (s.search(/\@WITH_PUSH\@/) != -1) {
			of.WriteLine(s.replace(/\@WITH_PUSH\@/, withPush? "1" : "0"));
		} else if (s.search(/\@WITH_VALID\@/) != -1) {
			of.WriteLine(s.replace(/\@WITH_VALID\@/, withValid? "1" : "0"));
		} else if (s.search(/\@WITH_SAX1\@/) != -1) {
			of.WriteLine(s.replace(/\@WITH_SAX1\@/, withSax1? "1" : "0"));
		} else if (s.search(/\@WITH_LEGACY\@/) != -1) {
			of.WriteLine(s.replace(/\@WITH_LEGACY\@/, withLegacy? "1" : "0"));
		} else if (s.search(/\@WITH_OUTPUT\@/) != -1) {
			of.WriteLine(s.replace(/\@WITH_OUTPUT\@/, withOutput? "1" : "0"));
		} else
			of.WriteLine(ln);
	}
	ofi.Close();
	of.Close();
}
/* Configures Python bindings. Otherwise identical to the above */
function configureLibxmlPy()
{
	var pyOptsFileIn = srcDirXml + "\\python\\setup.py.in";
	var pyOptsFile = srcDirXml + "\\python\\setup.py";
	var fso, ofi, of, ln, s;
	fso = new ActiveXObject("Scripting.FileSystemObject");
	ofi = fso.OpenTextFile(pyOptsFileIn, 1);
	of = fso.CreateTextFile(pyOptsFile, true);
	while (ofi.AtEndOfStream != true) {
		ln = ofi.ReadLine();
		s = new String(ln);
		if (s.search(/\@LIBXML_VERSION\@/) != -1) {
			of.WriteLine(s.replace(/\@LIBXML_VERSION\@/, 
				verMajor + "." + verMinor + "." + verMicro));
		} else if (s.search(/\@prefix\@/) != -1) {
			of.WriteLine(s.replace(/\@prefix\@/, buildPrefix));
		} else if (s.search(/\@WITH_THREADS\@/) != -1) {
			of.WriteLine(s.replace(/\@WITH_THREADS\@/, withThreads == "no"? "0" : "1"));
		} else
			of.WriteLine(ln);
	}
	ofi.Close();
	of.Close();
}

/* Creates the readme file for the binary distribution of 'bname', for the
   version 'ver' in the file 'file'. This one is called from the Makefile when
   generating a binary distribution. The parameters are passed by make. */
function genReadme(bname, ver, file)
{
	var fso, f;
	fso = new ActiveXObject("Scripting.FileSystemObject");
	f = fso.CreateTextFile(file, true);
	f.WriteLine("  " + bname + " " + ver);
	f.WriteLine("  --------------");
	f.WriteBlankLines(1);
	f.WriteLine("  This is " + bname + ", version " + ver + ", binary package for the native Win32/IA32");
	f.WriteLine("platform.");
	f.WriteBlankLines(1);
	f.WriteLine("  The files in this package do not require any special installation");
	f.WriteLine("steps. Extract the contents of the archive whereever you wish and");
	f.WriteLine("make sure that your tools which use " + bname + " can find it.");
	f.WriteBlankLines(1);
	f.WriteLine("  For example, if you want to run the supplied utilities from the command");
	f.WriteLine("line, you can, if you wish, add the 'bin' subdirectory to the PATH");
	f.WriteLine("environment variable.");
	f.WriteLine("  If you want to make programmes in C which use " + bname + ", you'll");
	f.WriteLine("likely know how to use the contents of this package. If you don't, please");
	f.WriteLine("refer to your compiler's documentation."); 
	f.WriteBlankLines(1);
	f.WriteLine("  If there is something you cannot keep for yourself, such as a problem,");
	f.WriteLine("a cheer of joy, a comment or a suggestion, feel free to contact me using");
	f.WriteLine("the address below.");
	f.WriteBlankLines(1);
	f.WriteLine("                              Igor Zlatkovic (igor@zlatkovic.com)");
	f.Close();
}


/*
 * main(),
 * Execution begins here.
 */

// Parse the command-line arguments.
for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) {
	var arg, opt;
	arg = WScript.Arguments(i);
	opt = arg.substring(0, arg.indexOf("="));
	if (opt.length == 0)
		opt = arg.substring(0, arg.indexOf(":"));
	if (opt.length > 0) {
		if (opt == "trio")
			withTrio = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "threads")
			withThreads = arg.substring(opt.length + 1, arg.length);
		else if (opt == "ftp")
			withFtp = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "http")
			withHttp = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "html")
			withHtml = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "c14n")
			withC14n = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "catalog")
			withCatalog = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "docb")
			withDocb = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "xpath")
			withXpath = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "xptr")
			withXptr = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "xinclude")
			withXinclude = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "iconv")
			withIconv = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "iso8859x")
			withIso8859x = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "zlib")
			withZlib = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "xml_debug")
			withDebug = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "mem_debug")
			withMemDebug = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "schemas")
			withSchemas = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "regexps")
			withRegExps = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "tree")
			withTree = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "reader")
			withReader = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "writer")
			withWriter = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "walker")
			withWalker = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "pattern")
			withPattern = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "push")
			withPush = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "valid")
			withValid = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "sax1")
			withSax1 = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "legacy")
			withLegacy = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "output")
			withOutput = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "python")
			withPython = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "compiler")
			compiler = arg.substring(opt.length + 1, arg.length);
		else if (opt == "cruntime")
			cruntime = arg.substring(opt.length + 1, arg.length);
		else if (opt == "dynruntime")
			dynruntime = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "debug")
			buildDebug = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "static")
			buildStatic = strToBool(arg.substring(opt.length + 1, arg.length));
		else if (opt == "prefix")
			buildPrefix = arg.substring(opt.length + 1, arg.length);
		else if (opt == "incdir")
			buildIncPrefix = arg.substring(opt.length + 1, arg.length);
		else if (opt == "bindir")
			buildBinPrefix = arg.substring(opt.length + 1, arg.length);
		else if (opt == "libdir")
			buildLibPrefix = arg.substring(opt.length + 1, arg.length);
		else if (opt == "sodir")
			buildSoPrefix = arg.substring(opt.length + 1, arg.length);
		else if (opt == "incdir")
			buildIncPrefix = arg.substring(opt.length + 1, arg.length);
		else if (opt == "include")
			buildInclude = arg.substring(opt.length + 1, arg.length);
		else if (opt == "lib")
			buildLib = arg.substring(opt.length + 1, arg.length);
		else if (opt == "release")
			useCvsVer = false;
		else
			error = 1;
	} else if (i == 0) {
		if (arg == "genreadme") {
			// This command comes from the Makefile and will not be checked
			// for errors, because Makefile will always supply right the parameters.
			genReadme(WScript.Arguments(1), WScript.Arguments(2), WScript.Arguments(3));
			WScript.Quit(0);
		} else if (arg == "help") {
			usage();
			WScript.Quit(0);
		}

	} else {
		error = 1;
	}
}


// If we fail here, it is because the user supplied an unrecognised argument.
if (error != 0) {
	usage();
	WScript.Quit(error);
}

// if user choses to link the c-runtime library statically into libxml2
// with /MT and friends, then we need to enable static linking for xmllint
if (cruntime == "/MT" || cruntime == "/MTd" ||
		cruntime == "/ML" || cruntime == "/MLd") {
	buildStatic = 1;
}

dirSep = "\\";
if (compiler == "mingw")
	dirSep = "/";
if (buildBinPrefix == "")
	buildBinPrefix = "$(PREFIX)" + dirSep + "bin";
if (buildIncPrefix == "")
	buildIncPrefix = "$(PREFIX)" + dirSep + "include";
if (buildLibPrefix == "")
	buildLibPrefix = "$(PREFIX)" + dirSep + "lib";
if (buildSoPrefix == "")
	buildSoPrefix = "$(PREFIX)" + dirSep + "lib";

// Discover the version.
discoverVersion();
if (error != 0) {
	WScript.Echo("Version discovery failed, aborting.");
	WScript.Quit(error);
}

var outVerString = baseName + " version: " + verMajor + "." + verMinor + "." + verMicro;
if (verMicroSuffix && verMicroSuffix != "")
	outVerString += "-" + verMicroSuffix;
if (verCvs && verCvs != "")
	outVerString += "-" + verCvs;
WScript.Echo(outVerString);

// Configure libxml.
configureLibxml();
if (error != 0) {
	WScript.Echo("Configuration failed, aborting.");
	WScript.Quit(error);
}

if (withPython == true) {
	configureLibxmlPy();
	if (error != 0) {
		WScript.Echo("Configuration failed, aborting.");
		WScript.Quit(error);
	}

}

// Create the makefile.
var fso = new ActiveXObject("Scripting.FileSystemObject");
var makefile = ".\\Makefile.msvc";
if (compiler == "mingw")
	makefile = ".\\Makefile.mingw";
else if (compiler == "bcb")
	makefile = ".\\Makefile.bcb";
fso.CopyFile(makefile, ".\\Makefile", true);
WScript.Echo("Created Makefile.");
// Create the config.h.
var confighsrc = "..\\include\\win32config.h";
var configh = "..\\config.h";
var f = fso.FileExists(configh);
if (f) {
	var t = fso.GetFile(configh);
	t.Attributes =0;
}
fso.CopyFile(confighsrc, configh, true);
WScript.Echo("Created config.h.");


// Display the final configuration. 
var txtOut = "\nXML processor configuration\n";
txtOut += "---------------------------\n";
txtOut += "              Trio: " + boolToStr(withTrio) + "\n";
txtOut += "     Thread safety: " + withThreads + "\n";
txtOut += "        FTP client: " + boolToStr(withFtp) + "\n";
txtOut += "       HTTP client: " + boolToStr(withHttp) + "\n";
txtOut += "    HTML processor: " + boolToStr(withHtml) + "\n";
txtOut += "      C14N support: " + boolToStr(withC14n) + "\n";
txtOut += "   Catalog support: " + boolToStr(withCatalog) + "\n";
txtOut += "   DocBook support: " + boolToStr(withDocb) + "\n";
txtOut += "     XPath support: " + boolToStr(withXpath) + "\n";
txtOut += "  XPointer support: " + boolToStr(withXptr) + "\n";
txtOut += "  XInclude support: " + boolToStr(withXinclude) + "\n";
txtOut += "     iconv support: " + boolToStr(withIconv) + "\n";
txtOut += "  iso8859x support: " + boolToStr(withIso8859x) + "\n";
txtOut += "      zlib support: " + boolToStr(withZlib) + "\n";
txtOut += "  Debugging module: " + boolToStr(withDebug) + "\n";
txtOut += "  Memory debugging: " + boolToStr(withMemDebug) + "\n";
txtOut += "    Regexp support: " + boolToStr(withRegExps) + "\n";
txtOut += "    Module support: " + boolToStr(withModules) + "\n";
txtOut += "      Tree support: " + boolToStr(withTree) + "\n";
txtOut += "    Reader support: " + boolToStr(withReader) + "\n";
txtOut += "    Writer support: " + boolToStr(withWriter) + "\n";
txtOut += "    Walker support: " + boolToStr(withWalker) + "\n";
txtOut += "   Pattern support: " + boolToStr(withPattern) + "\n";
txtOut += "      Push support: " + boolToStr(withPush) + "\n";
txtOut += "Validation support: " + boolToStr(withValid) + "\n";
txtOut += "      SAX1 support: " + boolToStr(withSax1) + "\n";
txtOut += "    Legacy support: " + boolToStr(withLegacy) + "\n";
txtOut += "    Output support: " + boolToStr(withOutput) + "\n";
txtOut += "XML Schema support: " + boolToStr(withSchemas) + "\n";
txtOut += "   Python bindings: " + boolToStr(withPython) + "\n";
txtOut += "\n";
txtOut += "Win32 build configuration\n";
txtOut += "-------------------------\n";
txtOut += "          Compiler: " + compiler + "\n";
if (compiler == "msvc")
	txtOut += "  C-Runtime option: " + cruntime + "\n";
else if (compiler == "bcb")
	txtOut += "   Use dynamic RTL: " + dynruntime + "\n";
txtOut += "     Debug symbols: " + boolToStr(buildDebug) + "\n";
txtOut += "    Static xmllint: " + boolToStr(buildStatic) + "\n";
txtOut += "    Install prefix: " + buildPrefix + "\n";
txtOut += "      Put tools in: " + buildBinPrefix + "\n";
txtOut += "    Put headers in: " + buildIncPrefix + "\n";
txtOut += "Put static libs in: " + buildLibPrefix + "\n";
txtOut += "Put shared libs in: " + buildSoPrefix + "\n";
txtOut += "      Include path: " + buildInclude + "\n";
txtOut += "          Lib path: " + buildLib + "\n";
WScript.Echo(txtOut);

//

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -