From 21bd66e1ea06e466754ab06ee2c5f8b737bb4bd7 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 29 Oct 2012 12:59:09 +0100 Subject: Add configure option to minimize xcb runtime dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of the xcb- libraries we depend upon are not (yet) common across distributions. This is problematic for binaries that should be working on different distributions. The patch mitigates this by: Adding the files from libxcb-proto (version 0.1.6), compiled with libxcb-1.5 xcb-util (version 0.3.9) xcb-util-image (version 0.3.9) xcb-util-keysyms (version 0.3.9) xcb-util-renderutil (version 0.3.8) xcb-util-wm (version 0.3.9) from xcb.freedesktop.org/dist to src/3rdparty/xcb. Adding a configure option '-qt-xcb' to use the sources instead of linking to the respective runtime libraries. Task-number: QTBUG-27803 Change-Id: I6ea87daa382871b2b9072a601511523fa0b9f44b Reviewed-by: Samuel Rødal --- src/plugins/platforms/xcb/README | 8 ++ src/plugins/platforms/xcb/xcb-plugin.pro | 117 +++++++++++++++++++++ .../platforms/xcb/xcb-static/xcb-static.pro | 70 ++++++++++++ src/plugins/platforms/xcb/xcb.pro | 113 +------------------- 4 files changed, 199 insertions(+), 109 deletions(-) create mode 100644 src/plugins/platforms/xcb/xcb-plugin.pro create mode 100644 src/plugins/platforms/xcb/xcb-static/xcb-static.pro (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/README b/src/plugins/platforms/xcb/README index 59d9ffe39b..2f666bebfd 100644 --- a/src/plugins/platforms/xcb/README +++ b/src/plugins/platforms/xcb/README @@ -1,5 +1,7 @@ Requires libxcb >= 1.5. +PACKAGE DEPENDENCIES + Required packages: libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm1 libxcb-icccm1-dev libxcb-sync0 libxcb-sync0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev @@ -13,3 +15,9 @@ libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-d On Fedora, the following packages are required: libxcb libxcb-devel libXrender libXrender-devel xcb-util-wm xcb-util-wm-devel xcb-util xcb-util-devel xcb-util-image xcb-util-image-devel xcb-util-keysyms xcb-util-keysyms-devel + +REDUCING RUNTIME DEPENDENCIES + +The '-qt-xcb' configure option can be used to get rid of most xcb- dependencies. Only libxcb will +still be linked dynamically, since it will be most likely be pulled in via other dependencies anyway. +This should allow for binaries that are portable across most modern Linux distributions. diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro new file mode 100644 index 0000000000..b7b5650eea --- /dev/null +++ b/src/plugins/platforms/xcb/xcb-plugin.pro @@ -0,0 +1,117 @@ +TARGET = xcb + +PLUGIN_TYPE = platforms +load(qt_plugin) + +QT += core-private gui-private platformsupport-private + + +SOURCES = \ + qxcbclipboard.cpp \ + qxcbconnection.cpp \ + qxcbintegration.cpp \ + qxcbkeyboard.cpp \ + qxcbmime.cpp \ + qxcbdrag.cpp \ + qxcbscreen.cpp \ + qxcbwindow.cpp \ + qxcbbackingstore.cpp \ + qxcbwmsupport.cpp \ + main.cpp \ + qxcbnativeinterface.cpp \ + qxcbcursor.cpp \ + qxcbimage.cpp \ + qxlibconvenience.cpp + +HEADERS = \ + qxcbclipboard.h \ + qxcbconnection.h \ + qxcbintegration.h \ + qxcbkeyboard.h \ + qxcbdrag.h \ + qxcbmime.h \ + qxcbobject.h \ + qxcbscreen.h \ + qxcbwindow.h \ + qxcbbackingstore.h \ + qxcbwmsupport.h \ + qxcbnativeinterface.h \ + qxcbcursor.h \ + qxcbimage.h \ + qxlibconvenience.h + +LIBS += -ldl + +# needed by GLX, Xcursor, XLookupString, ... +contains(QT_CONFIG, xcb-xlib) { + DEFINES += XCB_USE_XLIB + LIBS += -lX11 -lX11-xcb + + *-maemo* { + contains(QT_CONFIG, xinput2) { + # XInput2 support for Harmattan. + DEFINES += XCB_USE_XINPUT2_MAEMO + SOURCES += qxcbconnection_maemo.cpp + LIBS += -lXi + } + DEFINES += XCB_USE_MAEMO_WINDOW_PROPERTIES + } else { + contains(QT_CONFIG, xinput2) { + DEFINES += XCB_USE_XINPUT2 + SOURCES += qxcbconnection_xi2.cpp + LIBS += -lXi + } + } +} + +# to support custom cursors with depth > 1 +contains(QT_CONFIG, xcb-render) { + DEFINES += XCB_USE_RENDER + LIBS += -lxcb-render -lxcb-render-util -lXrender +} + +contains(QT_CONFIG, opengl) { + contains(QT_CONFIG, opengles2) { + DEFINES += XCB_USE_EGL + LIBS += -lEGL + HEADERS += qxcbeglsurface.h + + # EGL on MeeGo 1.2 Harmattan needs this macro to map EGLNativeDisplayType + # and other types to the correct X11 types + DEFINES += SUPPORT_X11 + } else:contains(QT_CONFIG, xcb-xlib) { + DEFINES += XCB_USE_GLX + HEADERS += qglxintegration.h + SOURCES += qglxintegration.cpp + LIBS += $$QMAKE_LIBS_DYNLOAD + contains(QT_CONFIG, xcb-glx) { + DEFINES += XCB_HAS_XCB_GLX + LIBS += -lxcb-glx + } + } +} + +DEFINES += $$QMAKE_DEFINES_XCB +LIBS += $$QMAKE_LIBS_XCB +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB + +CONFIG += qpa/genericunixfontdatabase + +contains(QT_CONFIG, dbus) { +DEFINES += XCB_USE_IBUS +QT += dbus +LIBS += -ldbus-1 +} + +OTHER_FILES += xcb.json README + +contains(QT_CONFIG, xcb-qt) { + DEFINES += XCB_USE_RENDER + XCB_DIR = ../../../3rdparty/xcb + INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude + LIBS += -lxcb -L ./xcb-static -l xcb-static +} else { + LIBS += -lxcb -lxcb-image -lxcb-keysyms -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr + !contains(DEFINES, QT_NO_SHAPE):LIBS += -lxcb-shape +} + diff --git a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro new file mode 100644 index 0000000000..0257826e09 --- /dev/null +++ b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro @@ -0,0 +1,70 @@ +# +# Statically compile in code for +# libxcb-fixes, libxcb-randr, libxcb-shm, libxcb-sync, libxcb-image, libxcb-keysyms, libxcb-icccm, libxcb-renderutil +# +TEMPLATE = lib +TARGET = xcb-static +CONFIG += staticlib + +XCB_DIR = ../../../../3rdparty/xcb + +INCLUDEPATH += $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude + +# ignore compiler warnings in 3rdparty code +QMAKE_CFLAGS_STATIC_LIB+=-w + +# +# libxcb +# +LIBXCB_DIR = $$XCB_DIR/libxcb + +SOURCES += \ + $$LIBXCB_DIR/xfixes.c \ + $$LIBXCB_DIR/randr.c \ + $$LIBXCB_DIR/shm.c \ + $$LIBXCB_DIR/sync.c \ + $$LIBXCB_DIR/render.c \ + $$LIBXCB_DIR/shape.c + +# +# xcb-util +# +XCB_UTIL_DIR = $$XCB_DIR/xcb-util + + +SOURCES += \ + $$XCB_UTIL_DIR/xcb_aux.c \ + $$XCB_UTIL_DIR/atoms.c \ + $$XCB_UTIL_DIR/event.c + +# +# xcb-util-image +# +XCB_IMAGE_DIR = $$XCB_DIR/xcb-util-image + +SOURCES += $$XCB_IMAGE_DIR/xcb_image.c + +# +# xcb-util-keysyms +# +XCB_KEYSYMS_DIR = $$XCB_DIR/xcb-util-keysyms + +SOURCES += $$XCB_KEYSYMS_DIR/keysyms.c + +# +# xcb-util-renderutil +# + +XCB_RENDERUTIL_DIR = $$XCB_DIR/xcb-util-renderutil + +SOURCES += $$XCB_RENDERUTIL_DIR/util.c + +# +# xcb-util-wm +# +XCB_WM_DIR = $$XCB_DIR/xcb-util-wm + +SOURCES += \ + $$XCB_WM_DIR/icccm.c + +OTHER_FILES = $$XCB_DIR/README diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index 8a3e9e8e5e..dab0d8cb14 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -1,110 +1,5 @@ -TARGET = xcb +TEMPLATE = subdirs +CONFIG += ordered -PLUGIN_TYPE = platforms -load(qt_plugin) - -QT += core-private gui-private platformsupport-private - - -SOURCES = \ - qxcbclipboard.cpp \ - qxcbconnection.cpp \ - qxcbintegration.cpp \ - qxcbkeyboard.cpp \ - qxcbmime.cpp \ - qxcbdrag.cpp \ - qxcbscreen.cpp \ - qxcbwindow.cpp \ - qxcbbackingstore.cpp \ - qxcbwmsupport.cpp \ - main.cpp \ - qxcbnativeinterface.cpp \ - qxcbcursor.cpp \ - qxcbimage.cpp \ - qxlibconvenience.cpp - -HEADERS = \ - qxcbclipboard.h \ - qxcbconnection.h \ - qxcbintegration.h \ - qxcbkeyboard.h \ - qxcbdrag.h \ - qxcbmime.h \ - qxcbobject.h \ - qxcbscreen.h \ - qxcbwindow.h \ - qxcbbackingstore.h \ - qxcbwmsupport.h \ - qxcbnativeinterface.h \ - qxcbcursor.h \ - qxcbimage.h \ - qxlibconvenience.h - -LIBS += -ldl - -# needed by GLX, Xcursor, XLookupString, ... -contains(QT_CONFIG, xcb-xlib) { - DEFINES += XCB_USE_XLIB - LIBS += -lX11 -lX11-xcb - - *-maemo* { - contains(QT_CONFIG, xinput2) { - # XInput2 support for Harmattan. - DEFINES += XCB_USE_XINPUT2_MAEMO - SOURCES += qxcbconnection_maemo.cpp - LIBS += -lXi - } - DEFINES += XCB_USE_MAEMO_WINDOW_PROPERTIES - } else { - contains(QT_CONFIG, xinput2) { - DEFINES += XCB_USE_XINPUT2 - SOURCES += qxcbconnection_xi2.cpp - LIBS += -lXi - } - } -} - -# to support custom cursors with depth > 1 -contains(QT_CONFIG, xcb-render) { - DEFINES += XCB_USE_RENDER - LIBS += -lxcb-render -lxcb-render-util -lXrender -} - -!contains(DEFINES, QT_NO_SHAPE):LIBS += -lxcb-shape - -contains(QT_CONFIG, opengl) { - contains(QT_CONFIG, opengles2) { - DEFINES += XCB_USE_EGL - LIBS += -lEGL - HEADERS += qxcbeglsurface.h - - # EGL on MeeGo 1.2 Harmattan needs this macro to map EGLNativeDisplayType - # and other types to the correct X11 types - DEFINES += SUPPORT_X11 - } else:contains(QT_CONFIG, xcb-xlib) { - DEFINES += XCB_USE_GLX - HEADERS += qglxintegration.h - SOURCES += qglxintegration.cpp - LIBS += $$QMAKE_LIBS_DYNLOAD - contains(QT_CONFIG, xcb-glx) { - DEFINES += XCB_HAS_XCB_GLX - LIBS += -lxcb-glx - } - } -} - -LIBS += -lxcb -lxcb-image -lxcb-keysyms -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shape -lxcb-shm -lxcb-randr - -DEFINES += $$QMAKE_DEFINES_XCB -LIBS += $$QMAKE_LIBS_XCB -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB - -CONFIG += qpa/genericunixfontdatabase - -contains(QT_CONFIG, dbus) { -DEFINES += XCB_USE_IBUS -QT += dbus -LIBS += -ldbus-1 -} - -OTHER_FILES += xcb.json +contains(QT_CONFIG, xcb-qt):SUBDIRS+=xcb-static +SUBDIRS += xcb-plugin.pro -- cgit v1.2.3