summaryrefslogtreecommitdiffstats
path: root/SOURCES/dll2a
diff options
context:
space:
mode:
authorJoerg Koenig <jck@techsat.com>2017-06-07 09:07:01 (GMT)
committerJoerg Koenig <jck@techsat.com>2017-06-07 09:07:01 (GMT)
commit5627770d5021bd1d8fb31161811b4444b6b90781 (patch)
tree20aa4bed4c5e53417e77b35e4bfcb865aae1dc66 /SOURCES/dll2a
parentd6dfabeef93d4dc759a5fb499848e5090cf3d6c2 (diff)
downloadgcc-compiler-suite-5627770d5021bd1d8fb31161811b4444b6b90781.zip
gcc-compiler-suite-5627770d5021bd1d8fb31161811b4444b6b90781.tar.gz
gcc-compiler-suite-5627770d5021bd1d8fb31161811b4444b6b90781.tar.bz2
Added dll2a python script, to generate a GNU import library from Microsoft DLLrefs/changes/62/1762/1
Change-Id: I60521512a1b5569ee8ba41ed8b12b079cae21b0f
Diffstat (limited to 'SOURCES/dll2a')
-rwxr-xr-xSOURCES/dll2a37
1 files changed, 37 insertions, 0 deletions
diff --git a/SOURCES/dll2a b/SOURCES/dll2a
new file mode 100755
index 0000000..03079c3
--- /dev/null
+++ b/SOURCES/dll2a
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+import sys
+import os, os.path
+import commands
+import tempfile
+
+appdir = os.path.abspath(os.path.dirname(__file__))
+basename = os.path.basename(__file__)
+
+dllfile = sys.argv[1]
+
+_t = basename.split("-dll2a")
+if not _t[0].strip() == "":
+ prefix=_t[0]+"-"
+else:
+ prefix=""
+
+gendef_bin = os.path.join(appdir, "%sgendef"%prefix)
+dlltool_bin = os.path.join(appdir, "%sdlltool"%prefix)
+ranlib_bin = os.path.join(appdir, "%sranlib"%prefix)
+
+ret, out = commands.getstatusoutput('''%s %s''' % (gendef_bin, dllfile))
+
+deffile = dllfile.lower().replace(".DLL", ".dll")
+deffile = deffile.lower().replace(".dll", ".def")
+libfile = deffile.lower().replace(".def", ".a")
+libfile = "lib%s"%libfile
+if os.path.isfile(deffile):
+ ret, out = commands.getstatusoutput('''%s -d %s -l %s''' % (dlltool_bin, deffile, libfile))
+
+if os.path.isfile(libfile):
+ ret, out = commands.getstatusoutput('''%s %s''' % (ranlib_bin, libfile))
+
+print "dll2a: %s -> %s "%(dllfile,libfile)
+print "dll2a: DLL import library %s generated" % libfile
+sys.exit(0)
+