diff options
Diffstat (limited to 'meta')
5 files changed, 313 insertions, 0 deletions
diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass new file mode 100644 index 0000000000..5953b5d698 --- /dev/null +++ b/meta/classes/meson.bbclass | |||
@@ -0,0 +1,108 @@ | |||
1 | inherit python3native | ||
2 | |||
3 | DEPENDS_append = " meson-native ninja-native" | ||
4 | |||
5 | # As Meson enforces out-of-tree builds we can just use cleandirs | ||
6 | B = "${WORKDIR}/build" | ||
7 | do_configure[cleandirs] = "${B}" | ||
8 | |||
9 | # Where the meson.build build configuration is | ||
10 | MESON_SOURCEPATH = "${S}" | ||
11 | |||
12 | # These variables in the environment override meson's *native* tools settings. | ||
13 | # We have to unset them, so that meson doesn't pick up the cross tools and | ||
14 | # use them for native builds. | ||
15 | unset CC | ||
16 | unset CXX | ||
17 | unset AR | ||
18 | |||
19 | def noprefix(var, d): | ||
20 | return d.getVar(var).replace(d.getVar('prefix') + '/', '', 1) | ||
21 | |||
22 | MESONOPTS = " --prefix ${prefix} \ | ||
23 | --bindir ${@noprefix('bindir', d)} \ | ||
24 | --sbindir ${@noprefix('sbindir', d)} \ | ||
25 | --datadir ${@noprefix('datadir', d)} \ | ||
26 | --libdir ${@noprefix('libdir', d)} \ | ||
27 | --libexecdir ${@noprefix('libexecdir', d)} \ | ||
28 | --includedir ${@noprefix('includedir', d)} \ | ||
29 | --mandir ${@noprefix('mandir', d)} \ | ||
30 | --infodir ${@noprefix('infodir', d)} \ | ||
31 | --sysconfdir ${sysconfdir} \ | ||
32 | --localstatedir ${localstatedir} \ | ||
33 | --sharedstatedir ${sharedstatedir}" | ||
34 | |||
35 | MESON_C_ARGS = "${TARGET_CC_ARCH}${TOOLCHAIN_OPTIONS}" | ||
36 | MESON_LINK_ARGS = "${MESON_C_ARGS} ${LDFLAGS}" | ||
37 | |||
38 | # both are required but not used by meson | ||
39 | MESON_HOST_ENDIAN = "bogus-endian" | ||
40 | MESON_TARGET_ENDIAN = "bogus-endian" | ||
41 | |||
42 | EXTRA_OEMESON += "${PACKAGECONFIG_CONFARGS}" | ||
43 | |||
44 | MESON_CROSS_FILE = "" | ||
45 | MESON_CROSS_FILE_class-target = "--cross-file ${WORKDIR}/meson.cross" | ||
46 | |||
47 | def meson_array(var, d): | ||
48 | return "', '".join(d.getVar(var).split()).join(("'", "'")) | ||
49 | |||
50 | addtask write_config before do_configure | ||
51 | do_write_config[vardeps] += "MESON_C_ARGS TOOLCHAIN_OPTIONS" | ||
52 | do_write_config() { | ||
53 | # This needs to be Py to split the args into single-element lists | ||
54 | cat >${WORKDIR}/meson.cross <<EOF | ||
55 | [binaries] | ||
56 | c = '${HOST_PREFIX}gcc' | ||
57 | cpp = '${HOST_PREFIX}g++' | ||
58 | ar = '${HOST_PREFIX}ar' | ||
59 | ld = '${HOST_PREFIX}ld' | ||
60 | strip = '${HOST_PREFIX}strip' | ||
61 | readelf = '${HOST_PREFIX}readelf' | ||
62 | pkgconfig = 'pkg-config' | ||
63 | |||
64 | [properties] | ||
65 | needs_exe_wrapper = true | ||
66 | c_args = [${@meson_array('MESON_C_ARGS', d)}] | ||
67 | c_link_args = [${@meson_array('MESON_LINK_ARGS', d)}] | ||
68 | cpp_args = [${@meson_array('MESON_C_ARGS', d)}] | ||
69 | cpp_link_args = [${@meson_array('MESON_LINK_ARGS', d)}] | ||
70 | gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper' | ||
71 | |||
72 | [host_machine] | ||
73 | system = '${HOST_OS}' | ||
74 | cpu_family = '${HOST_ARCH}' | ||
75 | cpu = '${HOST_ARCH}' | ||
76 | endian = '${MESON_HOST_ENDIAN}' | ||
77 | |||
78 | [target_machine] | ||
79 | system = '${TARGET_OS}' | ||
80 | cpu_family = '${TARGET_ARCH}' | ||
81 | cpu = '${TARGET_ARCH}' | ||
82 | endian = '${MESON_TARGET_ENDIAN}' | ||
83 | EOF | ||
84 | } | ||
85 | |||
86 | CONFIGURE_FILES = "meson.build" | ||
87 | |||
88 | meson_do_configure() { | ||
89 | if ! meson ${MESONOPTS} "${MESON_SOURCEPATH}" "${B}" ${MESON_CROSS_FILE} ${EXTRA_OEMESON}; then | ||
90 | cat ${B}/meson-logs/meson-log.txt | ||
91 | bbfatal_log meson failed | ||
92 | fi | ||
93 | } | ||
94 | |||
95 | meson_do_configure_prepend_class-native() { | ||
96 | export PKG_CONFIG="pkg-config-native" | ||
97 | } | ||
98 | |||
99 | do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+" | ||
100 | meson_do_compile() { | ||
101 | ninja ${PARALLEL_MAKE} | ||
102 | } | ||
103 | |||
104 | meson_do_install() { | ||
105 | DESTDIR='${D}' ninja ${PARALLEL_MAKEINST} install | ||
106 | } | ||
107 | |||
108 | EXPORT_FUNCTIONS do_configure do_compile do_install | ||
diff --git a/meta/recipes-devtools/meson/meson/0001-Linker-rules-move-cross_args-in-front-of-output_args.patch b/meta/recipes-devtools/meson/meson/0001-Linker-rules-move-cross_args-in-front-of-output_args.patch new file mode 100644 index 0000000000..97778c32eb --- /dev/null +++ b/meta/recipes-devtools/meson/meson/0001-Linker-rules-move-cross_args-in-front-of-output_args.patch | |||
@@ -0,0 +1,30 @@ | |||
1 | From 4676224dbdff0f7107e8cbdbe0eab19c855f1454 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
3 | Date: Fri, 17 Nov 2017 13:18:28 +0200 | ||
4 | Subject: [PATCH] Linker rules: move {cross_args} in front of {output_args} | ||
5 | |||
6 | The previous order was found to break linking in some cases | ||
7 | (e.g. when -no-pic -fno-PIC was present in {cross_args}. | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
11 | --- | ||
12 | mesonbuild/backend/ninjabackend.py | 2 +- | ||
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py | ||
16 | index bb281e1..969b70e 100644 | ||
17 | --- a/mesonbuild/backend/ninjabackend.py | ||
18 | +++ b/mesonbuild/backend/ninjabackend.py | ||
19 | @@ -1501,7 +1501,7 @@ int dummy; | ||
20 | rspfile_content = $ARGS {output_args} $in $LINK_ARGS {cross_args} $aliasing | ||
21 | ''' | ||
22 | else: | ||
23 | - command_template = ' command = {executable} $ARGS {output_args} $in $LINK_ARGS {cross_args} $aliasing\n' | ||
24 | + command_template = ' command = {executable} $ARGS {cross_args} {output_args} $in $LINK_ARGS $aliasing\n' | ||
25 | command = command_template.format( | ||
26 | executable=' '.join(compiler.get_linker_exelist()), | ||
27 | cross_args=' '.join(cross_args), | ||
28 | -- | ||
29 | 2.15.0 | ||
30 | |||
diff --git a/meta/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch b/meta/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch new file mode 100644 index 0000000000..1912e94358 --- /dev/null +++ b/meta/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch | |||
@@ -0,0 +1,113 @@ | |||
1 | From c5692cac9c555664281377a82bf8b1e46934f437 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
3 | Date: Fri, 4 Aug 2017 16:16:41 +0300 | ||
4 | Subject: [PATCH 1/3] gtkdoc: fix issues that arise when cross-compiling | ||
5 | |||
6 | Specifically: | ||
7 | 1) Make it possible to specify a wrapper for executing binaries | ||
8 | (usually, some kind of target hardware emulator, such as qemu) | ||
9 | 2) Explicitly provide CC and LD via command line, as otherwise gtk-doc will | ||
10 | try to guess them, incorrectly. | ||
11 | 3) If things break down, print the full command with arguments, | ||
12 | not just the binary name. | ||
13 | 4) Correctly determine the compiler/linker executables and cross-options when cross-compiling | ||
14 | |||
15 | Upstream-Status: Pending | ||
16 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
17 | |||
18 | --- | ||
19 | mesonbuild/modules/gnome.py | 18 +++++++++++++++--- | ||
20 | mesonbuild/scripts/gtkdochelper.py | 9 +++++++-- | ||
21 | 2 files changed, 22 insertions(+), 5 deletions(-) | ||
22 | |||
23 | diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py | ||
24 | index 56765a5..4f7fe30 100644 | ||
25 | --- a/mesonbuild/modules/gnome.py | ||
26 | +++ b/mesonbuild/modules/gnome.py | ||
27 | @@ -769,6 +769,10 @@ This will become a hard error in the future.''') | ||
28 | '--mode=' + mode] | ||
29 | if namespace: | ||
30 | args.append('--namespace=' + namespace) | ||
31 | + gtkdoc_exe_wrapper = state.environment.cross_info.config["properties"].get('gtkdoc_exe_wrapper', None) | ||
32 | + if gtkdoc_exe_wrapper is not None: | ||
33 | + args.append('--gtkdoc-exe-wrapper=' + gtkdoc_exe_wrapper) | ||
34 | + | ||
35 | args += self._unpack_args('--htmlargs=', 'html_args', kwargs) | ||
36 | args += self._unpack_args('--scanargs=', 'scan_args', kwargs) | ||
37 | args += self._unpack_args('--scanobjsargs=', 'scanobjs_args', kwargs) | ||
38 | @@ -796,14 +800,22 @@ This will become a hard error in the future.''') | ||
39 | raise MesonException( | ||
40 | 'Gir include dirs should be include_directories().') | ||
41 | cflags.update(get_include_args(inc_dirs)) | ||
42 | + | ||
43 | + cross_c_args = " ".join(state.environment.cross_info.config["properties"].get('c_args', "")) | ||
44 | + cross_link_args = " ".join(state.environment.cross_info.config["properties"].get('c_link_args', "")) | ||
45 | + | ||
46 | if cflags: | ||
47 | - args += ['--cflags=%s' % ' '.join(cflags)] | ||
48 | + args += ['--cflags=%s %s' % (cross_c_args,' '.join(cflags))] | ||
49 | if ldflags: | ||
50 | - args += ['--ldflags=%s' % ' '.join(ldflags)] | ||
51 | + args += ['--ldflags=%s %s' % (cross_link_args, ' '.join(ldflags))] | ||
52 | compiler = state.environment.coredata.compilers.get('c') | ||
53 | - if compiler: | ||
54 | + cross_compiler = state.environment.coredata.cross_compilers.get('c') | ||
55 | + if compiler and not state.environment.is_cross_build(): | ||
56 | args += ['--cc=%s' % ' '.join(compiler.get_exelist())] | ||
57 | args += ['--ld=%s' % ' '.join(compiler.get_linker_exelist())] | ||
58 | + elif cross_compiler and state.environment.is_cross_build(): | ||
59 | + args += ['--cc=%s' % ' '.join(cross_compiler.get_exelist())] | ||
60 | + args += ['--ld=%s' % ' '.join(cross_compiler.get_linker_exelist())] | ||
61 | |||
62 | return args | ||
63 | |||
64 | diff --git a/mesonbuild/scripts/gtkdochelper.py b/mesonbuild/scripts/gtkdochelper.py | ||
65 | index 4406b28..b846827 100644 | ||
66 | --- a/mesonbuild/scripts/gtkdochelper.py | ||
67 | +++ b/mesonbuild/scripts/gtkdochelper.py | ||
68 | @@ -44,13 +44,14 @@ parser.add_argument('--ignore-headers', dest='ignore_headers', default='') | ||
69 | parser.add_argument('--namespace', dest='namespace', default='') | ||
70 | parser.add_argument('--mode', dest='mode', default='') | ||
71 | parser.add_argument('--installdir', dest='install_dir') | ||
72 | +parser.add_argument('--gtkdoc-exe-wrapper', dest='gtkdoc_exe_wrapper') | ||
73 | |||
74 | def gtkdoc_run_check(cmd, cwd): | ||
75 | # Put stderr into stdout since we want to print it out anyway. | ||
76 | # This preserves the order of messages. | ||
77 | p, out = Popen_safe(cmd, cwd=cwd, stderr=subprocess.STDOUT)[0:2] | ||
78 | if p.returncode != 0: | ||
79 | - err_msg = ["{!r} failed with status {:d}".format(cmd[0], p.returncode)] | ||
80 | + err_msg = ["{!r} failed with status {:d}".format(cmd, p.returncode)] | ||
81 | if out: | ||
82 | err_msg.append(out) | ||
83 | raise MesonException('\n'.join(err_msg)) | ||
84 | @@ -58,7 +59,7 @@ def gtkdoc_run_check(cmd, cwd): | ||
85 | def build_gtkdoc(source_root, build_root, doc_subdir, src_subdirs, | ||
86 | main_file, module, | ||
87 | html_args, scan_args, fixxref_args, mkdb_args, | ||
88 | - gobject_typesfile, scanobjs_args, ld, cc, ldflags, cflags, | ||
89 | + gobject_typesfile, scanobjs_args, gtkdoc_exe_wrapper, ld, cc, ldflags, cflags, | ||
90 | html_assets, content_files, ignore_headers, namespace, | ||
91 | expand_content_files, mode): | ||
92 | print("Building documentation for %s" % module) | ||
93 | @@ -111,6 +112,9 @@ def build_gtkdoc(source_root, build_root, doc_subdir, src_subdirs, | ||
94 | if gobject_typesfile: | ||
95 | scanobjs_cmd = ['gtkdoc-scangobj'] + scanobjs_args + ['--types=' + gobject_typesfile, | ||
96 | '--module=' + module, | ||
97 | + '--run=' + gtkdoc_exe_wrapper, | ||
98 | + '--cc=' + cc, | ||
99 | + '--ld=' + ld, | ||
100 | '--cflags=' + cflags, | ||
101 | '--ldflags=' + ldflags, | ||
102 | '--ld=' + ld] | ||
103 | @@ -207,6 +211,7 @@ def run(args): | ||
104 | mkdbargs, | ||
105 | options.gobject_typesfile, | ||
106 | scanobjsargs, | ||
107 | + options.gtkdoc_exe_wrapper, | ||
108 | options.ld, | ||
109 | options.cc, | ||
110 | options.ldflags, | ||
111 | -- | ||
112 | 2.15.0 | ||
113 | |||
diff --git a/meta/recipes-devtools/meson/meson/0002-gobject-introspection-determine-g-ir-scanner-and-g-i.patch b/meta/recipes-devtools/meson/meson/0002-gobject-introspection-determine-g-ir-scanner-and-g-i.patch new file mode 100644 index 0000000000..ded42d14f7 --- /dev/null +++ b/meta/recipes-devtools/meson/meson/0002-gobject-introspection-determine-g-ir-scanner-and-g-i.patch | |||
@@ -0,0 +1,42 @@ | |||
1 | From 972667e0d789a6969a5d79249404f3539f891810 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
3 | Date: Fri, 4 Aug 2017 16:18:47 +0300 | ||
4 | Subject: [PATCH 1/2] gobject-introspection: determine g-ir-scanner and | ||
5 | g-ir-compiler paths from pkgconfig | ||
6 | |||
7 | Do not hardcode the name of those binaries; gobject-introspection | ||
8 | provides them via pkgconfig, and they can be set to something else | ||
9 | (for example when cross-compiling). | ||
10 | |||
11 | Upstream-Status: Pending | ||
12 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
13 | |||
14 | --- | ||
15 | mesonbuild/modules/gnome.py | 4 ++-- | ||
16 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
17 | |||
18 | diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py | ||
19 | index 4f7fe30..9610cf6 100644 | ||
20 | --- a/mesonbuild/modules/gnome.py | ||
21 | +++ b/mesonbuild/modules/gnome.py | ||
22 | @@ -390,8 +390,6 @@ class GnomeModule(ExtensionModule): | ||
23 | raise MesonException('Gir takes one argument') | ||
24 | if kwargs.get('install_dir'): | ||
25 | raise MesonException('install_dir is not supported with generate_gir(), see "install_dir_gir" and "install_dir_typelib"') | ||
26 | - giscanner = find_program('g-ir-scanner', 'Gir') | ||
27 | - gicompiler = find_program('g-ir-compiler', 'Gir') | ||
28 | girtarget = args[0] | ||
29 | while hasattr(girtarget, 'held_object'): | ||
30 | girtarget = girtarget.held_object | ||
31 | @@ -402,6 +400,8 @@ class GnomeModule(ExtensionModule): | ||
32 | self.gir_dep = PkgConfigDependency('gobject-introspection-1.0', | ||
33 | state.environment, | ||
34 | {'native': True}) | ||
35 | + giscanner = os.environ['PKG_CONFIG_SYSROOT_DIR'] + self.gir_dep.get_pkgconfig_variable('g_ir_scanner', {}) | ||
36 | + gicompiler = os.environ['PKG_CONFIG_SYSROOT_DIR'] + self.gir_dep.get_pkgconfig_variable('g_ir_compiler', {}) | ||
37 | pkgargs = self.gir_dep.get_compile_args() | ||
38 | except Exception: | ||
39 | raise MesonException('gobject-introspection dependency was not found, gir cannot be generated.') | ||
40 | -- | ||
41 | 2.15.0 | ||
42 | |||
diff --git a/meta/recipes-devtools/meson/meson_0.44.0.bb b/meta/recipes-devtools/meson/meson_0.44.0.bb new file mode 100644 index 0000000000..9b4c7e6ab1 --- /dev/null +++ b/meta/recipes-devtools/meson/meson_0.44.0.bb | |||
@@ -0,0 +1,20 @@ | |||
1 | HOMEPAGE = "http://mesonbuild.com" | ||
2 | SUMMARY = "A high performance build system" | ||
3 | |||
4 | LICENSE = "Apache-2.0" | ||
5 | LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57" | ||
6 | |||
7 | SRC_URI = "https://github.com/mesonbuild/meson/releases/download/${PV}/${BP}.tar.gz \ | ||
8 | file://0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch \ | ||
9 | file://0002-gobject-introspection-determine-g-ir-scanner-and-g-i.patch \ | ||
10 | file://0001-Linker-rules-move-cross_args-in-front-of-output_args.patch \ | ||
11 | " | ||
12 | SRC_URI[md5sum] = "26a7ca93ec9cea5facb365664261f9c6" | ||
13 | SRC_URI[sha256sum] = "50f9b12b77272ef6ab064d26b7e06667f07fa9f931e6a20942bba2216ba4281b" | ||
14 | UPSTREAM_CHECK_URI = "https://github.com/mesonbuild/meson/releases" | ||
15 | |||
16 | inherit setuptools3 | ||
17 | |||
18 | RDEPENDS_${PN} = "ninja python3-core python3-modules" | ||
19 | |||
20 | BBCLASSEXTEND = "native" | ||