diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2022-03-09 16:45:46 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2022-03-10 10:05:56 +0800 |
commit | 7917daa89e076fdfc69b6593057705f17f5ef7ea (patch) | |
tree | b5e58667cff920f9ca9e988c42ab4584bb286c4d | |
parent | 379773594db708e8f88eb09cbc9693c4887ad229 (diff) | |
download | libxslt-distutils.tar.gz |
win32/configure.js: Support building Python bindingsdistutils
Add the python=yes option so that one can build the Python bindings. This will
configure python/setup.py, which one can use to build and package the bindings
via distutils.
-rw-r--r-- | win32/configure.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/win32/configure.js b/win32/configure.js index 66986b04..91cb5692 100644 --- a/win32/configure.js +++ b/win32/configure.js @@ -48,6 +48,7 @@ var withZlib = false; var withCrypto = true; var withModules = false; var withProfiler = true; +var withPython = false; /* Win32 build options. */ var dirSep = "\\"; var compiler = "msvc"; @@ -108,6 +109,7 @@ function usage() txt += " crypto: Enable Crypto support (" + (withCrypto? "yes" : "no") + ")\n"; txt += " modules: Enable Module support (" + (withModules? "yes" : "no") + ")\n"; txt += " profiler: Enable Profiler support (" + (withProfiler? "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] (" + compiler + ")\n"; txt += " cruntime: C-runtime compiler option (only msvc) (" + cruntime + ")\n"; @@ -181,6 +183,7 @@ function discoverVersion() vf.WriteLine("WITH_CRYPTO=" + (withCrypto? "1" : "0")); vf.WriteLine("WITH_MODULES=" + (withModules? "1" : "0")); vf.WriteLine("WITH_PROFILER=" + (withProfiler? "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); @@ -270,6 +273,49 @@ function configureExslt() of.Close(); } +/* Configures Python bindings. Otherwise identical to the above */ +function configureLibxsltPy() +{ + var pyOptsFileIn = baseDir + "\\python\\setup.py.in"; + var pyOptsFile = baseDir + "\\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(/\@VERSION\@/) != -1) { + of.WriteLine(s.replace(/\@VERSION\@/, + verMajorXslt + "." + verMinorXslt + "." + verMicroXslt)); + } else if (s.search(/\@prefix\@/) != -1) { + of.WriteLine(s.replace(/\@prefix\@/, buildPrefix)); + } else if (s.search(/\@LIBXSLT_VERSION_NUMBER\@/) != -1) { + of.WriteLine(s.replace(/\@LIBXSLT_VERSION_NUMBER\@/, + verMajorXslt*10000 + verMinorXslt*100 + verMicroXslt*1)); + } else if (s.search(/\@LIBXSLT_VERSION_EXTRA\@/) != -1) { + of.WriteLine(s.replace(/\@LIBXSLT_VERSION_EXTRA\@/, verCvs)); + } else if (s.search(/\@WITH_TRIO\@/) != -1) { + of.WriteLine(s.replace(/\@WITH_TRIO\@/, withTrio? "1" : "0")); + } else if (s.search(/\@WITH_XSLT_DEBUG\@/) != -1) { + of.WriteLine(s.replace(/\@WITH_XSLT_DEBUG\@/, withXsltDebug? "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_DEBUGGER\@/) != -1) { + of.WriteLine(s.replace(/\@WITH_DEBUGGER\@/, withDebugger? "1" : "0")); + } else if (s.search(/\@WITH_MODULES\@/) != -1) { + of.WriteLine(s.replace(/\@WITH_MODULES\@/, withModules? "1" : "0")); + } else if (s.search(/\@WITH_PROFILER\@/) != -1) { + of.WriteLine(s.replace(/\@WITH_PROFILER\@/, withProfiler? "1" : "0")); + } else if (s.search(/\@LIBXSLT_DEFAULT_PLUGINS_PATH\@/) != -1) { + of.WriteLine(s.replace(/\@LIBXSLT_DEFAULT_PLUGINS_PATH\@/, "NULL")); + } 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. */ @@ -336,6 +382,8 @@ for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) { withModules = strToBool(arg.substring(opt.length + 1, arg.length)); else if (opt == "profiler") withProfiler = 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") @@ -432,6 +480,15 @@ if (error != 0) { WScript.Quit(error); } +if (withPython == true) { + configureLibxsltPy(); + if (error != 0) { + WScript.Echo("Configuration failed, aborting."); + WScript.Quit(error); + } + +} + // Configure libexslt. configureExslt(); if (error != 0) { @@ -469,6 +526,7 @@ txtOut += " With zlib: " + boolToStr(withZlib) + "\n"; txtOut += " Crypto: " + boolToStr(withCrypto) + "\n"; txtOut += " Modules: " + boolToStr(withModules) + "\n"; txtOut += " Profiler: " + boolToStr(withProfiler) + "\n"; +txtOut += " Python bindings: " + boolToStr(withPython) + "\n"; txtOut += "\n"; txtOut += "Win32 build configuration\n"; txtOut += "-------------------------\n"; |