blob: a51db1e3d443c45538d1b0a87a80fb138873ab6e [file] [log] [blame]
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00001HOMEPAGE = "http://mesonbuild.com"
2SUMMARY = "A high performance build system"
3DESCRIPTION = "Meson is a build system designed to increase programmer \
4productivity. It does this by providing a fast, simple and easy to use \
5interface for modern software development tools and practices."
6
7LICENSE = "Apache-2.0"
8LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57"
9
10SRC_URI = "https://github.com/mesonbuild/meson/releases/download/${PV}/meson-${PV}.tar.gz \
11 file://meson-setup.py \
12 file://meson-wrapper \
13 file://0001-python-module-do-not-manipulate-the-environment-when.patch \
14 file://disable-rpath-handling.patch \
15 file://0001-Make-CPU-family-warnings-fatal.patch \
16 file://0002-Support-building-allarch-recipes-again.patch \
17 file://0001-is_debianlike-always-return-False.patch \
18 "
19SRC_URI[sha256sum] = "0233a7f8d959079318f6052b0939c27f68a5de86ba601f25c9ee6869fb5f5889"
20
21UPSTREAM_CHECK_URI = "https://github.com/mesonbuild/meson/releases"
22UPSTREAM_CHECK_REGEX = "meson-(?P<pver>\d+(\.\d+)+)\.tar"
23
24inherit setuptools_build_meta
25
26PIP_INSTALL_PACKAGE = "meson"
27
28RDEPENDS:${PN} = "ninja python3-modules python3-pkg-resources"
29
30FILES:${PN} += "${datadir}/polkit-1"
31
32do_install:append () {
33 # As per the same issue in the python recipe itself:
34 # Unfortunately the following pyc files are non-deterministc due to 'frozenset'
35 # being written without strict ordering, even with PYTHONHASHSEED = 0
36 # Upstream is discussing ways to solve the issue properly, until then let's
37 # just not install the problematic files.
38 # More info: http://benno.id.au/blog/2013/01/15/python-determinism
39 rm ${D}${libdir}/python*/site-packages/mesonbuild/dependencies/__pycache__/mpi.cpython*
40}
41
42BBCLASSEXTEND = "native nativesdk"
43
44inherit meson-routines
45
46# The cross file logic is similar but not identical to that in meson.bbclass,
47# since it's generating for an SDK rather than a cross-compile. Important
48# differences are:
49# - We can't set vars like CC, CXX, etc. yet because they will be filled in with
50# real paths by meson-setup.sh when the SDK is extracted.
51# - Some overrides aren't needed, since the SDK injects paths that take care of
52# them.
53def var_list2str(var, d):
54 items = d.getVar(var).split()
55 return items[0] if len(items) == 1 else ', '.join(repr(s) for s in items)
56
57def generate_native_link_template(d):
58 val = ['-L@{OECORE_NATIVE_SYSROOT}${libdir_native}',
59 '-L@{OECORE_NATIVE_SYSROOT}${base_libdir_native}',
60 '-Wl,-rpath-link,@{OECORE_NATIVE_SYSROOT}${libdir_native}',
61 '-Wl,-rpath-link,@{OECORE_NATIVE_SYSROOT}${base_libdir_native}',
62 '-Wl,--allow-shlib-undefined'
63 ]
64 build_arch = d.getVar('BUILD_ARCH')
65 if 'x86_64' in build_arch:
66 loader = 'ld-linux-x86-64.so.2'
67 elif 'i686' in build_arch:
68 loader = 'ld-linux.so.2'
69 elif 'aarch64' in build_arch:
70 loader = 'ld-linux-aarch64.so.1'
71 elif 'ppc64le' in build_arch:
72 loader = 'ld64.so.2'
73
74 if loader:
75 val += ['-Wl,--dynamic-linker=@{OECORE_NATIVE_SYSROOT}${base_libdir_native}/' + loader]
76
77 return repr(val)
78
79do_install:append:class-nativesdk() {
80 install -d ${D}${datadir}/meson
81
82 cat >${D}${datadir}/meson/meson.native.template <<EOF
83[binaries]
84c = ${@meson_array('BUILD_CC', d)}
85cpp = ${@meson_array('BUILD_CXX', d)}
86ar = ${@meson_array('BUILD_AR', d)}
87nm = ${@meson_array('BUILD_NM', d)}
88strip = ${@meson_array('BUILD_STRIP', d)}
89readelf = ${@meson_array('BUILD_READELF', d)}
90pkgconfig = 'pkg-config-native'
91
92[built-in options]
93c_args = ['-isystem@{OECORE_NATIVE_SYSROOT}${includedir_native}' , ${@var_list2str('BUILD_OPTIMIZATION', d)}]
94c_link_args = ${@generate_native_link_template(d)}
95cpp_args = ['-isystem@{OECORE_NATIVE_SYSROOT}${includedir_native}' , ${@var_list2str('BUILD_OPTIMIZATION', d)}]
96cpp_link_args = ${@generate_native_link_template(d)}
97[properties]
98sys_root = '@OECORE_NATIVE_SYSROOT'
99EOF
100
101 cat >${D}${datadir}/meson/meson.cross.template <<EOF
102[binaries]
103c = @CC
104cpp = @CXX
105ar = @AR
106nm = @NM
107strip = @STRIP
108pkgconfig = 'pkg-config'
109
110[built-in options]
111c_args = @CFLAGS
112c_link_args = @LDFLAGS
113cpp_args = @CPPFLAGS
114cpp_link_args = @LDFLAGS
115
116[properties]
117needs_exe_wrapper = true
118sys_root = @OECORE_TARGET_SYSROOT
119
120[host_machine]
121system = '${SDK_OS}'
122cpu_family = '${@meson_cpu_family("SDK_ARCH", d)}'
123cpu = '${SDK_ARCH}'
124endian = '${@meson_endian("SDK", d)}'
125EOF
126
127 install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d
128 install -m 0755 ${WORKDIR}/meson-setup.py ${D}${SDKPATHNATIVE}/post-relocate-setup.d/
129
130 # We need to wrap the real meson with a thin env setup wrapper.
131 mv ${D}${bindir}/meson ${D}${bindir}/meson.real
132 install -m 0755 ${WORKDIR}/meson-wrapper ${D}${bindir}/meson
133}
134
135FILES:${PN}:append:class-nativesdk = "${datadir}/meson ${SDKPATHNATIVE}"