Skip to content

Commit 0c55d8b

Browse files
committed
depends: qt: Patch to remove dep on libX11
We can actually patch QT to remove its dependency on libX11's headers. It turns it this wasn't that hard.
1 parent 222e6cc commit 0c55d8b

File tree

5 files changed

+73
-29
lines changed

5 files changed

+73
-29
lines changed

depends/packages/libX11.mk

Lines changed: 0 additions & 20 deletions
This file was deleted.

depends/packages/packages.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ packages:=boost openssl libevent
33
qt_native_packages = native_protobuf
44
qt_packages = qrencode protobuf zlib
55

6-
qt_linux_packages:=qt expat libxcb xcb_proto libXau xproto freetype fontconfig libX11
6+
qt_linux_packages:=qt expat libxcb xcb_proto libXau xproto freetype fontconfig
77

88
rapidcheck_packages = rapidcheck
99

depends/packages/qt.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ $(package)_suffix=opensource-src-$($(package)_version).tar.xz
55
$(package)_file_name=qtbase-$($(package)_suffix)
66
$(package)_sha256_hash=36dd9574f006eaa1e5af780e4b33d11fe39d09fd7c12f3b9d83294174bd28f00
77
$(package)_dependencies=openssl zlib
8-
$(package)_linux_dependencies=freetype fontconfig libxcb libX11
8+
$(package)_linux_dependencies=freetype fontconfig libxcb
99
$(package)_build_subdir=qtbase
1010
$(package)_qt_libs=corelib network widgets gui plugins testlib
11-
$(package)_patches=fix_qt_pkgconfig.patch mac-qmake.conf fix_configure_mac.patch fix_no_printer.patch fix_rcc_determinism.patch fix_riscv64_arch.patch xkb-default.patch
11+
$(package)_patches=fix_qt_pkgconfig.patch mac-qmake.conf fix_configure_mac.patch fix_no_printer.patch fix_rcc_determinism.patch fix_riscv64_arch.patch xkb-default.patch no-xlib.patch
1212

1313
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
1414
$(package)_qttranslations_sha256_hash=b36da7d93c3ab6fca56b32053bb73bc619c8b192bb89b74e3bcde2705f1c2a14
@@ -158,6 +158,7 @@ define $(package)_preprocess_cmds
158158
echo "!host_build: QMAKE_CXXFLAGS += $($(package)_cxxflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
159159
echo "!host_build: QMAKE_LFLAGS += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
160160
patch -p1 -i $($(package)_patch_dir)/fix_riscv64_arch.patch &&\
161+
patch -p1 -i $($(package)_patch_dir)/no-xlib.patch &&\
161162
echo "QMAKE_LINK_OBJECT_MAX = 10" >> qtbase/mkspecs/win32-g++/qmake.conf &&\
162163
echo "QMAKE_LINK_OBJECT_SCRIPT = object_script" >> qtbase/mkspecs/win32-g++/qmake.conf &&\
163164
sed -i.old "s|QMAKE_CFLAGS = |!host_build: QMAKE_CFLAGS = $($(package)_cflags) $($(package)_cppflags) |" qtbase/mkspecs/win32-g++/qmake.conf && \

depends/patches/libX11/configure.ac

Lines changed: 0 additions & 6 deletions
This file was deleted.

depends/patches/qt/no-xlib.patch

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
From 9563cef873ae82e06f60708d706d054717e801ce Mon Sep 17 00:00:00 2001
2+
From: Carl Dong <[email protected]>
3+
Date: Thu, 18 Jul 2019 17:22:05 -0400
4+
Subject: [PATCH] Wrap xlib related code blocks in #if's
5+
6+
They are not necessary to compile QT.
7+
---
8+
qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp | 8 ++++++++
9+
1 file changed, 8 insertions(+)
10+
11+
diff --git a/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp b/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp
12+
index 7c62c2e2b3..c05c6c0a07 100644
13+
--- a/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp
14+
+++ b/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp
15+
@@ -49,7 +49,9 @@
16+
#include <QtGui/QWindow>
17+
#include <QtGui/QBitmap>
18+
#include <QtGui/private/qguiapplication_p.h>
19+
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
20+
#include <X11/cursorfont.h>
21+
+#endif
22+
#include <xcb/xfixes.h>
23+
#include <xcb/xcb_image.h>
24+
25+
@@ -384,6 +386,7 @@ void QXcbCursor::changeCursor(QCursor *cursor, QWindow *widget)
26+
w->setCursor(c, isBitmapCursor);
27+
}
28+
29+
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
30+
static int cursorIdForShape(int cshape)
31+
{
32+
int cursorId = 0;
33+
@@ -437,6 +440,7 @@ static int cursorIdForShape(int cshape)
34+
}
35+
return cursorId;
36+
}
37+
+#endif
38+
39+
xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape)
40+
{
41+
@@ -558,7 +562,9 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape)
42+
xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
43+
{
44+
xcb_connection_t *conn = xcb_connection();
45+
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
46+
int cursorId = cursorIdForShape(cshape);
47+
+#endif
48+
xcb_cursor_t cursor = XCB_NONE;
49+
50+
// Try Xcursor first
51+
@@ -589,6 +595,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
52+
// Non-standard X11 cursors are created from bitmaps
53+
cursor = createNonStandardCursor(cshape);
54+
55+
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
56+
// Create a glpyh cursor if everything else failed
57+
if (!cursor && cursorId) {
58+
cursor = xcb_generate_id(conn);
59+
@@ -596,6 +603,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
60+
cursorId, cursorId + 1,
61+
0xFFFF, 0xFFFF, 0xFFFF, 0, 0, 0);
62+
}
63+
+#endif
64+
65+
if (cursor && cshape >= 0 && cshape < Qt::LastCursor && connection()->hasXFixes()) {
66+
const char *name = cursorNames[cshape];
67+
--
68+
2.22.0
69+

0 commit comments

Comments
 (0)