summaryrefslogtreecommitdiff
path: root/win/genwinimportlibs.py
diff options
context:
space:
mode:
Diffstat (limited to 'win/genwinimportlibs.py')
-rwxr-xr-xwin/genwinimportlibs.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/win/genwinimportlibs.py b/win/genwinimportlibs.py
new file mode 100755
index 0000000..819585a
--- /dev/null
+++ b/win/genwinimportlibs.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+
+import os
+import string
+
+os.chdir("deps")
+
+def tmpFileToDef(baseName):
+ tmpFile = open("tmp", "r")
+ defFile = open(baseName+".def", "w")
+ defFile.write("EXPORTS\n")
+ content = tmpFile.readlines()
+ i = 0
+ while content[i].find("ordinal hint") == -1:
+ i += 1
+ isEmptyLine = False;
+ i += 2
+
+ while not(isEmptyLine):
+ line = string.split(content[i])
+ isEmptyLine = len(line) == 0
+ if not(isEmptyLine):
+ defFile.write(line[3]+"\n")
+ i += 1
+ defFile.close()
+
+
+for dllName in os.listdir("bin"):
+ if dllName[-4:] == ".dll":
+ print "Generating lib for '" + dllName + "'."
+ os.system("dumpbin /EXPORTS bin\\"+dllName+" > tmp")
+ baseName = dllName[:-4]
+ tmpFileToDef(baseName)
+ os.system("lib /def:"+baseName+".def /out:lib\\"+baseName+".lib /machine:x86")
+