Skip to contentSkip to conversation

Fix multilib install file conflict of gobject-introspection

PATCH Superseded [email protected] 2 participants 5 messages Oct 10, 2018 – Oct 11, 2018

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Fix multilib install file conflict of gobject-introspection

From: Kai Kang <[email protected]>

1 test steps
Set config in local.conf:

MACHINE = "qemux86-64"
require conf/multilib.conf
MULTILIBS = "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 = "x86"

IMAGE_INSTALL_append = " packagegroup-core-buildessential ldd gobject-introspection lib32-gobject-introspection gobject-introspection-dev lib32-gobject-introspection-dev"

2 bitbake core-image-sato

3 runqemu qemux86-64

4 runtime test:
Prepare a simple c file:
// test.h
int test_foo();

// test.c
#include <stdio.h>

int test_foo()
{
printf("hello world.\n");

return 0;
}

4.1 verify /usr/lib64/gir-1.0 is searched

# mv /usr/lib64/gir-1.0/ /tmp
# g-ir-scanner --no-libtool --namespace=Test --nsversion=0 --library=test --output Test-0.gir --include=GObject-2.0 test.c test.h
Couldn't find include 'GObject-2.0.gir' (search path: '['gir-1.0', '/usr/share/gir-1.0', '/usr/lib64/gir-1.0', '/usr/share/gir-1.0', '/usr/share/gir-1.0']')

4.2 verify g-ir-scanner and g-ir-compiler work

# gcc -fPIC -shared test.c -o libtest.so
# g-ir-scanner --no-libtool --namespace=Test --nsversion=0 --library=test --output Test-0.gir --include=GObject-2.0 test.c test.h
# g-ir-compiler Test-0.gir -o Test-0.typelib

The following changes since commit 4806d533044011811e78ac41c6aeee3de4224a1e:

bitbake: main: Fix environment handling for UI module imports (2018-10-10 12:47:48 +0100)

are available in the Git repository at:

git://git.pokylinux.org/poky-contrib kangkai/gir-ml
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/gir-ml

Kai Kang (3):
gobject-introspection: add required python modules to rdepends
gobject-introspection: fix multilib install file conflicts
vala: update vapigen-wrapper

 meta/recipes-devtools/vala/vala.inc           |  7 +-
 ...nfigure.ac-make-GIR_DIR-configurable.patch | 68 +++++++++++++++++
 ...02-g-ir-tools-respect-gir_dir_prefix.patch | 76 +++++++++++++++++++
 .../gobject-introspection_1.58.0.bb           | 13 +++-
 4 files changed, 160 insertions(+), 4 deletions(-)
 create mode 100644 meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-configure.ac-make-GIR_DIR-configurable.patch
 create mode 100644 meta/recipes-gnome/gobject-introspection/gobject-introspection/0002-g-ir-tools-respect-gir_dir_prefix.patch

--
2.18.0

#1 lore raw

PATCH v2 1/3 gobject-introspection: add required python modules to rdepends

From: Kai Kang <[email protected]>

It fails to run g-ir-scanner from package gobject-introspection that missing python modules 'xml' and 'pickle'. Add them to rdepends.

---
 .../gobject-introspection/gobject-introspection_1.58.0.bb       | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-gnome/gobject-introspection/gobject-introspection_1.58.0.bb +2 -0
index de898a788b..a08ccf2970 100644
@@ -194,4 +194,6 @@ FILES_${PN}-dev_append = " ${datadir}/gobject-introspection-1.0/tests/*.c \
 FILES_${PN}-dbg += "${libdir}/gobject-introspection/giscanner/.debug/"
 FILES_${PN}-staticdev += "${libdir}/gobject-introspection/giscanner/*.a"
 
+RDEPENDS_${PN}_class-target = "python3-pickle python3-xml"
+
 BBCLASSEXTEND = "native"
Signature · 1 line
2.18.0
#4 lore raw

PATCH v2 3/3 vala: update vapigen-wrapper

In reply to [email protected]

From: Kai Kang <[email protected]>

The .gir files from gobject-introspection are configured to install to ${libdir}/gir-1.0 when multilib is enabled. Update vapigen-wrapper accordingly.

---
 meta/recipes-devtools/vala/vala.inc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
meta/recipes-devtools/vala/vala.inc +6 -1
index b22faad780..f680640ca6 100644
@@ -24,12 +24,15 @@ inherit autotools pkgconfig upstream-version-is-even
 FILES_${PN} += "${datadir}/${BPN}-${SHRT_VER}/vapi ${libdir}/${BPN}-${SHRT_VER}/"
 FILES_${PN}-doc += "${datadir}/devhelp"
 
+# .gir files from gobject-introspection are installed to ${libdir} when multilib is enabled
+GIRDIR_OPT = "${@'--girdir=${STAGING_LIBDIR}/gir-1.0' if d.getVar('MULTILIBS') else ''}"
+
 do_configure_prepend_class-target() {
         # Write out a vapigen wrapper that will be provided by pkg-config file installed in target sysroot
         # The wrapper will call a native vapigen
         cat > ${B}/vapigen-wrapper << EOF
 #!/bin/sh
-vapigen-${SHRT_VER} "\$@"
+vapigen-${SHRT_VER} ${GIRDIR_OPT} "\$@"
 EOF
         chmod +x ${B}/vapigen-wrapper
 }
@@ -55,3 +58,5 @@ vapigen_sysroot_preprocess() {
            -e "s|vapigen=.*|vapigen=${bindir}/vapigen-wrapper|" \
            ${SYSROOT_DESTDIR}${libdir}/pkgconfig/vapigen-${SHRT_VER}.pc
 }
+
+SSTATE_SCAN_FILES += "vapigen-wrapper"
Signature · 1 line
2.18.0
#3 lore raw

PATCH v2 2/3 gobject-introspection: fix multilib install file conflicts

In reply to [email protected]

From: Kai Kang <[email protected]>

Fix multilib isntall file conflicts for gobject-introspection.
* use multilib_script.bbclass to handle ${bindir}/g-ir-annotation-tool and ${bindir}/g-ir-scanner
* add configure option to install .gir files to an alternative path and only set it when multilib is enabled

---
 ...nfigure.ac-make-GIR_DIR-configurable.patch | 68 +++++++++++++++++
 ...02-g-ir-tools-respect-gir_dir_prefix.patch | 76 +++++++++++++++++++
 .../gobject-introspection_1.58.0.bb           | 11 ++-
 3 files changed, 152 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-configure.ac-make-GIR_DIR-configurable.patch
 create mode 100644 meta/recipes-gnome/gobject-introspection/gobject-introspection/0002-g-ir-tools-respect-gir_dir_prefix.patch
meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-configure.ac-make-GIR_DIR-configurable.patch new file +68 -0
new file mode 100644
index 0000000000..e0402f8f49
@@ -0,0 +1,68 @@
+configure.ac: make GIR_DIR configurable
+
+Some .gir files such as GLib-2.0.gir are arch related which contain such
+as lengths of pointers that they are different for 64 and 32 bit target.
+It causes install file conflicts for multilib when intall
+gobject-introspection and lib32-gobject-introspection both.
+
+Add configure option 'with-gir-dir-prefix' for autotools to make .gir
+could be installed to a configured path such as ${libdir}. And update
+girdir in .pc files as well.
+
+Upstream-Status: Accepted [https://gitlab.gnome.org/GNOME/gobject-introspection/commit/3301c7e]
+
+Signed-off-by: Kai Kang <[email protected]>
+---
+ configure.ac                              | 7 +++++--
+ gobject-introspection-1.0.pc.in           | 2 +-
+ gobject-introspection-no-export-1.0.pc.in | 2 +-
+ 3 files changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index b4294c57..60506947 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -114,9 +114,12 @@ GIR_SUFFIX="gir-1.0"
+ AC_SUBST(GIR_SUFFIX)
+ AC_DEFINE_UNQUOTED(GIR_SUFFIX, "$GIR_SUFFIX", [Name of the gir directory])
+ 
+-GIR_DIR="$EXPANDED_DATADIR/$GIR_SUFFIX"
++AC_ARG_WITH([gir-dir-prefix],
++		[AS_HELP_STRING([--with-gir-dir-prefix], [Directory prefix for gir installation])],
++		[GIR_DIR_PREFIX="$withval"], [GIR_DIR_PREFIX="$EXPANDED_DATADIR"])
++GIR_DIR="$GIR_DIR_PREFIX/$GIR_SUFFIX"
+ AC_SUBST(GIR_DIR)
+-AC_DEFINE_UNQUOTED(GIR_DIR, "$GIR_DIR", [Director prefix for gir installation])
++AC_DEFINE_UNQUOTED(GIR_DIR, "$GIR_DIR", [Directory prefix for gir installation])
+ 
+ PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.58.0])
+ 
+diff --git a/gobject-introspection-1.0.pc.in b/gobject-introspection-1.0.pc.in
+index a08b5d27..3409856c 100644
+--- a/gobject-introspection-1.0.pc.in
++++ b/gobject-introspection-1.0.pc.in
+@@ -10,7 +10,7 @@ g_ir_scanner=${bindir}/g-ir-scanner
+ g_ir_compiler=${bindir}/g-ir-compiler@EXEEXT@
+ g_ir_generate=${bindir}/g-ir-generate@EXEEXT@
+ gidatadir=${datadir}/gobject-introspection-1.0
+-girdir=${datadir}/gir-1.0
++girdir=@GIR_DIR@
+ typelibdir=${libdir}/girepository-1.0
+ 
+ Cflags: -I${includedir}/gobject-introspection-1.0 @FFI_PC_CFLAGS@
+diff --git a/gobject-introspection-no-export-1.0.pc.in b/gobject-introspection-no-export-1.0.pc.in
+index d214d22d..745aaade 100644
+--- a/gobject-introspection-no-export-1.0.pc.in
++++ b/gobject-introspection-no-export-1.0.pc.in
+@@ -9,7 +9,7 @@ includedir=@includedir@
+ g_ir_scanner=${bindir}/g-ir-scanner
+ g_ir_compiler=${bindir}/g-ir-compiler@EXEEXT@
+ g_ir_generate=${bindir}/g-ir-generate@EXEEXT@
+-girdir=${datadir}/gir-1.0
++girdir=@GIR_DIR@
+ typelibdir=${libdir}/girepository-1.0
+ 
+ Cflags: -I${includedir}/gobject-introspection-1.0 @FFI_PC_CFLAGS@
+-- 
+2.17.0
+
meta/recipes-gnome/gobject-introspection/gobject-introspection/0002-g-ir-tools-respect-gir_dir_prefix.patch new file +76 -0

76 lines not on this page · raw message

meta/recipes-gnome/gobject-introspection/gobject-introspection_1.58.0.bb +8 -3
index a08ccf2970..65c446672b 100644
@@ -17,6 +17,8 @@ SRC_URI = "${GNOME_MIRROR}/${BPN}/${@oe.utils.trim_version("${PV}", 2)}/${BPN}-$
            file://0005-Prefix-pkg-config-paths-with-PKG_CONFIG_SYSROOT_DIR-.patch \
            file://0001-giscanner-add-a-lib-dirs-envvar-option.patch \
            file://0001-giscanner-ignore-error-return-codes-from-ldd-wrapper.patch \
+           file://0001-configure.ac-make-GIR_DIR-configurable.patch \
+           file://0002-g-ir-tools-respect-gir_dir_prefix.patch \
            "
 
 SRC_URI[md5sum] = "94fec875276262037bfcd51226db12fe"
@@ -24,7 +26,9 @@ SRC_URI[sha256sum] = "27c1590a32749de0a5481ce897772547043e94bccba4bc0a7edb3d8513
 
 SRC_URI_append_class-native = " file://0001-Relocate-the-repository-directory-for-native-builds.patch"
 
-inherit autotools pkgconfig gtk-doc python3native qemu gobject-introspection-data upstream-version-is-even
+inherit autotools pkgconfig gtk-doc python3native qemu gobject-introspection-data upstream-version-is-even multilib_script
+
+MULTILIB_SCRIPTS = "${PN}:${bindir}/g-ir-annotation-tool ${PN}:${bindir}/g-ir-scanner"
 
 DEPENDS_append = " libffi zlib glib-2.0 python3 flex-native bison-native autoconf-archive"
 
@@ -50,6 +54,7 @@ EXTRA_OECONF_class-target = " \
     --enable-gi-cross-wrapper=${B}/g-ir-scanner-qemuwrapper \
     --enable-gi-ldd-wrapper=${B}/g-ir-scanner-lddwrapper \
     ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '--enable-introspection-data', '--disable-introspection-data', d)} \
+    ${@'--with-gir-dir-prefix=${libdir}' if d.getVar('MULTILIBS') else ''} \
 "
 
 # Need to ensure ld.so.conf exists so prelink-native works
@@ -94,7 +99,7 @@ EOF
 # This prevents g-ir-scanner from writing cache data to $HOME
 export GI_SCANNER_DISABLE_CACHE=1
 
-g-ir-scanner --lib-dirs-envvar=GIR_EXTRA_LIBS_PATH --use-binary-wrapper=${STAGING_BINDIR}/g-ir-scanner-qemuwrapper --use-ldd-wrapper=${STAGING_BINDIR}/g-ir-scanner-lddwrapper --add-include-path=${STAGING_DATADIR}/gir-1.0 "\$@"
+g-ir-scanner --lib-dirs-envvar=GIR_EXTRA_LIBS_PATH --use-binary-wrapper=${STAGING_BINDIR}/g-ir-scanner-qemuwrapper --use-ldd-wrapper=${STAGING_BINDIR}/g-ir-scanner-lddwrapper --add-include-path=${STAGING_DATADIR}/gir-1.0 --add-include-path=${STAGING_LIBDIR}/gir-1.0 "\$@"
 EOF
         chmod +x ${B}/g-ir-scanner-wrapper
 
@@ -178,7 +183,7 @@ FILES_${PN}_append = " ${libdir}/girepository-*/*.typelib"
 
 # .gir files go to dev package, as they're needed for developing (but not for running)
 # things that depends on introspection.
-FILES_${PN}-dev_append = " ${datadir}/gir-*/*.gir"
+FILES_${PN}-dev_append = " ${datadir}/gir-*/*.gir ${libdir}/gir-*/*.gir"
 FILES_${PN}-dev_append = " ${datadir}/gir-*/*.rnc"
 
 # These are used by gobject-based packages
Signature · 1 line
2.18.0
#2 lore raw

Re: [PATCH 1/3] gobject-introspection: add required python modules to rdepends

In reply to [email protected]
Quoted 1 line · On Wed, 10 Oct 2018 at 16:48, <[email protected]> wrote:

+RDEPENDS_${PN}_class-target = "python3-pickle python3-xml"

I'm pretty sure this idiom isn't right anymore:
1) python3-native has the right PROVIDES so e.g. python3-pickle-native exists
2) the RDEPENDS are needed if you build nativesdk-gobject-introspection but this doesn't add them

Ross