Skip to contentSkip to conversation

libx11: fix libX11 keysyms to pass xts5 of lsb

PATCH In review Jingdong Lu 2 participants 3 messages May 24, 2011 – May 25, 2011

lore
Share & tools
lore
#0 lore raw

cover libx11: fix libX11 keysyms to pass xts5 of lsb

From: Jingdong Lu <[email protected]>

Fixes bug: [YOCTO #1095]
Because of cross-compiling libx11 keysyms will cause Xts5 test of LSB fail. libx11 use a tool named "makekey" which compiled as a native tool to generate ks_tables.h. Because the size of "unsigned long" is different between 32-bit and 64-bit, we should judge whether our target is 32-bit or 64-bit and tell "makekey".
I add a patch to "makekeys_crosscompile.patch" to "src/utils/makekeys.c" in order to deal with the different targets. If our target is 32-bit, we force the variable its type is "unsigned long" to "uint32_t". So we can generate a correct keysyms.

The following changes since commit 7706d5d844db2725f4118207d90e302679eacdfe:
Bruce Ashfield (1):
linux-yocto/meta-yocto: fix gcc 4.6.0 compilation failures

are available in the git repository at:

git://git.pokylinux.org/poky-contrib.git jingdonglu/distro
http://git.pokylinux.org/cgit.cgi//log/?h=jingdonglu/distro

Jingdong Lu (1):
libx11: fix libX11 keysyms to pass xts5 of lsb

 .../libx11-1.3.4/makekeys_crosscompile.patch       |   37 ++++++++++++++++++++
 .../recipes-graphics/xorg-lib/libx11-trim_1.3.4.bb |    5 ++-
 meta/recipes-graphics/xorg-lib/libx11.inc          |    8 ++++-
 meta/recipes-graphics/xorg-lib/libx11_1.3.4.bb     |    5 ++-
 4 files changed, 50 insertions(+), 5 deletions(-)
 create mode 100644 meta/recipes-graphics/xorg-lib/libx11-1.3.4/makekeys_crosscompile.patch
#1 lore raw

PATCH 1/1 libx11: fix libX11 keysyms to pass xts5 of lsb

From: Jingdong Lu <[email protected]>

Fixes bug: [YOCTO #1095]
Because of cross-compiling libx11 keysyms will cause Xts5 test of LSB fail. libx11 use a tool named "makekey" which compiled as a native tool to generate ks_tables.h. Because the size of "unsigned long" is different between 32-bit and 64-bit, we should judge whether our target is 32-bit or 64-bit and tell "makekey".
I add a patch to "makekeys_crosscompile.patch" to "src/utils/makekeys.c" in order to deal with the different targets. If our target is 32-bit, we force the variable its type is "unsigned long" to "uint32_t". So we can generate a correct keysyms.

---
 .../libx11-1.3.4/makekeys_crosscompile.patch       |   37 ++++++++++++++++++++
 .../recipes-graphics/xorg-lib/libx11-trim_1.3.4.bb |    5 ++-
 meta/recipes-graphics/xorg-lib/libx11.inc          |    8 ++++-
 meta/recipes-graphics/xorg-lib/libx11_1.3.4.bb     |    5 ++-
 4 files changed, 50 insertions(+), 5 deletions(-)
 create mode 100644 meta/recipes-graphics/xorg-lib/libx11-1.3.4/makekeys_crosscompile.patch
meta/recipes-graphics/xorg-lib/libx11-1.3.4/makekeys_crosscompile.patch new file +37 -0
new file mode 100644
index 0000000..88d66bf
@@ -0,0 +1,37 @@
+--- libX11-1.3.4.orig/src/util/makekeys.c	2010-01-15 09:11:36.000000000 +0800
++++ libX11-1.3.4/src/util/makekeys.c	2011-05-24 19:04:25.454774908 +0800
+@@ -33,6 +33,7 @@
+ #include <X11/keysymdef.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <stdint.h>
+ 
+ typedef unsigned long Signature;
+ 
+@@ -124,7 +125,12 @@
+ 	    name = info[i].name;
+ 	    sig = 0;
+ 	    while ((c = *name++))
+-		sig = (sig << 1) + c;
++#ifdef USE32
++		sig = (uint32_t)(sig << 1) + c;
++#else
++		sig = (uint64_t)(sig << 1) + c;
++#endif
++		
+ 	    first = j = sig % z;
+ 	    for (k = 0; tab[j]; k++) {
+ 		j += first + 1;
+@@ -163,7 +169,11 @@
+ 	name = info[i].name;
+ 	sig = 0;
+ 	while ((c = *name++))
+-	    sig = (sig << 1) + c;
++#ifdef USE32
++	    sig = (uint32_t)(sig << 1) + c;
++#else
++	    sig = (uint64_t)(sig << 1) + c;
++#endif
+ 	first = j = sig % z;
+ 	while (offsets[j]) {
+ 	    j += first + 1;
meta/recipes-graphics/xorg-lib/libx11-trim_1.3.4.bb +3 -2
index b013498..1469bc1 100644
@@ -5,12 +5,13 @@ DESCRIPTION += " Support for XCB, and XCMS is disabled in this version."
 LICENSE = "MIT & MIT-style & BSD"
 LIC_FILES_CHKSUM = "file://COPYING;md5=bf75bfe4d05068311b5e6862d4b5f2c5"
 
-PR = "r0"
+PR = "r1"
 
 DEPENDS += "libxcb xproto xextproto xtrans libxau kbproto inputproto xf86bigfontproto xproto-native"
 
 SRC_URI += "file://../libx11-${PV}/x11_disable_makekeys.patch \
             file://../libx11-${PV}/include_fix.patch \
-            file://../libx11-${PV}/nodolt.patch"
+            file://../libx11-${PV}/nodolt.patch \
+            file://../libx11-${PV}/makekeys_crosscompile.patch"
 
 EXTRA_OECONF += "--disable-xcms --with-xcb"
meta/recipes-graphics/xorg-lib/libx11.inc +7 -1
index 030b0db..c156ce6 100644
@@ -6,6 +6,8 @@ basic functions of the window system."
 
 require xorg-lib-common.inc
 
+inherit siteinfo
+
 PROVIDES = "virtual/libx11"
 
 XORG_PN = "libX11"
@@ -22,7 +24,11 @@ do_compile() {
 	touch makekeys-makekeys.o
 	(
 		unset CC LD CXX CCLD CFLAGS CPPFLAGS LDFLAGS CXXFLAGS
-		${BUILD_CC} ${BUILD_CFLAGS} -I${STAGING_INCDIR_NATIVE} makekeys.c -o makekeys
+		if [ "${SITEINFO_BITS}" == "64" ]; then
+                        ${BUILD_CC} ${BUILD_CFLAGS} -I${STAGING_INCDIR_NATIVE} makekeys.c -o makekeys
+                else
+                        ${BUILD_CC} ${BUILD_CFLAGS} -I${STAGING_INCDIR_NATIVE} -DUSE32 makekeys.c -o makekeys
+                fi
 	)
 	if [ "$?" != "0" ]; then
 		exit 1
meta/recipes-graphics/xorg-lib/libx11_1.3.4.bb +3 -2
index 08ba07b..3e046a1 100644
@@ -5,11 +5,12 @@ LICENSE = "MIT & MIT-style & BSD"
 LIC_FILES_CHKSUM = "file://COPYING;md5=bf75bfe4d05068311b5e6862d4b5f2c5"
 
 PE = "1"
-PR = "r0"
+PR = "r1"
 
 SRC_URI += "file://x11_disable_makekeys.patch \
             file://nodolt.patch \
-            file://include_fix.patch"
+            file://include_fix.patch \
+	    file://makekeys_crosscompile.patch"
 
 SRC_URI[md5sum] = "f65c9c7ecbfb64c19dbd7927160d63fd"
 SRC_URI[sha256sum] = "88d7238ce5f7cd123450567de7a3b56a43556e4ccc45df38b8324147c889a844"
Signature · 1 line
1.7.0.4
#2 lore raw

meta/recipes-graphics/xorg-lib/libx11-1.3.4/makekeys_crosscompile.patch

Quoted 27 lines · Jingdong Lu

From: Jingdong Lu<[email protected]>

Fixes bug: [YOCTO #1095]
Because of cross-compiling libx11 keysyms will cause Xts5 test of LSB fail. libx11 use a tool named "makekey" which compiled as a native tool to generate ks_tables.h. Because the size of "unsigned long" is different between 32-bit and 64-bit, we should judge whether our target is 32-bit or 64-bit and tell "makekey".
I add a patch to "makekeys_crosscompile.patch" to "src/utils/makekeys.c" in order to deal with the different targets. If our target is 32-bit, we force the variable its type is "unsigned long" to "uint32_t". So we can generate a correct keysyms.

---
  .../libx11-1.3.4/makekeys_crosscompile.patch       |   37 ++++++++++++++++++++
  .../recipes-graphics/xorg-lib/libx11-trim_1.3.4.bb |    5 ++-
  meta/recipes-graphics/xorg-lib/libx11.inc          |    8 ++++-
  meta/recipes-graphics/xorg-lib/libx11_1.3.4.bb     |    5 ++-
  4 files changed, 50 insertions(+), 5 deletions(-)

create mode 100644 meta/recipes-graphics/xorg-lib/libx11-1.3.4/makekeys_crosscompile.patch

meta/recipes-graphics/xorg-lib/libx11-1.3.4/makekeys_crosscompile.patch new file +0 -0
new file mode 100644
index 0000000..88d66bf

This patch needs an explanation and Signed-off-by, and this probably should be also marked at Upstream-Status: Pending, this looks like a good candidate for upstreaming.

Quoted 72 lines
meta/recipes-graphics/xorg-lib/libx11-1.3.4/makekeys_crosscompile.patch new file +37 -0
@@ -0,0 +1,37 @@
+--- libX11-1.3.4.orig/src/util/makekeys.c	2010-01-15 09:11:36.000000000 +0800
++++ libX11-1.3.4/src/util/makekeys.c	2011-05-24 19:04:25.454774908 +0800
+@@ -33,6 +33,7 @@
+ #include<X11/keysymdef.h>
+ #include<stdio.h>
+ #include<stdlib.h>
++#include<stdint.h>
+
+ typedef unsigned long Signature;
+
+@@ -124,7 +125,12 @@
+ 	    name = info[i].name;
+ 	    sig = 0;
+ 	    while ((c = *name++))
+-		sig = (sig<<  1) + c;
++#ifdef USE32
++		sig = (uint32_t)(sig<<  1) + c;
++#else
++		sig = (uint64_t)(sig<<  1) + c;
++#endif
++		
+ 	    first = j = sig % z;
+ 	    for (k = 0; tab[j]; k++) {
+ 		j += first + 1;
+@@ -163,7 +169,11 @@
+ 	name = info[i].name;
+ 	sig = 0;
+ 	while ((c = *name++))
+-	    sig = (sig<<  1) + c;
++#ifdef USE32
++	    sig = (uint32_t)(sig<<  1) + c;
++#else
++	    sig = (uint64_t)(sig<<  1) + c;
++#endif
+ 	first = j = sig % z;
+ 	while (offsets[j]) {
+ 	    j += first + 1;
meta/recipes-graphics/xorg-lib/libx11-trim_1.3.4.bb +3 -2
index b013498..1469bc1 100644
@@ -5,12 +5,13 @@ DESCRIPTION += " Support for XCB, and XCMS is disabled in this version."
  LICENSE = "MIT&  MIT-style&  BSD"
  LIC_FILES_CHKSUM = "file://COPYING;md5=bf75bfe4d05068311b5e6862d4b5f2c5"
 
-PR = "r0"
+PR = "r1"
 
  DEPENDS += "libxcb xproto xextproto xtrans libxau kbproto inputproto xf86bigfontproto xproto-native"
 
  SRC_URI += "file://../libx11-${PV}/x11_disable_makekeys.patch \
              file://../libx11-${PV}/include_fix.patch \
-            file://../libx11-${PV}/nodolt.patch"
+            file://../libx11-${PV}/nodolt.patch \
+            file://../libx11-${PV}/makekeys_crosscompile.patch"
 
  EXTRA_OECONF += "--disable-xcms --with-xcb"
meta/recipes-graphics/xorg-lib/libx11.inc +2 -0
index 030b0db..c156ce6 100644
@@ -6,6 +6,8 @@ basic functions of the window system."
 
  require xorg-lib-common.inc
 
+inherit siteinfo
+
  PROVIDES = "virtual/libx11"
 
  XORG_PN = "libX11"

meta/recipes-graphics/xorg-lib/libx11.inc do_compile() { · line 31

Quoted 9 lines
meta/recipes-graphics/xorg-lib/libx11.inc +5 -1
@@ -22,7 +24,11 @@ do_compile() {
  	touch makekeys-makekeys.o
  	(
  		unset CC LD CXX CCLD CFLAGS CPPFLAGS LDFLAGS CXXFLAGS
-		${BUILD_CC} ${BUILD_CFLAGS} -I${STAGING_INCDIR_NATIVE} makekeys.c -o makekeys
+		if [ "${SITEINFO_BITS}" == "64" ]; then
+                        ${BUILD_CC} ${BUILD_CFLAGS} -I${STAGING_INCDIR_NATIVE} makekeys.c -o makekeys
+                else
+                        ${BUILD_CC} ${BUILD_CFLAGS} -I${STAGING_INCDIR_NATIVE} -DUSE32 makekeys.c -o makekeys
+                fi

I am not sure of the my answer myself, but is there an existing flag or variable that we can use here instead of the if block and pass that variable to the patch as an ifdef?

I would have to dig around to check or Richard or someone else might know.

Sau!

Quoted 22 lines
meta/recipes-graphics/xorg-lib/libx11.inc +0 -0
  	)
  	if [ "$?" != "0" ]; then
  		exit 1
meta/recipes-graphics/xorg-lib/libx11_1.3.4.bb +3 -2
index 08ba07b..3e046a1 100644
@@ -5,11 +5,12 @@ LICENSE = "MIT&  MIT-style&  BSD"
  LIC_FILES_CHKSUM = "file://COPYING;md5=bf75bfe4d05068311b5e6862d4b5f2c5"
 
  PE = "1"
-PR = "r0"
+PR = "r1"
 
  SRC_URI += "file://x11_disable_makekeys.patch \
              file://nodolt.patch \
-            file://include_fix.patch"
+            file://include_fix.patch \
+	    file://makekeys_crosscompile.patch"
 
  SRC_URI[md5sum] = "f65c9c7ecbfb64c19dbd7927160d63fd"
  SRC_URI[sha256sum] = "88d7238ce5f7cd123450567de7a3b56a43556e4ccc45df38b8324147c889a844"