summary refs log tree commit diff stats
path: root/build/convert-lib-x86.py
diff options
context:
space:
mode:
authorBerke Viktor <berkeviktor@aol.com>2011-08-15 05:36:54 +0200
committerBerke Viktor <berkeviktor@aol.com>2011-08-15 05:36:54 +0200
commitdcb4bb2b305f65efb1a16163b96514063e055a19 (patch)
tree8814f2c31771d089a3726cb26b3fc67c62c61add /build/convert-lib-x86.py
parent7a09aa74feabcfc74dbed0c61c5bf45de61661f0 (diff)
update a2lib converter
Diffstat (limited to 'build/convert-lib-x86.py')
-rw-r--r--build/convert-lib-x86.py36
1 files changed, 14 insertions, 22 deletions
diff --git a/build/convert-lib-x86.py b/build/convert-lib-x86.py
index dbf89b37..bcb8afbf 100644
--- a/build/convert-lib-x86.py
+++ b/build/convert-lib-x86.py
@@ -1,21 +1,14 @@
-# script by Mikhail Titov
-# http://mail.gnome.org/archives/gtk-list/2011-March/msg00103.html
+# a2lib script by Mikhail Titov
+# http://live.gnome.org/GTK%2B/Win32/NativeBuildWithOBS
 
 import os,re,sys,shutil
 from os.path import join, getsize
 from subprocess import Popen, PIPE
 os.environ['PATH'] = os.environ['PATH'] + ";C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE;C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\bin;C:\\mozilla-build\\mingw32\\bin"
-#gendef = "C:\\workspace\\glibmm-2.27.99\\MSVC_Net2008\\gendef\\Win32\\Debug\\gendef.exe"
-#    dll = re.sub(".a", "", lib)
-#    output = Popen([gendef, d, dll, lib], stdout=PIPE).communicate()[0]
+root = "c:\\mozilla-build\\build\\xchat-wdk\\dep-x86"
 
-def gen(dll):
-    name = re.sub("^lib", "", dll)
-    name = re.sub("(?:-\\d).dll", "", name)
-#    shutil.copyfile(lib, name + ".lib")
-    print("Working on %s\n" % dll)
-    output = Popen(["nm", "lib%s.dll.a" % name], stdout=PIPE).communicate()[0]
-    d = "%s.def" % name
+def gen(dll,lib,d):
+    output = Popen(["nm", lib], stdout=PIPE).communicate()[0]
     with open(d, "wb") as f:
         f.write(b"EXPORTS\n")
         for line in output.split(b"\r\n"):
@@ -23,16 +16,15 @@ def gen(dll):
                 line = re.sub(b"^.* T _|^.* I __nm__", b"", line) #|^.* I _
                 f.write(line + b"\n")
         f.write(str.encode("LIBRARY %s\n" % dll))
-    p = Popen(["lib", "/machine:x86", "/def:%s" % d]) #, shell = True)
+    p = Popen(["lib", "/MACHINE:X86", "/def:%s" % d]) #, shell = True)
 
-root = "c:\\mozilla-build\\build\\xchat-wdk\\dep-x86"
 os.chdir(root + "\\lib")
 for root, dirs, files in os.walk(root + "\\bin"):
-    for name in files:
-        if (re.search(".dll", name)):
-            print("Processing: %s\n" % name)
-            gen(name)
-
-#gen("libatk-1.0-0.dll")
-#  glibmm-2.4.def libglibmm-2.4-1.dll libglibmm-2.4.dll.a
-# dumpbin /SYMBOLS /OUT:dumpbin.out libglibmm-2.4.dll.a
+    for f in files:
+        if (re.search(".dll", f)):
+            name = re.sub("^lib", "", f)
+            name = re.sub("(?:-\\d).dll", "", name)
+            print("Working on %s\n" % f)
+            d = "%s.def" % name
+            lib = "lib%s.dll.a" % name
+            gen(f, lib, d)