====== GTK3 compilation on Win32 ===== Tested on Windows XP, Inkscape trunk revision 11562. 1. Download and uncompress the following files: (from http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_12.1/noarch/ - the files are needed to run the gtk demo, not sure everything is necessary to run Inkscape) mingw32-atk-2.4.0-1.14.noarch.rpm mingw32-atk-devel-2.4.0-1.14.noarch.rpm mingw32-atkmm-2.22.6-1.20.noarch.rpm mingw32-atkmm-devel-2.22.6-1.20.noarch.rpm mingw32-cairo-devel-1.10.2-8.14.noarch.rpm mingw32-cairomm-1.10.0-1.41.noarch.rpm mingw32-cairomm-devel-1.10.0-1.41.noarch.rpm mingw32-freetype-2.4.10-1.2.noarch.rpm mingw32-freetype-devel-2.4.10-1.2.noarch.rpm mingw32-gdk-pixbuf-2.26.1-1.17.noarch.rpm mingw32-gdk-pixbuf-devel-2.26.1-1.17.noarch.rpm mingw32-gdk-pixbuf-loader-rsvg-2.36.1-1.20.noarch.rpm mingw32-glib2-2.32.4-1.1.noarch.rpm mingw32-glib2-devel-2.32.4-1.1.noarch.rpm mingw32-glib2-lang-2.32.4-1.1.noarch.rpm mingw32-glib2-tools-2.32.4-1.1.noarch.rpm mingw32-glibmm2-2.32.0-1.10.noarch.rpm mingw32-glibmm2-devel-2.32.0-1.10.noarch.rpm mingw32-gtk3-3.4.2-2.19.noarch.rpm mingw32-gtk3-data-3.4.2-2.19.noarch.rpm mingw32-gtk3-devel-3.4.2-2.16.noarch.rpm mingw32-gtk3-lang-3.4.2-2.19.noarch.rpm mingw32-gtk3-tools-3.4.2-2.19.noarch.rpm mingw32-gtkmm3-3.4.0-1.15.noarch.rpm mingw32-gtkmm3-devel-3.4.0-1.15.noarch.rpm mingw32-libcairo-gobject2-1.10.2-8.14.noarch.rpm mingw32-libcairo2-1.10.2-8.14.noarch.rpm mingw32-libffi-3.0.10-2.25.noarch.rpm mingw32-libffi-devel-3.0.10-2.25.noarch.rpm mingw32-libjasper-1.900.1-6.30.noarch.rpm mingw32-libjasper-devel-1.900.1-6.30.noarch.rpm mingw32-liblzma-5.0.4-1.2.noarch.rpm mingw32-liblzma-devel-5.0.4-1.2.noarch.rpm mingw32-libopenjpeg-devel-1.5.0-4.20.noarch mingw32-libopenjpeg-devel-1.5.0-4.20.noarch.rpm mingw32-libopenjpeg1-1.5.0-4.20.noarch mingw32-libopenjpeg1-1.5.0-4.20.noarch.rpm mingw32-libpng-1.5.11-1.2.noarch.rpm mingw32-libpng-devel-1.5.11-1.2.noarch.rpm mingw32-libpoppler-0.20.2-1.3.noarch.rpm mingw32-libpoppler-devel-0.20.2-1.3.noarch.rpm mingw32-libpoppler-glib-0.20.2-1.3.noarch.rpm mingw32-libpoppler-glib-devel-0.20.2-1.3.noarch.rpm mingw32-libstdc++-4.7.0-3.14.noarch.rpm mingw32-libtiff-4.0.2-1.3.noarch.rpm mingw32-libtiff-devel-4.0.2-1.3.noarch.rpm mingw32-pango-1.30.0-2.19.noarch.rpm mingw32-pango-devel-1.30.0-2.19.noarch.rpm mingw32-pangomm-2.28.4-1.25.noarch.rpm mingw32-pangomm-devel-2.28.4-1.25.noarch.rpm mingw32-pixman-0.26.0-1.4.noarch.rpm mingw32-pixman-devel-0.26.0-1.4.noarch.rpm 2. Copy the current devlibs and rename it devlibs-gtk3. 3. Copy the uncompressed files in the new devlibs (overwrite the libs with the same name). 4. Remove old libs (gtk2, gtkmm2, gdk2, gdkmm2, gail1, and some others). 5. Download a recent Inkscape trunk revision (from Launchpad). 6. Modify the mingenv.bat file: ----- @echo Setting environment variables for MinGw build of Inkscape IF "%DEVLIBS_PATH%"=="" set DEVLIBS_PATH=\devlibs-gtk3 IF "%MINGW_PATH%"=="" set MINGW_PATH=\mingw set MINGW_BIN=%MINGW_PATH%\bin set PKG_CONFIG_PATH=%DEVLIBS_PATH%\lib\pkgconfig set PATH=%DEVLIBS_PATH%\bin;%DEVLIBS_PATH%\python;%MINGW_BIN%;%PATH% ----- 7. Modify the build.xml file with the following patch: --- build.xml Mon Jul 30 07:50:47 2012 +++ build.xml Mon Jul 30 16:35:57 2012 @@ -198,6 +198,9 @@ #define HAVE_ASPELL 1 + #define WITH_GTKMM_3_0 1 + #define WITH_GTKMM_2_24 1 + #endif /* _CONFIG_H_ */ @@ -352,26 +355,32 @@ -DHAVE_SSL -DRELAYTOOL_SSL="static const int libssl_is_present=1; static int __attribute__((unused)) libssl_symbol_is_present(char *s){ return 1; }" -DPOPPLER_NEW_GFXFONT + -DPOPPLER_NEW_GFXPATCH - + -DPOPPLER_NEW_ERRORAPI -DGLIBMM_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES - -DGDKMM_DISABLE_DEPRECATED + -DGSEAL_ENABLE -I${devlibs}/include - ${pcc.gtkmm-2.4} + ${pcc.gtkmm-3.0} + ${pcc.gdkmm-3.0} + ${pcc.gtk+-3.0} + ${pcc.gdk-3.0} + ${pcc.glibmm-2.4} ${pcc.Magick++} ${pcc.libxml-2.0} ${pcc.freetype2} - ${pcc.cairo} + ${pcc.cairomm-1.0} + ${pcc.pangomm-1.4} ${pcc.poppler} -I${devlibs}/include/gc ${pcc.libwpg-0.1} ${pcc.libwpg-stream-0.1} @@ -466,7 +475,11 @@ -L${devlibs}/lib ${pcl.poppler-cairo} ${pcl.poppler-glib} ${pcl.poppler} - ${pcl.gtkmm-2.4} ${pcl.pangoft2} ${pcl.gthread-2.0} + ${pcl.pangoft2} ${pcl.gthread-2.0} + ${pcl.gtkmm-3.0} ${pcl.gdkmm-3.0} + ${pcl.gtk+-3.0} ${pcl.gdk-3.0} + ${pcl.glibmm-2.4} ${pcl.glib-2.0} + ${pcl.pangomm-1.4} ${devlibs}/bin/libxml2.dll ${devlibs}/bin/libxslt.dll ${pcl.cairo} ${pcl.cairomm-1.0} @@ -537,7 +550,11 @@ -L${devlibs}/lib ${pcl.poppler-cairo} ${pcl.poppler-glib} ${pcl.poppler} - ${pcl.gtkmm-2.4} ${pcl.pangoft2} ${pcl.gthread-2.0} + ${pcl.pangoft2} ${pcl.gthread-2.0} + ${pcl.gtkmm-3.0} ${pcl.gdkmm-3.0} + ${pcl.gtk+-3.0} ${pcl.gdk-3.0} + ${pcl.glibmm-2.4} ${pcl.glib-2.0} + ${pcl.pangomm-1.4} ${devlibs}/bin/libxml2.dll ${devlibs}/bin/libxslt.dll ${pcl.cairo} ${pcl.cairomm-1.0} @@ -586,7 +603,11 @@ -L${devlibs}/lib ${pcl.poppler-cairo} ${pcl.poppler-glib} ${pcl.poppler} - ${pcl.gtkmm-2.4} ${pcl.pangoft2} ${pcl.gthread-2.0} + ${pcl.pangoft2} ${pcl.gthread-2.0} + ${pcl.gtkmm-3.0} ${pcl.gdkmm-3.0} + ${pcl.gtk+-3.0} ${pcl.gdk-3.0} + ${pcl.glibmm-2.4} ${pcl.glib-2.0} + ${pcl.pangomm-1.4} ${devlibs}/bin/libxml2.dll ${devlibs}/bin/libxslt.dll ${pcl.cairo} ${pcl.cairomm-1.0} @@ -624,32 +645,35 @@ - - + + + + + - + - + - - + + - - + + - + @@ -660,9 +684,9 @@ - - - + + + @@ -676,6 +700,8 @@ + + @@ -694,7 +720,7 @@ - + @@ -727,7 +753,7 @@ - + gtk-icon-sizes = "gtk-menu=16,16:gtk-small-toolbar=16,16:gtk-large-toolbar=24,24:gtk-dnd=32,32:inkscape-decoration=16,16" gtk-toolbar-icon-size = small-toolbar 8. In the devlibs includes, modify the giomm.h header file by commenting all the dbus related includes (doesn't work on Windows). 9. Modify some Inkscape files with the following patch (deprecations): --- src/ui/dialog/filedialogimpl-win32.cpp Mon Jul 30 07:50:47 2012 +++ src/ui/dialog/filedialogimpl-win32.cpp Mon Jul 30 13:55:28 2012 @@ -26,6 +26,7 @@ #include #include #include +#include #include //Inkscape includes @@ -133,7 +134,7 @@ Glib::RefPtr parentWindow = parent.get_window(); g_assert(parentWindow->gobj() != NULL); - _ownerHwnd = (HWND)gdk_win32_drawable_get_handle((GdkDrawable*)parentWindow->gobj()); + _ownerHwnd = (HWND)gdk_win32_window_get_handle((GdkWindow*)parentWindow->gobj()); } FileDialogBaseWin32::~FileDialogBaseWin32() @@ -1575,16 +1576,17 @@ // We can only run one worker thread at a time if(_mutex != NULL) return false; + /* if(!Glib::thread_supported()) Glib::thread_init(); - + */ _result = false; _finished = false; _file_selected = false; - _mutex = new Glib::Mutex(); + _mutex = new Glib::Threads::Mutex(); _main_loop = g_main_loop_new(g_main_context_default(), FALSE); - if(Glib::Thread::create(sigc::mem_fun(*this, &FileOpenDialogImplWin32::GetOpenFileName_thread), true)) + if(Glib::Threads::Thread::create(sigc::mem_fun(*this, &FileOpenDialogImplWin32::GetOpenFileName_thread))) { while(1) { @@ -1803,15 +1805,16 @@ bool FileSaveDialogImplWin32::show() { + /* if(!Glib::thread_supported()) Glib::thread_init(); - + */ _result = false; _main_loop = g_main_loop_new(g_main_context_default(), FALSE); if(_main_loop != NULL) { - if(Glib::Thread::create(sigc::mem_fun(*this, &FileSaveDialogImplWin32::GetSaveFileName_thread), true)) + if(Glib::Threads::Thread::create(sigc::mem_fun(*this, &FileSaveDialogImplWin32::GetSaveFileName_thread))) g_main_loop_run(_main_loop); if(_result) --- src/ui/dialog/filedialogimpl-win32.h Mon Jul 30 07:50:47 2012 +++ src/ui/dialog/filedialogimpl-win32.h Mon Jul 30 13:32:47 2012 @@ -226,7 +226,7 @@ /// This mutex is used to ensure that the worker thread /// that calls GetOpenFileName cannot collide with the /// main Inkscape thread - Glib::Mutex *_mutex; + Glib::Threads::Mutex *_mutex; /// The controller function for the thread which calls 10. Download an upstream GDL version (3.4.2 looks good, 3.5.x introduces deprecations). (from http://ftp.gnome.org/pub/GNOME/sources/gdl/3.4/) 11. Replace the Inkscape src/libgdl directory with the new one. 12. Replace with "libgdl/*.h" in all the gdl header files. 13. Comment "bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);" in gdl-i18n.c 14. Build Inkscape with btool. Run. Unfortunately, it Inkscape crashes with the following backtrace: Program received signal SIGSEGV, Segmentation fault. 0x6fc8fd21 in ?? () from D:\Inkscape\inkscape-11562+gtk3\inkscape\libstdc++-6.dll (gdb) bt #0 0x6fc8fd21 in ?? () from D:\Inkscape\inkscape-11562+gtk3\inkscape\libstdc++-6.dll #1 0x011a4e0c in std::__ioinit () #2 0x011a4e0c in std::__ioinit () #3 0x0022ff0f in ?? () #4 0x77c04e00 in onexit () from C:\WINDOWS\system32\msvcrt.dll #5 0x77c04e29 in onexit () from C:\WINDOWS\system32\msvcrt.dll #6 0x000001f0 in ?? () #7 0x00401098 in __mingw_CRTStartup () at ../mingw/crt1.c:236 #8 0x0040129c in WinMainCRTStartup () at ../mingw/crt1.c:278 ------------------------------------------------------------------------------