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