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