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