summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2018-11-19 15:55:42 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-20 10:32:16 +0000
commita0c8ddea61320752b796c11cac1262efd25b17bd (patch)
treed43837e9257586d096016055d976472c999154aa /meta
parentab8ea8ad6f6ed3442634ddefc48819be545b8057 (diff)
downloadpoky-a0c8ddea61320752b796c11cac1262efd25b17bd.tar.gz
gobject-introspection: port cross-compilation support to meson
Also add a missing libdl dependency to the native relocation patch, which was not necessary with autotools. (From OE-Core rev: ff3f8d4fde8a1d07f5b5381546e740efa14fd483) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-Port-cross-compilation-support-to-meson.patch159
-rw-r--r--meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-Relocate-the-repository-directory-for-native-builds.patch18
-rw-r--r--meta/recipes-gnome/gobject-introspection/gobject-introspection_1.58.0.bb19
3 files changed, 185 insertions, 11 deletions
diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-Port-cross-compilation-support-to-meson.patch b/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-Port-cross-compilation-support-to-meson.patch
new file mode 100644
index 0000000000..b0eee1ebe5
--- /dev/null
+++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-Port-cross-compilation-support-to-meson.patch
@@ -0,0 +1,159 @@
1From e8ce42c5cb54847517fe8fbe50bbaea452618218 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Thu, 15 Nov 2018 15:10:05 +0100
4Subject: [PATCH] Port cross-compilation support to meson
5
6Upstream-Status: Pending
7Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
8---
9 gir/meson.build | 59 ++++++++++++++++++++++++++++++++++-------------
10 meson.build | 4 +++-
11 meson_options.txt | 20 ++++++++++++++++
12 3 files changed, 66 insertions(+), 17 deletions(-)
13
14diff --git a/gir/meson.build b/gir/meson.build
15index 607bbc4..c0e221b 100644
16--- a/gir/meson.build
17+++ b/gir/meson.build
18@@ -37,15 +37,27 @@ typelibdir = join_paths(get_option('libdir'), 'girepository-1.0')
19 girdir = join_paths(get_option('datadir'), 'gir-1.0')
20 install_data(gir_files, install_dir: girdir)
21
22-scanner_command = [
23- python,
24- girscanner,
25- '--output=@OUTPUT@',
26- '--no-libtool',
27- '--reparse-validate',
28- '--add-include-path', join_paths(meson.current_build_dir()),
29- '--add-include-path', join_paths(meson.current_source_dir()),
30-]
31+if get_option('enable-host-gi')
32+ scanner_command = [
33+ 'g-ir-scanner',
34+ '--output=@OUTPUT@',
35+ '--no-libtool',
36+ '--reparse-validate',
37+ '--add-include-path', join_paths(meson.current_build_dir()),
38+ '--add-include-path', join_paths(meson.current_source_dir()),
39+ ]
40+else
41+ scanner_command = [
42+ python,
43+ girscanner,
44+ '--output=@OUTPUT@',
45+ '--no-libtool',
46+ '--reparse-validate',
47+ '--add-include-path', join_paths(meson.current_build_dir()),
48+ '--add-include-path', join_paths(meson.current_source_dir()),
49+ ]
50+endif
51+
52
53 dep_type = glib_dep.type_name()
54 if dep_type == 'internal'
55@@ -58,6 +70,12 @@ if dep_type == 'internal'
56 '--extra-library=glib-2.0', '--extra-library=gobject-2.0']
57 endif
58
59+if get_option('enable-gi-cross-wrapper') != ''
60+ scanner_command += ['--use-binary-wrapper=' + get_option('enable-gi-cross-wrapper')]
61+endif
62+if get_option('enable-gi-ldd-wrapper') != ''
63+ scanner_command += ['--use-ldd-wrapper=' + get_option('enable-gi-ldd-wrapper')]
64+endif
65 # Take a glob and print to newlines
66 globber = '''
67 from glob import glob
68@@ -84,8 +102,8 @@ glib_command = scanner_command + [
69
70 if dep_type == 'pkgconfig'
71 glib_command += ['--external-library', '--pkg=glib-2.0']
72- glib_libdir = glib_dep.get_pkgconfig_variable('libdir')
73- glib_incdir = join_paths(glib_dep.get_pkgconfig_variable('includedir'), 'glib-2.0')
74+ glib_libdir = get_option('pkgconfig-sysroot-path') + glib_dep.get_pkgconfig_variable('libdir')
75+ glib_incdir = get_option('pkgconfig-sysroot-path') + join_paths(glib_dep.get_pkgconfig_variable('includedir'), 'glib-2.0')
76 glib_libincdir = join_paths(glib_libdir, 'glib-2.0', 'include')
77 glib_files += join_paths(glib_incdir, 'gobject', 'glib-types.h')
78 glib_files += join_paths(glib_libincdir, 'glibconfig.h')
79@@ -339,7 +357,7 @@ endforeach
80 if giounix_dep.found()
81 if dep_type == 'pkgconfig'
82 gio_command += ['--pkg=gio-unix-2.0']
83- giounix_includedir = join_paths(giounix_dep.get_pkgconfig_variable('includedir'), 'gio-unix-2.0')
84+ giounix_includedir = get_option('pkgconfig-sysroot-path') + join_paths(giounix_dep.get_pkgconfig_variable('includedir'), 'gio-unix-2.0')
85 # Get the installed gio-unix header list
86 ret = run_command(python, '-c', globber.format(join_paths(giounix_includedir, 'gio', '*.h')))
87 if ret.returncode() != 0
88@@ -417,15 +435,24 @@ gir_files += custom_target('gir-girepository',
89 ]
90 )
91
92+if get_option('enable-gi-cross-wrapper') != ''
93+ gircompiler_command = [get_option('enable-gi-cross-wrapper'), gircompiler.full_path(), '-o', '@OUTPUT@', '@INPUT@',
94+ '--includedir', meson.current_build_dir(),
95+ '--includedir', meson.current_source_dir(),
96+ ]
97+else
98+ gircompiler_command = [gircompiler, '-o', '@OUTPUT@', '@INPUT@',
99+ '--includedir', meson.current_build_dir(),
100+ '--includedir', meson.current_source_dir(),
101+ ]
102+endif
103+
104 foreach gir : gir_files
105 custom_target('generate-typelib-@0@'.format(gir).underscorify(),
106 input: gir,
107 output: '@BASENAME@.typelib',
108 depends: [gobject_gir, ],
109- command: [gircompiler, '-o', '@OUTPUT@', '@INPUT@',
110- '--includedir', meson.current_build_dir(),
111- '--includedir', meson.current_source_dir(),
112- ],
113+ command: gircompiler_command,
114 install: true,
115 install_dir: typelibdir,
116 )
117diff --git a/meson.build b/meson.build
118index 7ec9532..9e20da5 100644
119--- a/meson.build
120+++ b/meson.build
121@@ -76,7 +76,9 @@ libffi_dep = dependency('libffi',
122 subdir('girepository')
123 subdir('tools')
124 subdir('giscanner')
125-subdir('gir')
126+if get_option('enable-introspection-data') == true
127+ subdir('gir')
128+endif
129 subdir('examples')
130 subdir('docs')
131 subdir('tests')
132diff --git a/meson_options.txt b/meson_options.txt
133index 49726be..3e17c78 100644
134--- a/meson_options.txt
135+++ b/meson_options.txt
136@@ -21,3 +21,23 @@ option('cairo-libname', type: 'string',
137 option('python', type: 'string', value: 'python3',
138 description: 'Path or name of the Python interpreter to build for'
139 )
140+
141+option('enable-host-gi', type: 'boolean', value : false,
142+ description: 'Use gobject introspection tools installed in the host system (useful when cross-compiling)'
143+)
144+
145+option('enable-gi-cross-wrapper', type: 'string',
146+ description: 'Use a wrapper to run gicompiler and binaries produced by giscanner (useful when cross-compiling)'
147+)
148+
149+option('enable-gi-ldd-wrapper', type: 'string',
150+ description: 'Use a ldd wrapper instead of system ldd command in giscanner (useful when cross-compiling)'
151+)
152+
153+option('enable-introspection-data', type: 'boolean', value : false,
154+ description: 'Build introspection data (.gir and .typelib files) in addition to library and tools'
155+)
156+
157+option('pkgconfig-sysroot-path', type: 'string',
158+ description: 'Specify a sysroot path to prepend to pkgconfig output (useful when cross-compiling)'
159+)
diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-Relocate-the-repository-directory-for-native-builds.patch b/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-Relocate-the-repository-directory-for-native-builds.patch
index ba85c317f6..b9754a96c2 100644
--- a/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-Relocate-the-repository-directory-for-native-builds.patch
+++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection/0001-Relocate-the-repository-directory-for-native-builds.patch
@@ -1,4 +1,4 @@
1From 4cf37d56fddcc22bcd818f6d470404f56d907f3c Mon Sep 17 00:00:00 2001 1From 2e2bf063ab79ddff1c284834aef8e22710db9350 Mon Sep 17 00:00:00 2001
2From: Sascha Silbe <x-yo17@se-silbe.de> 2From: Sascha Silbe <x-yo17@se-silbe.de>
3Date: Fri, 8 Jun 2018 13:55:10 +0200 3Date: Fri, 8 Jun 2018 13:55:10 +0200
4Subject: [PATCH] Relocate the repository directory for native builds 4Subject: [PATCH] Relocate the repository directory for native builds
@@ -17,7 +17,8 @@ Signed-off-by: Sascha Silbe <x-yo17@se-silbe.de>
17 17
18--- 18---
19 girepository/girepository.c | 15 +++++++++++++-- 19 girepository/girepository.c | 15 +++++++++++++--
20 1 file changed, 13 insertions(+), 2 deletions(-) 20 girepository/meson.build | 2 +-
21 2 files changed, 14 insertions(+), 3 deletions(-)
21 22
22diff --git a/girepository/girepository.c b/girepository/girepository.c 23diff --git a/girepository/girepository.c b/girepository/girepository.c
23index c1fa3d3..efa557e 100644 24index c1fa3d3..efa557e 100644
@@ -60,3 +61,16 @@ index c1fa3d3..efa557e 100644
60 61
61 typelib_search_path = g_slist_prepend (typelib_search_path, typelib_dir); 62 typelib_search_path = g_slist_prepend (typelib_search_path, typelib_dir);
62 63
64diff --git a/girepository/meson.build b/girepository/meson.build
65index 6a8c5b5..8892f2a 100644
66--- a/girepository/meson.build
67+++ b/girepository/meson.build
68@@ -27,7 +27,7 @@ girepo_internals_lib = static_library('girepository-internals',
69 ],
70 c_args: gi_hidden_visibility_cflags,
71 include_directories : configinc,
72- dependencies: [girepo_gthash_dep, libffi_dep],
73+ dependencies: [girepo_gthash_dep, libffi_dep, cc.find_library('dl')],
74 )
75
76 girepo_internals_dep = declare_dependency(
diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.58.0.bb b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.58.0.bb
index 55ca87ddaa..c9a0d816f5 100644
--- a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.58.0.bb
+++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.58.0.bb
@@ -19,6 +19,7 @@ SRC_URI = "${GNOME_MIRROR}/${BPN}/${@oe.utils.trim_version("${PV}", 2)}/${BPN}-$
19 file://0001-giscanner-ignore-error-return-codes-from-ldd-wrapper.patch \ 19 file://0001-giscanner-ignore-error-return-codes-from-ldd-wrapper.patch \
20 file://0001-configure.ac-make-GIR_DIR-configurable.patch \ 20 file://0001-configure.ac-make-GIR_DIR-configurable.patch \
21 file://0002-g-ir-tools-respect-gir_dir_prefix.patch \ 21 file://0002-g-ir-tools-respect-gir_dir_prefix.patch \
22 file://0001-Port-cross-compilation-support-to-meson.patch \
22 " 23 "
23 24
24SRC_URI[md5sum] = "94fec875276262037bfcd51226db12fe" 25SRC_URI[md5sum] = "94fec875276262037bfcd51226db12fe"
@@ -26,7 +27,7 @@ SRC_URI[sha256sum] = "27c1590a32749de0a5481ce897772547043e94bccba4bc0a7edb3d8513
26 27
27SRC_URI_append_class-native = " file://0001-Relocate-the-repository-directory-for-native-builds.patch" 28SRC_URI_append_class-native = " file://0001-Relocate-the-repository-directory-for-native-builds.patch"
28 29
29inherit autotools pkgconfig gtk-doc python3native qemu gobject-introspection-data upstream-version-is-even multilib_script 30inherit meson pkgconfig gtk-doc python3native qemu gobject-introspection-data upstream-version-is-even multilib_script
30 31
31MULTILIB_SCRIPTS = "${PN}:${bindir}/g-ir-annotation-tool ${PN}:${bindir}/g-ir-scanner" 32MULTILIB_SCRIPTS = "${PN}:${bindir}/g-ir-annotation-tool ${PN}:${bindir}/g-ir-scanner"
32 33
@@ -44,17 +45,17 @@ export STAGING_DIR_HOST
44export B 45export B
45 46
46PACKAGECONFIG ?= "" 47PACKAGECONFIG ?= ""
47PACKAGECONFIG[doctool] = "--enable-doctool,--disable-doctool,python3-mako," 48PACKAGECONFIG[doctool] = "-Ddoctool=true,-Ddoctool=false,python3-mako,"
48 49
49# Configure target build to use native tools of itself and to use a qemu wrapper 50# Configure target build to use native tools of itself and to use a qemu wrapper
50# and optionally to generate introspection data 51# and optionally to generate introspection data
51EXTRA_OECONF_class-target = " \ 52EXTRA_OEMESON_class-target = " \
52 --disable-static \ 53 -Denable-host-gi=true \
53 --enable-host-gi \ 54 -Denable-gi-cross-wrapper=${B}/g-ir-scanner-qemuwrapper \
54 --enable-gi-cross-wrapper=${B}/g-ir-scanner-qemuwrapper \ 55 -Denable-gi-ldd-wrapper=${B}/g-ir-scanner-lddwrapper \
55 --enable-gi-ldd-wrapper=${B}/g-ir-scanner-lddwrapper \ 56 -Dpkgconfig-sysroot-path=${PKG_CONFIG_SYSROOT_DIR} \
56 ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '--enable-introspection-data', '--disable-introspection-data', d)} \ 57 ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-Denable-introspection-data=true', '-Denable-introspection-data=false', d)} \
57 ${@'--with-gir-dir-prefix=${libdir}' if d.getVar('MULTILIBS') else ''} \ 58 ${@'-Dgir-dir-prefix=${libdir}' if d.getVar('MULTILIBS') else ''} \
58" 59"
59 60
60# Need to ensure ld.so.conf exists so prelink-native works 61# Need to ensure ld.so.conf exists so prelink-native works