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