Bug 877626 - Port GTK2 to GTK3 - build config - xpcom, toolkit, accessible, xulrunner dirs. r=ted, r=karlt
authorMartin Stransky <stransky@redhat.com>
Mon, 10 Jun 2013 08:36:26 -0400
changeset 134858 623845a50e24c150096628767490b5ddb8b5e9b4
parent 134857 c85bb776152843fc518f582a5ff00673996e9046
child 134859 9aeae1c96b26041633d69468eb7cbff68628abe5
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersted, karlt
bugs877626
milestone24.0a1
Bug 877626 - Port GTK2 to GTK3 - build config - xpcom, toolkit, accessible, xulrunner dirs. r=ted, r=karlt
accessible/src/atk/Makefile.in
accessible/src/base/Makefile.in
accessible/src/generic/Makefile.in
accessible/src/html/Makefile.in
accessible/src/moz.build
accessible/src/xpcom/Makefile.in
accessible/src/xul/Makefile.in
toolkit/components/remote/moz.build
toolkit/crashreporter/client/Makefile.in
toolkit/crashreporter/client/moz.build
toolkit/library/Makefile.in
toolkit/moz.build
toolkit/mozapps/installer/packager.mk
toolkit/mozapps/update/updater/Makefile.in
toolkit/mozapps/update/updater/moz.build
toolkit/system/gnome/Makefile.in
toolkit/xre/Makefile.in
toolkit/xre/moz.build
widget/gtk2/Makefile.in
widget/moz.build
widget/xpwidgets/Makefile.in
widget/xpwidgets/moz.build
xpcom/base/Makefile.in
xpcom/base/nsSystemInfo.cpp
xpcom/components/Makefile.in
xpcom/components/ManifestParser.cpp
xulrunner/app/Makefile.in
--- a/accessible/src/atk/Makefile.in
+++ b/accessible/src/atk/Makefile.in
@@ -13,18 +13,20 @@ LIBRARY_NAME = accessibility_toolkit_s
 EXPORT_LIBRARY = ..
 LIBXUL_LIBRARY = 1
 
 # we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 include $(topsrcdir)/config/rules.mk
 
-CFLAGS  	+= $(MOZ_GTK2_CFLAGS)
-CXXFLAGS  += $(MOZ_GTK2_CFLAGS)
+ifdef MOZ_ENABLE_GTK
+CFLAGS      += $(TK_CFLAGS)
+CXXFLAGS    += $(TK_CFLAGS)
+endif
 
 ifdef MOZ_ENABLE_DBUS
 CXXFLAGS += $(MOZ_DBUS_CFLAGS)
 endif
 
 LOCAL_INCLUDES += \
   -I$(srcdir) \
   -I$(srcdir)/../base \
--- a/accessible/src/base/Makefile.in
+++ b/accessible/src/base/Makefile.in
@@ -23,19 +23,21 @@ LOCAL_INCLUDES += \
   -I$(srcdir)/../html \
   -I$(srcdir)/../xpcom \
   -I$(srcdir)/../xul \
   -I$(srcdir)/../../../layout/generic \
   -I$(srcdir)/../../../layout/style \
   -I$(srcdir)/../../../layout/svg \
   -I$(srcdir)/../../../layout/xul/base/src \
   -I$(srcdir)/../../../layout/xul/tree/ \
+  -I$(srcdir)/../../../ipc/chromium/src \
   $(NULL)
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
+ifdef MOZ_ENABLE_GTK
+CXXFLAGS        += $(MOZ_CAIRO_CFLAGS)
 LOCAL_INCLUDES += \
   -I$(srcdir)/../atk \
   $(NULL)
 else
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
 LOCAL_INCLUDES += \
   -I$(srcdir)/../windows/msaa \
   -I$(srcdir)/../windows/ia2 \
--- a/accessible/src/generic/Makefile.in
+++ b/accessible/src/generic/Makefile.in
@@ -23,17 +23,17 @@ LOCAL_INCLUDES = \
   -I$(srcdir)/../html \
   -I$(srcdir)/../xul \
   -I$(srcdir)/../../../content/base/src \
   -I$(srcdir)/../../../content/html/content/src \
   -I$(srcdir)/../../../layout/generic \
   -I$(srcdir)/../../../layout/xul/base/src \
   $(NULL)
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
+ifdef MOZ_ENABLE_GTK
 LOCAL_INCLUDES += \
   -I$(srcdir)/../atk \
   $(NULL)
 else
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
 LOCAL_INCLUDES += \
   -I$(srcdir)/../windows/msaa \
   $(NULL)
--- a/accessible/src/html/Makefile.in
+++ b/accessible/src/html/Makefile.in
@@ -24,17 +24,17 @@ LOCAL_INCLUDES = \
   -I$(srcdir)/../xpcom \
   -I$(srcdir)/../../../content/base/src \
   -I$(srcdir)/../../../content/html/content/src \
   -I$(srcdir)/../../../layout/generic \
   -I$(srcdir)/../../../layout/tables \
   -I$(srcdir)/../../../layout/xul/base/src \
   $(NULL)
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
+ifdef MOZ_ENABLE_GTK
 LOCAL_INCLUDES += \
   -I$(srcdir)/../atk \
   $(NULL)
 else
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
 LOCAL_INCLUDES += \
   -I$(srcdir)/../windows/msaa \
   -I$(srcdir)/../windows/ia2 \
--- a/accessible/src/moz.build
+++ b/accessible/src/moz.build
@@ -1,17 +1,17 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
 
-if toolkit == 'gtk2':
+if CONFIG['MOZ_ENABLE_GTK']:
     DIRS += ['atk']
 elif toolkit == 'windows':
     DIRS += ['windows']
 elif toolkit == 'cocoa':
     DIRS += ['mac']
 else:
     DIRS += ['other']
 
--- a/accessible/src/xpcom/Makefile.in
+++ b/accessible/src/xpcom/Makefile.in
@@ -20,17 +20,17 @@ EXTRA_MDDEPEND_FILES = xpcAccEvents.pp
 
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES = \
   -I$(srcdir)/../base \
   -I$(srcdir)/../generic \
   $(NULL)
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
+ifdef MOZ_ENABLE_GTK
 LOCAL_INCLUDES += \
   -I$(srcdir)/../atk \
   $(NULL)
 else
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
 LOCAL_INCLUDES += \
   -I$(srcdir)/../windows/msaa \
   $(NULL)
--- a/accessible/src/xul/Makefile.in
+++ b/accessible/src/xul/Makefile.in
@@ -24,17 +24,17 @@ LOCAL_INCLUDES = \
   -I$(srcdir)/../generic \
   -I$(srcdir)/../html \
   -I$(srcdir)/../xpcom \
   -I$(srcdir)/../../../layout/generic \
   -I$(srcdir)/../../../layout/xul/base/src \
   -I$(srcdir)/../../../layout/xul/tree// \
   $(NULL)
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
+ifdef MOZ_ENABLE_GTK
 LOCAL_INCLUDES += \
   -I$(srcdir)/../atk \
   $(NULL)
 else
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
 LOCAL_INCLUDES += \
   -I$(srcdir)/../windows/msaa \
   -I$(srcdir)/../windows/ia2 \
--- a/toolkit/components/remote/moz.build
+++ b/toolkit/components/remote/moz.build
@@ -11,16 +11,16 @@ XPIDL_SOURCES += [
 XPIDL_MODULE = 'toolkitremote'
 
 MODULE = 'toolkitcomps'
 
 CPP_SOURCES += [
     'nsXRemoteService.cpp',
 ]
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2':
+if CONFIG['MOZ_ENABLE_GTK']:
     CPP_SOURCES += [
         'nsGTKRemoteService.cpp',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
     CPP_SOURCES += [
         'nsQtRemoteService.cpp',
     ]
--- a/toolkit/crashreporter/client/Makefile.in
+++ b/toolkit/crashreporter/client/Makefile.in
@@ -44,33 +44,33 @@ OS_LIBS += -framework Cocoa
 LIBS += \
   $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/$(LIB_PREFIX)breakpad_common_s.$(LIB_SUFFIX) \
   $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/mac/$(LIB_PREFIX)breakpad_mac_common_s.$(LIB_SUFFIX) \
   $(NULL)
 
 LOCAL_INCLUDES += -I$(srcdir) -I$(srcdir)/../google-breakpad/src/common/mac/
 endif
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
+ifdef MOZ_WIDGET_GTK
 
 ifdef MOZ_PLATFORM_MAEMO
 # Maemo's libcurl doesn't ship with a set of CA certificates,
 # so we have to ship our own.
 libs:: $(DIST)/bin/crashreporter.crt
 
 $(DIST)/bin/crashreporter.crt: $(topsrcdir)/security/nss/lib/ckfw/builtins/certdata.txt certdata2pem.py
 	$(PYTHON) $(srcdir)/certdata2pem.py < $< > $@
 endif
 
 LIBS += \
   $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/linux/$(LIB_PREFIX)breakpad_linux_common_s.$(LIB_SUFFIX) \
   $(NULL)
 LOCAL_INCLUDES += -I$(srcdir)
-OS_CXXFLAGS += $(MOZ_GTK2_CFLAGS) $(MOZ_GTHREAD_CFLAGS)
-OS_LIBS += $(MOZ_GTK2_LIBS) $(MOZ_GTHREAD_LIBS)
+OS_CXXFLAGS += $(TK_CFLAGS) $(MOZ_GTHREAD_CFLAGS)
+OS_LIBS += $(TK_LIBS) $(MOZ_GTHREAD_LIBS)
 endif
 
 ifeq ($(OS_ARCH),SunOS)
 LIBS += \
   $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/solaris/$(LIB_PREFIX)breakpad_solaris_common_s.$(LIB_SUFFIX) \
   $(NULL)
 LOCAL_INCLUDES += -I$(srcdir)
 OS_CXXFLAGS += $(MOZ_GTK2_CFLAGS) $(MOZ_GTHREAD_CFLAGS)
--- a/toolkit/crashreporter/client/moz.build
+++ b/toolkit/crashreporter/client/moz.build
@@ -4,17 +4,17 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'crashreporter'
 
 if CONFIG['OS_TARGET'] != 'Android':
     PROGRAM = 'crashreporter'
 # The xpcshell test case here verifies that the CA certificate list
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2' and CONFIG['MOZ_PLATFORM_MAEMO']:
+if CONFIG['MOZ_ENABLE_GTK'] and CONFIG['MOZ_PLATFORM_MAEMO']:
     XPCSHELL_TESTS_MANIFESTS += ['maemo-unit/xpcshell.ini']
 
 CPP_SOURCES += [
     'crashreporter.cpp',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     CPP_SOURCES += [
@@ -25,17 +25,17 @@ elif CONFIG['OS_ARCH'] == 'Darwin':
         'crashreporter_unix_common.cpp',
     ]
 elif CONFIG['OS_ARCH'] == 'SunOS':
     CPP_SOURCES += [
         'crashreporter_linux.cpp',
         'crashreporter_unix.cpp',
     ]
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2':
+if CONFIG['MOZ_ENABLE_GTK']:
     CPP_SOURCES += [
         'crashreporter_gtk_common.cpp',
         'crashreporter_unix_common.cpp',
     ]
     if CONFIG['MOZ_PLATFORM_MAEMO']:
         CPP_SOURCES += [
             'crashreporter_maemo_gtk.cpp',
         ]
--- a/toolkit/library/Makefile.in
+++ b/toolkit/library/Makefile.in
@@ -181,17 +181,17 @@ COMPONENT_LIBS += \
 endif
 
 COMPONENT_LIBS += \
   jsperf \
   gkplugin \
   $(NULL)
 
 ifdef MOZ_XUL
-ifdef MOZ_ENABLE_GTK2
+ifdef MOZ_ENABLE_GTK
 COMPONENT_LIBS += \
   unixproxy \
   $(NULL)
 endif
 endif
 
 ifneq (,$(filter cocoa,$(MOZ_WIDGET_TOOLKIT)))
 COMPONENT_LIBS += \
@@ -264,28 +264,32 @@ endif
 ifdef MOZ_XUL
 COMPONENT_LIBS += \
 	tkautocomplete \
 	satchel \
 	pippki \
 	$(NULL)
 endif
 
+ifdef MOZ_ENABLE_GTK3
+COMPONENT_LIBS += widget_gtk3
+endif
+
 ifdef MOZ_ENABLE_GTK2
 COMPONENT_LIBS += widget_gtk2
 endif
 
 ifdef MOZ_ENABLE_GTK2
 ifdef MOZ_X11
 STATIC_LIBS += gtkxtbin
 endif
 endif
 
 # Platform-specific icon channel stuff - supported mostly-everywhere
-ifneq (,$(filter windows os2 mac cocoa gtk2 qt android,$(MOZ_WIDGET_TOOLKIT)))
+ifneq (,$(filter windows os2 mac cocoa gtk2 gtk3 qt android,$(MOZ_WIDGET_TOOLKIT)))
 DEFINES += -DICON_DECODER
 COMPONENT_LIBS += imgicon
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),android)
 COMPONENT_LIBS += widget_android
 STATIC_LIBS += skia_npapi
 endif
@@ -525,18 +529,19 @@ endif
 ifdef MOZ_ENABLE_LIBCONIC
 EXTRA_DSO_LDOPTS += $(LIBCONIC_LIBS)
 endif
 
 ifdef MOZ_ENABLE_DBUS
 EXTRA_DSO_LDOPTS += $(MOZ_DBUS_GLIB_LIBS)
 endif
 
-ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT))
-EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS) $(XEXT_LIBS) $(XCOMPOSITE_LIBS) $(MOZ_PANGO_LIBS) $(MOZ_GTK2_LIBS) $(XT_LIBS) -lgthread-2.0
+ifdef MOZ_WIDGET_GTK
+EXTRA_DSO_LDOPTS += $(TK_LIBS)
+EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS) $(XEXT_LIBS) $(XCOMPOSITE_LIBS) $(MOZ_PANGO_LIBS) $(XT_LIBS) -lgthread-2.0
 EXTRA_DSO_LDOPTS += $(FT2_LIBS)
 endif
 
 ifeq (qt,$(MOZ_WIDGET_TOOLKIT))
 EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS) $(XT_LIBS) $(MOZ_QT_LIBS)
 EXTRA_DSO_LDOPTS += $(FT2_LIBS) $(MOZ_PANGO_LIBS)
 EXTRA_DSO_LDOPTS += $(LIBXUL_DIST)/../widget/qt/faststartupqt/$(LIB_PREFIX)faststartupqt.$(LIB_SUFFIX)
 endif
--- a/toolkit/moz.build
+++ b/toolkit/moz.build
@@ -25,17 +25,17 @@ PARALLEL_DIRS += [
 
 DIRS += ['mozapps/update']
 
 if CONFIG['MOZ_MAINTENANCE_SERVICE']:
     DIRS += ['components/maintenanceservice']
 
 DIRS += ['xre']
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'qt'):
+if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'qt'):
     PARALLEL_DIRS += ['system/unixproxy']
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     PARALLEL_DIRS += ['system/osxproxy']
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
     PARALLEL_DIRS += ['system/windowsproxy']
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
     PARALLEL_DIRS += ['system/androidproxy']
 
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -11,17 +11,17 @@ ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 MOZ_PKG_FORMAT  = DMG
 else
 ifeq (,$(filter-out OS2 WINNT, $(OS_ARCH)))
 MOZ_PKG_FORMAT  = ZIP
 else
 ifeq (,$(filter-out SunOS, $(OS_ARCH)))
    MOZ_PKG_FORMAT  = BZ2
 else
-   ifeq (,$(filter-out gtk2 qt, $(MOZ_WIDGET_TOOLKIT)))
+   ifeq (,$(filter-out gtk2 gtk3 qt, $(MOZ_WIDGET_TOOLKIT)))
       MOZ_PKG_FORMAT  = BZ2
    else
       ifeq (android,$(MOZ_WIDGET_TOOLKIT))
           MOZ_PKG_FORMAT = APK
       else
           MOZ_PKG_FORMAT = TGZ
       endif
    endif
--- a/toolkit/mozapps/update/updater/Makefile.in
+++ b/toolkit/mozapps/update/updater/Makefile.in
@@ -33,17 +33,17 @@ DEFINES += -DUNICODE -D_UNICODE
 ifndef GNU_CC
 RCFLAGS += -I$(srcdir)
 else
 RCFLAGS += --include-dir $(srcdir)
 endif
 
 endif
 
-ifneq ($(MOZ_ENABLE_GTK2),)
+ifdef MOZ_WIDGET_GTK
 OS_CXXFLAGS += $(TK_CFLAGS)
 OS_LIBS += $(TK_LIBS)
 endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 DISABLED_CMMSRCS += progressui_osx.mm launchchild_osx.mm
 OS_LIBS += -framework Cocoa
 endif
@@ -70,17 +70,17 @@ DEFINES += -DNS_NO_XPCOM \
   -DMOZ_APP_VERSION='"$(MOZ_APP_VERSION)"' \
   $(NULL)
 
 ifdef _MSC_VER
 WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
 WIN32_EXE_LDFLAGS += -DELAYLOAD:wsock32.dll -DELAYLOAD:crypt32.dll
 endif
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
+ifdef MOZ_WIDGET_GTK
 libs:: updater.png
 	$(NSINSTALL) -D $(DIST)/bin/icons
 	$(INSTALL) $(IFLAGS1) $^ $(DIST)/bin/icons
 endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 libs::
 	$(NSINSTALL) -D $(DIST)/bin/updater.app
@@ -106,9 +106,8 @@ CXXFLAGS += $(MOZ_BZ2_CFLAGS)
 
 ifneq (,$(filter beta release esr,$(MOZ_UPDATE_CHANNEL)))
 RCFLAGS += -DMAR_SIGNING_RELEASE_BETA=1
 else
 ifneq (,$(filter nightly aurora nightly-elm nightly-profiling nightly-oak,$(MOZ_UPDATE_CHANNEL)))
 RCFLAGS += -DMAR_SIGNING_AURORA_NIGHTLY=1
 endif
 endif
-
--- a/toolkit/mozapps/update/updater/moz.build
+++ b/toolkit/mozapps/update/updater/moz.build
@@ -16,17 +16,17 @@ have_progressui = 0
 if CONFIG['OS_ARCH'] == 'WINNT':
     have_progressui = 1
     CPP_SOURCES += [
         'loaddlls.cpp',
         'progressui_win.cpp',
         'win_dirent.cpp',
     ]
 
-if CONFIG['MOZ_ENABLE_GTK2']:
+if CONFIG['MOZ_ENABLE_GTK']:
     have_progressui = 1
     CPP_SOURCES += [
         'progressui_gtk.cpp',
     ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     have_progressui = 1
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
--- a/toolkit/system/gnome/Makefile.in
+++ b/toolkit/system/gnome/Makefile.in
@@ -28,10 +28,15 @@ LOCAL_INCLUDES += -I$(topsrcdir)/toolkit
 
 include $(topsrcdir)/config/rules.mk
 
 CXXFLAGS += \
 	$(MOZ_GCONF_CFLAGS) \
 	$(MOZ_GNOMEVFS_CFLAGS) \
 	$(MOZ_GIO_CFLAGS) \
 	$(GLIB_CFLAGS) \
-	$(MOZ_GTK2_CFLAGS) \
 	$(NULL)
+
+ifdef MOZ_ENABLE_GTK
+CXXFLAGS += \
+	$(TK_CFLAGS) \
+	$(NULL)
+endif
--- a/toolkit/xre/Makefile.in
+++ b/toolkit/xre/Makefile.in
@@ -141,17 +141,17 @@ LOCAL_INCLUDES += \
   -I$(topsrcdir)/toolkit/crashreporter \
   -I$(topsrcdir)/dom/base \
   -I$(topsrcdir)/xpcom/build \
   -I$(topsrcdir)/config \
   $(NULL)
 
 CXXFLAGS += $(TK_CFLAGS) $(MOZ_DBUS_CFLAGS) $(MOZ_DBUS_GLIB_CFLAGS)
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
+ifdef MOZ_WIDGET_GTK
 CXXFLAGS += $(MOZ_PANGO_CFLAGS)
 endif
 
 DEFINES += \
   -DOS_TARGET=\"$(OS_TARGET)\" \
   -DMOZ_WIDGET_TOOLKIT=\"$(MOZ_WIDGET_TOOLKIT)\"
 
 ifdef TARGET_XPCOM_ABI
--- a/toolkit/xre/moz.build
+++ b/toolkit/xre/moz.build
@@ -37,17 +37,17 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt
         'moc_nsNativeAppSupportQt.cpp',
         'nsNativeAppSupportQt.cpp',
         'nsQAppInstance.cpp',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'os2':
     CPP_SOURCES += [
         'nsNativeAppSupportOS2.cpp',
     ]
-elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2':
+elif CONFIG['MOZ_ENABLE_GTK']:
     CPP_SOURCES += [
         'nsNativeAppSupportUnix.cpp',
     ]
 else:
     CPP_SOURCES += [
         'nsNativeAppSupportDefault.cpp',
     ]
 
--- a/widget/gtk2/Makefile.in
+++ b/widget/gtk2/Makefile.in
@@ -5,20 +5,26 @@
 
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
+ifdef MOZ_ENABLE_GTK2
+MODULE_NAME	= nsWidgetGtk2Module
 LIBRARY_NAME	= widget_gtk2
+else
+MODULE_NAME	= nsWidgetGtk3Module
+LIBRARY_NAME	= widget_gtk3
+endif
+
 EXPORT_LIBRARY	= 1
 IS_COMPONENT	= 1
-MODULE_NAME	= nsWidgetGtk2Module
 LIBXUL_LIBRARY = 1
 
 NATIVE_THEME_SUPPORT = 1
 
 
 
 CSRCS		= \
 		mozcontainer.c \
@@ -27,27 +33,34 @@ CSRCS		= \
 ifdef ACCESSIBILITY
 CSRCS += maiRedundantObjectFactory.c
 endif
 # build our subdirs, too
 
 SHARED_LIBRARY_LIBS = ../xpwidgets/libxpwidgets_s.a
 
 ifdef NATIVE_THEME_SUPPORT
+ifdef MOZ_ENABLE_GTK2
 CSRCS		+= gtk2drawing.c
+else
+CSRCS		+= gtk3drawing.c
+endif
 DEFINES		+= -DNATIVE_THEME_SUPPORT
 endif
 
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 include $(topsrcdir)/config/rules.mk
 
-CFLAGS          += $(MOZ_GTK2_CFLAGS) $(MOZ_STARTUP_NOTIFICATION_CFLAGS)
+CFLAGS          += $(MOZ_STARTUP_NOTIFICATION_CFLAGS)
 CXXFLAGS        += $(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS) \
-		$(MOZ_GTK2_CFLAGS) $(MOZ_STARTUP_NOTIFICATION_CFLAGS)
+		               $(MOZ_STARTUP_NOTIFICATION_CFLAGS)
+
+CFLAGS          += $(TK_CFLAGS)
+CXXFLAGS        += $(TK_CFLAGS)
 
 ifdef MOZ_PLATFORM_MAEMO
 ifdef MOZ_ENABLE_GCONF
 CXXFLAGS += $(MOZ_GCONF_CFLAGS)
 endif
 endif
 
 DEFINES		+= -DCAIRO_GFX -DMOZ_APP_NAME='"$(MOZ_APP_NAME)"'
--- a/widget/moz.build
+++ b/widget/moz.build
@@ -5,17 +5,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIRS += ['shared', 'xpwidgets']
 
 toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
 
 if toolkit in ('os2', 'cocoa', 'qt', 'android', 'gonk'):
     DIRS += [toolkit]
-if toolkit in ('qt', 'android', 'gonk', 'gtk2'):
+if toolkit in ('qt', 'android', 'gonk', 'gtk2', 'gtk3'):
     EXPORTS += ['nsIPrintDialogService.h']
 
 if toolkit == 'windows':
     DIRS += ['windows']
 
     XPIDL_SOURCES += [
         'nsIJumpListBuilder.idl',
         'nsIJumpListItem.idl',
@@ -49,17 +49,17 @@ elif toolkit == 'os2':
 TEST_TOOL_DIRS += ['tests']
 
 # Don't build the DSO under the 'build' directory as windows does.
 #
 # The DSOs get built in the toolkit dir itself.  Do this so that
 # multiple implementations of widget can be built on the same
 # source tree.
 #
-if CONFIG['MOZ_ENABLE_GTK2']:
+if CONFIG['MOZ_ENABLE_GTK']:
     DIRS += ['gtk2']
 
     if CONFIG['MOZ_X11']:
         DIRS += ['gtkxtbin']
 
 XPIDL_SOURCES += [
     'nsIAppShell.idl',
     'nsIBaseWindow.idl',
--- a/widget/xpwidgets/Makefile.in
+++ b/widget/xpwidgets/Makefile.in
@@ -22,18 +22,28 @@ SHARED_LIBRARY_LIBS = ../shared/$(LIB_PR
 ifdef MOZ_X11
 SHARED_LIBRARY_LIBS += ../shared/x11/$(LIB_PREFIX)widget_shared_x11.$(LIB_SUFFIX)
 endif
 
 ifdef MOZ_ENABLE_D3D10_LAYER
 DEFINES		+= -DMOZ_ENABLE_D3D10_LAYER
 endif
 
+ifneq (,$(filter gtk3,$(MOZ_WIDGET_TOOLKIT)))
+# gtk3 shares includes with gtk2
 LOCAL_INCLUDES	+= \
-		-I$(srcdir)/../$(MOZ_WIDGET_TOOLKIT) \
+		-I$(srcdir)/../gtk2 \
+		$(NULL)
+else
+LOCAL_INCLUDES	+= \
+ 		-I$(srcdir)/../$(MOZ_WIDGET_TOOLKIT) \
+		$(NULL)
+endif
+
+LOCAL_INCLUDES	+= \
 		-I$(srcdir)/../shared \
 		-I$(topsrcdir)/layout/base \
 		-I$(topsrcdir)/layout/forms \
 		-I$(topsrcdir)/layout/generic \
 		-I$(topsrcdir)/layout/xul/base/src \
 		-I$(topsrcdir)/view/src \
 		-I$(srcdir) \
 		$(NULL)
--- a/widget/xpwidgets/moz.build
+++ b/widget/xpwidgets/moz.build
@@ -39,18 +39,18 @@ if CONFIG['MOZ_X11']:
         'GfxInfoX11.cpp'
     ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('os2', 'cocoa', 'windows'):
     CPP_SOURCES += [
         'nsBaseClipboard.cpp',
     ]
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('qt', 'gtk2', 'os2', 'cocoa', 'windows',
+if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('qt', 'gtk2', 'gtk3', 'os2', 'cocoa', 'windows',
                                     'android', 'gonk'):
     CPP_SOURCES += [
         'nsBaseFilePicker.cpp',
     ]
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('qt', 'gtk2', 'windows', 'cocoa'):
+if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('qt', 'gtk2', 'gtk3', 'windows', 'cocoa'):
     CPP_SOURCES += [
         'nsNativeTheme.cpp',
     ]
--- a/xpcom/base/Makefile.in
+++ b/xpcom/base/Makefile.in
@@ -55,18 +55,18 @@ FORCE_STATIC_LIB = 1
 
 
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 include $(topsrcdir)/config/rules.mk
 
 DEFINES		+= -D_IMPL_NS_COM
 
-ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
-CXXFLAGS        += $(MOZ_GTK2_CFLAGS)
+ifdef MOZ_WIDGET_GTK
+CXXFLAGS        += $(TK_CFLAGS)
 endif
 
 LOCAL_INCLUDES += \
 		-I$(srcdir)/../build \
 		-I$(topsrcdir)/xpcom/ds \
 		$(NULL)
 
 # We generate ErrorListCxxDefines.h from ErrorList.h using regex.  The -n option
--- a/xpcom/base/nsSystemInfo.cpp
+++ b/xpcom/base/nsSystemInfo.cpp
@@ -111,17 +111,17 @@ nsSystemInfo::Init()
     BOOL gotWow64Value = IsWow64Process(GetCurrentProcess(), &isWow64);
     NS_WARN_IF_FALSE(gotWow64Value, "IsWow64Process failed");
     if (gotWow64Value) {
       rv = SetPropertyAsBool(NS_LITERAL_STRING("isWow64"), !!isWow64);
       NS_ENSURE_SUCCESS(rv, rv);
     }
 #endif
 
-#ifdef MOZ_WIDGET_GTK2
+#if defined(MOZ_WIDGET_GTK)
     // This must be done here because NSPR can only separate OS's when compiled, not libraries.
     char* gtkver = PR_smprintf("GTK %u.%u.%u", gtk_major_version, gtk_minor_version, gtk_micro_version);
     if (gtkver) {
       rv = SetPropertyAsACString(NS_LITERAL_STRING("secondaryLibrary"),
                                  nsDependentCString(gtkver));
       PR_smprintf_free(gtkver);
       NS_ENSURE_SUCCESS(rv, rv);
     }
--- a/xpcom/components/Makefile.in
+++ b/xpcom/components/Makefile.in
@@ -27,11 +27,11 @@ LOCAL_INCLUDES	= \
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 include $(topsrcdir)/config/rules.mk
 
 DEFINES	+= -D_IMPL_NS_COM
 
-ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
-CXXFLAGS += $(MOZ_GTK2_CFLAGS)
+ifdef MOZ_WIDGET_GTK
+CXXFLAGS        += $(TK_CFLAGS)
 endif
--- a/xpcom/components/ManifestParser.cpp
+++ b/xpcom/components/ManifestParser.cpp
@@ -459,17 +459,17 @@ ParseManifest(NSLocationType type, FileL
 #elif defined(MOZ_WIDGET_COCOA)
   SInt32 majorVersion, minorVersion;
   if ((Gestalt(gestaltSystemVersionMajor, &majorVersion) == noErr) &&
       (Gestalt(gestaltSystemVersionMinor, &minorVersion) == noErr)) {
     nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
                                          majorVersion,
                                          minorVersion);
   }
-#elif defined(MOZ_WIDGET_GTK2)
+#elif defined(MOZ_WIDGET_GTK)
   nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
                                        gtk_major_version,
                                        gtk_minor_version);
 #elif defined(MOZ_WIDGET_ANDROID)
   bool isTablet = false;
   if (mozilla::AndroidBridge::Bridge()) {
     mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION", "RELEASE", osVersion);
     isTablet = mozilla::AndroidBridge::Bridge()->IsTablet();
--- a/xulrunner/app/Makefile.in
+++ b/xulrunner/app/Makefile.in
@@ -97,17 +97,17 @@ ifeq ($(OS_ARCH),WINNT)
 #
 # Set it to 256k.  See bug 127069.
 #
 ifndef GNU_CC
 LDFLAGS += /HEAP:0x40000
 endif
 endif
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
+ifdef MOZ_WIDGET_GTK
 libs::
 	$(INSTALL) $(IFLAGS1) $(DIST)/branding/default16.png $(DIST)/bin/chrome/icons/default
 	$(INSTALL) $(IFLAGS1) $(DIST)/branding/default32.png $(DIST)/bin/chrome/icons/default
 	$(INSTALL) $(IFLAGS1) $(DIST)/branding/default48.png $(DIST)/bin/chrome/icons/default
 endif
 
 # XXX applications would need to supply this file
 #export:: brand.dtd.in
@@ -115,17 +115,17 @@ endif
 
 export::
 	$(NSINSTALL) -D $(DIST)/branding
 ifeq ($(OS_ARCH),WINNT)
 	cp $(srcdir)/xulrunner.ico   $(DIST)/branding/xulrunner.ico
 	cp $(srcdir)/xulrunner.ico   $(DIST)/branding/app.ico
 	cp $(srcdir)/document.ico  $(DIST)/branding/document.ico
 endif
-ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
+ifdef MOZ_WIDGET_GTK
 	cp $(srcdir)/default16.png   $(DIST)/branding/default16.png
 	cp $(srcdir)/default32.png   $(DIST)/branding/default32.png
 	cp $(srcdir)/default48.png   $(DIST)/branding/default48.png
 endif
 ifeq ($(OS_ARCH),OS2)
 	cp $(srcdir)/xulrunner-os2.ico   $(DIST)/branding/xulrunner.ico
 endif