summaryrefslogtreecommitdiff
path: root/win
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2017-04-03 18:48:48 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2017-04-03 18:48:48 +0000
commitf2dc04abea172e4c5d701a749902c88f4a626c2c (patch)
tree00801d28e0d4fdba73024a9ef5348b20145921e4 /win
parentff6f4d7db11c1b8960376de3035b9e498fac5d34 (diff)
downloadmariadb-git-f2dc04abea172e4c5d701a749902c88f4a626c2c.tar.gz
Compiling, Windows . Avoid unnecessary rebuilds with MSVC.
To export symbols from the mysqld.exe, use lib.exe with /DEF, rather than pre-link step when building mysqld.exe. This helps to avoid relinking all plugins, if mysqld.exe was recompiled but the list of its exports has not changed. Also removed unnecessary DEPENDS in some ADD_CUSTOM_COMMAND (gen_lex_token, gen_lex_hash etc). They confuse VS generator which tends to recreate headers and do unnecessary recompilations.
Diffstat (limited to 'win')
-rw-r--r--win/create_def_file.js46
1 files changed, 41 insertions, 5 deletions
diff --git a/win/create_def_file.js b/win/create_def_file.js
index 5fb28ef0bee..25bbbb4eb3d 100644
--- a/win/create_def_file.js
+++ b/win/create_def_file.js
@@ -54,6 +54,22 @@ var is64 = args.Item(0).toLowerCase() == "x64";
var shell = new ActiveXObject("WScript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
+/*
+ If .def file is used with together with lib.exe
+ the name mangling for stdcall is slightly different.
+
+ Undescore prefix for stdcall function name must be removed for
+ lib.exe but not link.exe (see ScrubSymbol())
+
+ This difference is not documented anywhere and could
+ be a bug in compiler tools.
+
+ We use a parameter /forLib, if the resulting .def file is used
+ with lib.exe .
+*/
+var forLib = false;
+
+
OutputSymbols(CollectSymbols());
@@ -62,8 +78,8 @@ function OutputSymbols(symbols)
{
var out = WScript.StdOut;
out.WriteLine("EXPORTS");
- for (var sym in symbols)
- out.WriteLine(sym);
+ for (var i= 0; i < symbols.length; i++)
+ out.WriteLine(symbols[i]);
}
function echo(message)
@@ -72,9 +88,10 @@ function echo(message)
}
// Extract global symbol names and type from objects
+// Returns string array with symbol names
function CollectSymbols()
{
- var uniqueSymbols = new Array();
+ var uniqueSymbols = new Object();
try
{
@@ -146,7 +163,19 @@ function CollectSymbols()
uniqueSymbols[symbol] = 1;
}
fso.DeleteFile(rspfilename);
- return uniqueSymbols;
+ // Sort symbols names
+ var keys=[];
+ var sorted = {};
+ for (key in uniqueSymbols)
+ {
+ if (uniqueSymbols.hasOwnProperty(key))
+ {
+ keys.push(key);
+ }
+ }
+ keys.sort();
+
+ return keys;
}
// performs necessary cleanup on the symbol name
@@ -156,6 +185,9 @@ function ScrubSymbol(symbol)
if (symbol.charAt(0) != "_")
return symbol;
+ if (forLib)
+ return symbol.substring(1, symbol.length);
+
var atSign = symbol.indexOf("@");
if (atSign != -1)
{
@@ -189,7 +221,11 @@ function CreateResponseFile(filename)
var index = 1;
for (; index < args.length; index++)
{
- addToResponseFile(args.Item(index),responseFile);
+ var param = args.Item(index);
+ if (param == "/forLib")
+ forLib = true;
+ else
+ addToResponseFile(args.Item(index),responseFile);
}
responseFile.Close();
}