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