summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xMakefile3
-rwxr-xr-xSOURCES/dll2a37
2 files changed, 40 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 862d201..8866a90 100755
--- a/Makefile
+++ b/Makefile
@@ -402,6 +402,9 @@ xgcc-finish:
find $(XGCC_INST_DIR) -type f -name "*.py" | xargs rm -f
cp -f $(SOURCE_DIR)/mingw.gcc.specs \
$(XGCC_INST_DIR)/lib/gcc/$(XGCC_TARGET64)/$(VERSION_GCC)/specs
+ cp -f $(SOURCE_DIR)/dll2a \
+ $(XGCC_INST_DIR)/bin/$(XGCC_TARGET64)-dll2a
+ chmod a+x $(XGCC_INST_DIR)/bin/$(XGCC_TARGET64)-dll2a
sed -i -e 's/__LIB32__/lib\/gcc\/$(XGCC_TARGET64)\/lib32/g' \
$(XGCC_INST_DIR)/lib/gcc/$(XGCC_TARGET64)/$(VERSION_GCC)/specs
sed -i -e 's/__LIB64__/lib\/gcc\/$(XGCC_TARGET64)\/lib/g' \
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)
+