Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1 | HOMEPAGE = "http://mesonbuild.com" |
| 2 | SUMMARY = "A high performance build system" |
| 3 | DESCRIPTION = "Meson is a build system designed to increase programmer \ |
| 4 | productivity. It does this by providing a fast, simple and easy to use \ |
| 5 | interface for modern software development tools and practices." |
| 6 | |
| 7 | LICENSE = "Apache-2.0" |
| 8 | LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57" |
| 9 | |
| 10 | SRC_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 | " |
| 19 | SRC_URI[sha256sum] = "feb2cefb325b437dbf36146df7c6b87688ddff0b0205caa31dc64055c6da410c" |
| 20 | |
| 21 | UPSTREAM_CHECK_URI = "https://github.com/mesonbuild/meson/releases" |
| 22 | UPSTREAM_CHECK_REGEX = "meson-(?P<pver>\d+(\.\d+)+)\.tar" |
| 23 | |
| 24 | inherit setuptools3 |
| 25 | |
| 26 | RDEPENDS:${PN} = "ninja python3-modules python3-pkg-resources" |
| 27 | |
| 28 | FILES:${PN} += "${datadir}/polkit-1" |
| 29 | |
| 30 | do_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 | |
| 40 | BBCLASSEXTEND = "native nativesdk" |
| 41 | |
| 42 | inherit 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. |
| 51 | def 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 | |
| 55 | def 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 | |
| 77 | do_install:append:class-nativesdk() { |
| 78 | install -d ${D}${datadir}/meson |
| 79 | |
| 80 | cat >${D}${datadir}/meson/meson.native.template <<EOF |
| 81 | [binaries] |
| 82 | c = ${@meson_array('BUILD_CC', d)} |
| 83 | cpp = ${@meson_array('BUILD_CXX', d)} |
| 84 | ar = ${@meson_array('BUILD_AR', d)} |
| 85 | nm = ${@meson_array('BUILD_NM', d)} |
| 86 | strip = ${@meson_array('BUILD_STRIP', d)} |
| 87 | readelf = ${@meson_array('BUILD_READELF', d)} |
| 88 | pkgconfig = 'pkg-config-native' |
| 89 | |
| 90 | [built-in options] |
| 91 | c_args = ['-isystem@{OECORE_NATIVE_SYSROOT}${includedir_native}' , ${@var_list2str('BUILD_OPTIMIZATION', d)}] |
| 92 | c_link_args = ${@generate_native_link_template(d)} |
| 93 | cpp_args = ['-isystem@{OECORE_NATIVE_SYSROOT}${includedir_native}' , ${@var_list2str('BUILD_OPTIMIZATION', d)}] |
| 94 | cpp_link_args = ${@generate_native_link_template(d)} |
| 95 | [properties] |
| 96 | sys_root = '@OECORE_NATIVE_SYSROOT' |
| 97 | EOF |
| 98 | |
| 99 | cat >${D}${datadir}/meson/meson.cross.template <<EOF |
| 100 | [binaries] |
| 101 | c = @CC |
| 102 | cpp = @CXX |
| 103 | ar = @AR |
| 104 | nm = @NM |
| 105 | strip = @STRIP |
| 106 | pkgconfig = 'pkg-config' |
| 107 | |
| 108 | [built-in options] |
| 109 | c_args = @CFLAGS |
| 110 | c_link_args = @LDFLAGS |
| 111 | cpp_args = @CPPFLAGS |
| 112 | cpp_link_args = @LDFLAGS |
| 113 | |
| 114 | [properties] |
| 115 | needs_exe_wrapper = true |
| 116 | sys_root = @OECORE_TARGET_SYSROOT |
| 117 | |
| 118 | [host_machine] |
| 119 | system = '${SDK_OS}' |
| 120 | cpu_family = '${@meson_cpu_family("SDK_ARCH", d)}' |
| 121 | cpu = '${SDK_ARCH}' |
| 122 | endian = '${@meson_endian("SDK", d)}' |
| 123 | EOF |
| 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 | |
| 133 | FILES:${PN}:append:class-nativesdk = "${datadir}/meson ${SDKPATHNATIVE}" |