Bug 1159273 - Allow loading of tree cairo and system cairo at the same time. r=glandium
authorLee Salzman <lsalzman@mozilla.com>
Thu, 07 May 2015 17:08:20 -0400
changeset 274404 642ea5f65b817643f7d9efbd78ac103fad72abe1
parent 274403 d495587bc0d2df281746ccb3fb0f9ce9b56d64fd
child 274405 521cd645b1af8783de81f66e8d5fde22ea3c2442
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1159273
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1159273 - Allow loading of tree cairo and system cairo at the same time. r=glandium
config/system-headers
configure.in
media/webrtc/signaling/test/common.build
widget/gtk/moz.build
--- a/config/system-headers
+++ b/config/system-headers
@@ -233,37 +233,32 @@ Bitmap.h
 bitset
 blapi.h
 bsd/libc.h
 bsd/syscall.h
 bstring.h
 builtin.h
 Button.h
 byteswap.h
-#if MOZ_TREE_CAIRO!=1
-#define WRAP_CAIRO_HEADERS
-#endif
-#ifdef WRAP_CAIRO_HEADERS
 pixman.h
 cairo.h
 cairo-atsui.h
 cairo-beos.h
 cairo-ft.h
 cairo-glitz.h
 cairo-pdf.h
 cairo-ps.h
 cairo-tee.h
 cairo-quartz.h
 cairo-win32.h
 cairo-xlib.h
 cairo-xlib-xrender.h
 cairo-directfb.h
 cairo-qpainter.h
 cairo-qt.h
-#endif
 dfiff.h
 exception
 ffi.h
 fusion/reactor.h
 fusion/property.h
 fusion/conf.h
 fusion/build.h
 fusion/hash.h
--- a/configure.in
+++ b/configure.in
@@ -8052,23 +8052,17 @@ if test "$USE_FC_FREETYPE"; then
         fi
     ])
 fi
 
 dnl ========================================================
 dnl Check for pixman and cairo
 dnl ========================================================
 
-if test "$MOZ_WIDGET_TOOLKIT" = "gtk3" ; then
-  # cairo-gtk3 can be build with system-cairo only
-  MOZ_TREE_CAIRO=
-else
-  MOZ_TREE_CAIRO=1
-fi
-
+MOZ_TREE_CAIRO=1
 MOZ_ARG_ENABLE_BOOL(system-cairo,
 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
 MOZ_TREE_CAIRO=,
 MOZ_TREE_CAIRO=1 )
 
 MOZ_TREE_PIXMAN=1
 MOZ_ARG_ENABLE_BOOL(system-pixman,
 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
@@ -8150,19 +8144,16 @@ if test "$MOZ_TREE_CAIRO"; then
 
         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
 
         dnl D3D10 Layers depend on D2D Surfaces.
         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
         fi
         ;;
-      gtk3)
-        AC_MSG_ERROR([cairo-gtk3 toolkit is incompatible with in-tree cairo. Please add --enable-system-cairo to your build config.])
-        ;;
     esac
     if test "$USE_FC_FREETYPE"; then
         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
     fi
     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
--- a/media/webrtc/signaling/test/common.build
+++ b/media/webrtc/signaling/test/common.build
@@ -118,16 +118,17 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2
     OS_LIBS += CONFIG['XLIBS']
     OS_LIBS += CONFIG['MOZ_GTK2_LIBS']
     OS_LIBS += [
         'gmodule-2.0',
         'gthread-2.0',
     ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
+    OS_LIBS += CONFIG['XLIBS']
     OS_LIBS += CONFIG['MOZ_GTK3_LIBS']
     USE_LIBS += [
         'freetype',
     ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
     OS_LIBS += CONFIG['XLIBS']
     OS_LIBS += CONFIG['TK_LIBS']
--- a/widget/gtk/moz.build
+++ b/widget/gtk/moz.build
@@ -92,16 +92,26 @@ if CONFIG['MOZ_X11']:
         '/widget/x11',
     ]
 
 DEFINES['CAIRO_GFX'] = True
 
 DEFINES['MOZ_APP_NAME'] = '"%s"' % CONFIG['MOZ_APP_NAME']
 
 CFLAGS += CONFIG['MOZ_STARTUP_NOTIFICATION_CFLAGS']
-CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
+
+# When building with GTK3, the widget code always needs to use
+# system Cairo headers, regardless of whether we are also linked
+# against and using in-tree Cairo. By not using in-tree Cairo
+# headers, we avoid picking up our renamed symbols, and instead
+# use only system Cairo symbols that GTK3 uses. This allows that
+# any Cairo objects created can be freely passed back and forth
+# between the widget code and GTK3.
+if not (CONFIG['MOZ_ENABLE_GTK3'] and CONFIG['MOZ_TREE_CAIRO']):
+    CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
+
 CXXFLAGS += CONFIG['MOZ_STARTUP_NOTIFICATION_CFLAGS']
 
 CFLAGS += CONFIG['TK_CFLAGS']
 CXXFLAGS += CONFIG['TK_CFLAGS']
 
 if CONFIG['MOZ_ENABLE_DBUS']:
     CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']