summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorD. Can Celasun2022-11-17 21:16:38 +0000
committerD. Can Celasun2022-11-17 21:16:38 +0000
commit11118b02cbc396df6eaa23b2b644103589994205 (patch)
tree214eec42d5771d28016f568f0f942f36c0a93940
downloadaur-11118b02cbc396df6eaa23b2b644103589994205.tar.gz
[libx11-firefox-fix] Initial commit
See https://gitlab.freedesktop.org/xorg/lib/libx11/-/issues/168
-rw-r--r--.SRCINFO23
-rw-r--r--PKGBUILD55
-rw-r--r--patch.diff140
3 files changed, 218 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..2198513b5c9e
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,23 @@
+pkgbase = libx11-firefox-fix
+ pkgdesc = X11 client-side library (with Firefox freeze fix)
+ pkgver = 1.8.2
+ pkgrel = 1
+ url = https://xorg.freedesktop.org/
+ arch = x86_64
+ license = custom
+ makedepends = xorg-util-macros
+ makedepends = xtrans
+ depends = libxcb
+ depends = xorgproto
+ provides = libx11=1.8.2
+ conflicts = libx11
+ options = debug
+ source = patch.diff
+ source = https://xorg.freedesktop.org//releases/individual/lib/libX11-1.8.2.tar.xz
+ source = https://xorg.freedesktop.org//releases/individual/lib/libX11-1.8.2.tar.xz.sig
+ validpgpkeys = 4A193C06D35E7C670FA4EF0BA2FB9E081F2D130E
+ sha512sums = 4871a9f39d8988d38d4b0d4ea49fcc30019024dfe12e999c903b932f4c11f17c1e63852ffb2ec5585430086bf02b1ffc0668c02ef86a6899a3b687ab1e6e11c4
+ sha512sums = 662ee8043d9ba27df82f647515b701d6f302a52715f21afdaba391f3b70691753e3649e7ff8322e07858be4297df9cbb19227958d676ed6dea198cce64330d1d
+ sha512sums = SKIP
+
+pkgname = libx11-firefox-fix
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..4f30ed868dcd
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,55 @@
+# Maintainer: Andreas Radke <andyrtr@archlinux.org>
+
+pkgname=libx11-firefox-fix
+_pkgname=libx11
+pkgver=1.8.2
+pkgrel=1
+pkgdesc="X11 client-side library (with Firefox freeze fix)"
+arch=(x86_64)
+url="https://xorg.freedesktop.org/"
+# keep xorgproto runtime dependency
+# https://lists.archlinux.org/pipermail/arch-dev-public/2019-December/029767.html
+depends=('libxcb' 'xorgproto')
+makedepends=('xorg-util-macros' 'xtrans')
+license=('custom')
+options=('debug')
+conflicts=('libx11')
+provides=("libx11=${pkgver}")
+source=(patch.diff ${url}/releases/individual/lib/libX11-${pkgver}.tar.xz{,.sig})
+sha512sums=('4871a9f39d8988d38d4b0d4ea49fcc30019024dfe12e999c903b932f4c11f17c1e63852ffb2ec5585430086bf02b1ffc0668c02ef86a6899a3b687ab1e6e11c4'
+ '662ee8043d9ba27df82f647515b701d6f302a52715f21afdaba391f3b70691753e3649e7ff8322e07858be4297df9cbb19227958d676ed6dea198cce64330d1d'
+ 'SKIP')
+validpgpkeys=('4A193C06D35E7C670FA4EF0BA2FB9E081F2D130E') # Alan Coopersmith <alanc@freedesktop.org>
+#validpgpkeys=('C41C985FDCF1E5364576638B687393EE37D128F8') # Matthieu Herrb <matthieu.herrb@laas.fr>
+#validpgpkeys=('3BB639E56F861FA2E86505690FDD682D974CA72A') # Matt Turner <mattst88@gmail.com>
+#validpgpkeys=('995ED5C8A6138EB0961F18474C09DD83CAAA50B2') # Adam Jackson <ajax@nwnk.net>
+#validpgpkeys=('C383B778255613DFDB409D91DB221A6900000011') # "Keith Packard <keithp@keithp.com>"
+
+prepare() {
+ # Revert commit that causes Firefox to freeze
+ # See https://gitlab.freedesktop.org/xorg/lib/libx11/-/issues/168
+ cd "${srcdir}/libX11-${pkgver}"
+ patch -R -p1 < "${srcdir}/patch.diff"
+}
+
+build() {
+ cd libX11-${pkgver}
+ ./configure --prefix=/usr \
+ --disable-static \
+ --disable-xf86bigfont
+ sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
+ make
+}
+
+check() {
+ cd libX11-${pkgver}
+ make check
+}
+
+package() {
+ cd "${srcdir}/libX11-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -d -m755 "${pkgdir}/usr/share/licenses/${_pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${_pkgname}/"
+}
diff --git a/patch.diff b/patch.diff
new file mode 100644
index 000000000000..73d3e7f8b9d7
--- /dev/null
+++ b/patch.diff
@@ -0,0 +1,140 @@
+diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h
+index cbf3aac30bc094e0391e00b8b4c676e790a59055..b4275ebdb3608f5730bd0a6005e2b7d766bccb5c 100644
+--- a/include/X11/Xlibint.h
++++ b/include/X11/Xlibint.h
+@@ -207,6 +207,7 @@ struct _XDisplay
+
+ XIOErrorExitHandler exit_handler;
+ void *exit_handler_data;
++ Bool in_ifevent;
+ };
+
+ #define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n)
+diff --git a/src/ChkIfEv.c b/src/ChkIfEv.c
+index 876a850e6afab3d4af30ddcdca169c283a84bf78..327b5eafb30df7d17bac9342a78b7638b667eb3c 100644
+--- a/src/ChkIfEv.c
++++ b/src/ChkIfEv.c
+@@ -50,6 +50,7 @@ Bool XCheckIfEvent (
+ int n; /* time through count */
+
+ LockDisplay(dpy);
++ dpy->in_ifevent = True;
+ prev = NULL;
+ for (n = 3; --n >= 0;) {
+ for (qelt = prev ? prev->next : dpy->head;
+@@ -60,6 +61,7 @@ Bool XCheckIfEvent (
+ *event = qelt->event;
+ _XDeq(dpy, prev, qelt);
+ _XStoreEventCookie(dpy, event);
++ dpy->in_ifevent = False;
+ UnlockDisplay(dpy);
+ return True;
+ }
+@@ -78,6 +80,7 @@ Bool XCheckIfEvent (
+ /* another thread has snatched this event */
+ prev = NULL;
+ }
++ dpy->in_ifevent = False;
+ UnlockDisplay(dpy);
+ return False;
+ }
+diff --git a/src/IfEvent.c b/src/IfEvent.c
+index ead93dcac6268d8856f42656e83e1c0bc0f9d092..a0aed7e31c0272e58eaf2268dd9311996b1b0a91 100644
+--- a/src/IfEvent.c
++++ b/src/IfEvent.c
+@@ -49,6 +49,7 @@ XIfEvent (
+ unsigned long qe_serial = 0;
+
+ LockDisplay(dpy);
++ dpy->in_ifevent = True;
+ prev = NULL;
+ while (1) {
+ for (qelt = prev ? prev->next : dpy->head;
+@@ -59,6 +60,7 @@ XIfEvent (
+ *event = qelt->event;
+ _XDeq(dpy, prev, qelt);
+ _XStoreEventCookie(dpy, event);
++ dpy->in_ifevent = False;
+ UnlockDisplay(dpy);
+ return 0;
+ }
+diff --git a/src/OpenDis.c b/src/OpenDis.c
+index 5017b040ba8c9aeefcbca25b3cc6bf2131355af9..e1bc2a30494722c4c857b5a6dae043bc4a1327ce 100644
+--- a/src/OpenDis.c
++++ b/src/OpenDis.c
+@@ -189,6 +189,7 @@ XOpenDisplay (
+ dpy->xcmisc_opcode = 0;
+ dpy->xkb_info = NULL;
+ dpy->exit_handler_data = NULL;
++ dpy->in_ifevent = False;
+
+ /*
+ * Setup other information in this display structure.
+diff --git a/src/PeekIfEv.c b/src/PeekIfEv.c
+index 207cd11913b1b1978b73c8208c0130d6303c4bd0..c4e8af0de9a5cb72f6221fce6f30e8f1997579e9 100644
+--- a/src/PeekIfEv.c
++++ b/src/PeekIfEv.c
+@@ -50,6 +50,7 @@ XPeekIfEvent (
+ unsigned long qe_serial = 0;
+
+ LockDisplay(dpy);
++ dpy->in_ifevent = True;
+ prev = NULL;
+ while (1) {
+ for (qelt = prev ? prev->next : dpy->head;
+@@ -63,6 +64,7 @@ XPeekIfEvent (
+ _XStoreEventCookie(dpy, &copy);
+ *event = copy;
+ }
++ dpy->in_ifevent = False;
+ UnlockDisplay(dpy);
+ return 0;
+ }
+diff --git a/src/locking.c b/src/locking.c
+index ea5000e157e9d73f19e593b895763b6e04988f7f..36530691cc2909f09b744388517bbd5e8cc4caeb 100644
+--- a/src/locking.c
++++ b/src/locking.c
+@@ -452,6 +452,32 @@ static void _XDisplayLockWait(
+ }
+ }
+
++static void _XLockDisplay(
++ Display *dpy
++ XTHREADS_FILE_LINE_ARGS
++ );
++
++static void _XIfEventLockDisplay(
++ Display *dpy
++ XTHREADS_FILE_LINE_ARGS
++ )
++{
++ /* assert(dpy->in_ifevent); */
++}
++
++static void _XIfEventUnlockDisplay(
++ Display *dpy
++ XTHREADS_FILE_LINE_ARGS
++ )
++{
++ if (dpy->in_ifevent)
++ return;
++
++ dpy->lock_fns->lock_display = _XLockDisplay;
++ dpy->lock_fns->unlock_display = _XUnlockDisplay;
++ UnlockDisplay(dpy);
++}
++
+ static void _XLockDisplay(
+ Display *dpy
+ XTHREADS_FILE_LINE_ARGS
+@@ -478,6 +504,10 @@ static void _XLockDisplay(
+ #endif
+ _XIDHandler(dpy);
+ _XSeqSyncFunction(dpy);
++ if (dpy->in_ifevent) {
++ dpy->lock_fns->lock_display = _XIfEventLockDisplay;
++ dpy->lock_fns->unlock_display = _XIfEventUnlockDisplay;
++ }
+ }
+
+ /*