From 19345289008d27dcd8631776c29e462d992ed638 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Mon, 15 Aug 2011 00:51:11 +0200 Subject: [PATCH] obs gtk works but requires library conversion --- build/convert-lib-x64.py | 38 ++++++++++++++++++++++++++++++++++++++ build/convert-lib-x86.py | 38 ++++++++++++++++++++++++++++++++++++++ build/dep-extract.bat | 4 ++++ src/makeinc.skel.mak | 4 ++-- 4 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 build/convert-lib-x64.py create mode 100644 build/convert-lib-x86.py diff --git a/build/convert-lib-x64.py b/build/convert-lib-x64.py new file mode 100644 index 00000000..71962098 --- /dev/null +++ b/build/convert-lib-x64.py @@ -0,0 +1,38 @@ +# script by Mikhail Titov +# http://mail.gnome.org/archives/gtk-list/2011-March/msg00103.html + +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\\VC\\bin\\amd64;C:\\mozilla-build\\mingw64\\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] + +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 + with open(d, "wb") as f: + f.write(b"EXPORTS\n") + for line in output.split(b"\r\n"): + if (re.match(b".* T _|.* I __nm", line)): #|.* I __imp + 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:x64", "/def:%s" % d]) #, shell = True) + +root = "c:\\mozilla-build\\build\\xchat-wdk\\dep-x64" +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 diff --git a/build/convert-lib-x86.py b/build/convert-lib-x86.py new file mode 100644 index 00000000..dbf89b37 --- /dev/null +++ b/build/convert-lib-x86.py @@ -0,0 +1,38 @@ +# script by Mikhail Titov +# http://mail.gnome.org/archives/gtk-list/2011-March/msg00103.html + +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] + +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 + with open(d, "wb") as f: + f.write(b"EXPORTS\n") + for line in output.split(b"\r\n"): + if (re.match(b".* T _|.* I __nm", line)): #|.* I __imp + 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) + +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 diff --git a/build/dep-extract.bat b/build/dep-extract.bat index c3aba497..1f8ac036 100644 --- a/build/dep-extract.bat +++ b/build/dep-extract.bat @@ -9,6 +9,10 @@ cd ..\dep-x86 del *.cpio xcopy /q /s /i usr\i686-w64-mingw32\sys-root\mingw\* . rmdir /q /s usr +set OPATH=%PATH% +set PATH=%PATH%;c:\mozilla-build\python-2.7-x86 +python convert-lib.py +set PATH=%OPATH% 7z x *.zip 7z x *.7z pause diff --git a/src/makeinc.skel.mak b/src/makeinc.skel.mak index 90751dcd..c34803c4 100644 --- a/src/makeinc.skel.mak +++ b/src/makeinc.skel.mak @@ -1,7 +1,7 @@ CC = cl LINK = link CFLAGS = $(CFLAGS) /Ox /c /MD /MP /W0 /nologo -CFLAGS = $(CFLAGS) /DWIN32 /DG_DISABLE_CAST_CHECKS /DG_DISABLE_DEPRECATED /DGDK_PIXBUF_DISABLE_DEPRECATED /DGDK_DISABLE_DEPRECATED /DUSE_IPV6 /DHAVE_STRTOULL /Dstrtoull=_strtoui64 /Dstrcasecmp=stricmp /Dstrncasecmp=strnicmp /DUSE_OPENSSL +CFLAGS = $(CFLAGS) /DWIN32 /DG_DISABLE_CAST_CHECKS /DG_DISABLE_DEPRECATED /DGDK_PIXBUF_DISABLE_DEPRECATED /DGDK_DISABLE_DEPRECATED /DUSE_IPV6 /DHAVE_STRTOULL /Dstrtoull=_strtoui64 /Dstrcasecmp=stricmp /Dstrncasecmp=strnicmp CFLAGS = $(CFLAGS) /I$(DEV)\include CPPFLAGS = /c /MD /W0 /nologo /DWIN32 LDFLAGS = /subsystem:windows /nologo @@ -9,7 +9,7 @@ LIBS = $(LIBS) gdi32.lib shell32.lib user32.lib advapi32.lib imm32.lib ole32.lib GLIB = /I$(DEV)\include\glib-2.0 /I$(DEV)\lib\glib-2.0\include /I$(DEV)\include\libxml2 GTK = /I$(DEV)\include\gtk-2.0 /I$(DEV)\lib\gtk-2.0\include /I$(DEV)\include\atk-1.0 /I$(DEV)\include\cairo /I$(DEV)\include\pango-1.0 /I$(DEV)\include\gdk-pixbuf-2.0 -LIBS = $(LIBS) /libpath:$(DEV)\lib libgtk-win32-2.0.dll.a libgdk-win32-2.0.dll.a libatk-1.0.dll.a libgio-2.0.dll.a libgdk_pixbuf-2.0.dll.a libpangowin32-1.0.dll.a libpangocairo-1.0.dll.a libpango-1.0.dll.a libcairo.dll.a libgobject-2.0.dll.a libgmodule-2.0.dll.a libglib-2.0.dll.a libintl.dll.a libxml2.dll.a +LIBS = $(LIBS) /libpath:$(DEV)\lib gtk-win32-2.0.lib gdk-win32-2.0.lib atk-1.0.lib gio-2.0.lib gdk_pixbuf-2.0.lib pangowin32-1.0.lib pangocairo-1.0.lib pango-1.0.lib cairo.lib gobject-2.0.lib gmodule-2.0.lib glib-2.0.lib intl.lib xml2.lib LUALIB = lua51 LUAOUTPUT = xclua.dll