2017-10-29 14:10:51 +01:00
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# meson
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2021-04-15 13:44:49 +02:00
|
|
|
MESON_VERSION = 0.57.2
|
2017-10-29 14:10:51 +01:00
|
|
|
MESON_SITE = https://github.com/mesonbuild/meson/releases/download/$(MESON_VERSION)
|
|
|
|
MESON_LICENSE = Apache-2.0
|
|
|
|
MESON_LICENSE_FILES = COPYING
|
|
|
|
MESON_SETUP_TYPE = setuptools
|
|
|
|
|
|
|
|
HOST_MESON_DEPENDENCIES = host-ninja
|
|
|
|
HOST_MESON_NEEDS_HOST_PYTHON = python3
|
|
|
|
|
2020-03-11 19:38:33 +01:00
|
|
|
HOST_MESON_TARGET_ENDIAN = $(call qstrip,$(call LOWERCASE,$(BR2_ENDIAN)))
|
2018-09-12 12:22:53 +02:00
|
|
|
HOST_MESON_TARGET_CPU = $(GCC_TARGET_CPU)
|
2017-10-29 14:10:51 +01:00
|
|
|
|
2018-12-26 09:52:27 +01:00
|
|
|
# https://mesonbuild.com/Reference-tables.html#cpu-families
|
|
|
|
ifeq ($(BR2_arcle)$(BR2_arceb),y)
|
|
|
|
HOST_MESON_TARGET_CPU_FAMILY = arc
|
|
|
|
else ifeq ($(BR2_arm)$(BR2_armeb),y)
|
|
|
|
HOST_MESON_TARGET_CPU_FAMILY = arm
|
|
|
|
else ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y)
|
|
|
|
HOST_MESON_TARGET_CPU_FAMILY = aarch64
|
|
|
|
else ifeq ($(BR2_i386),y)
|
|
|
|
HOST_MESON_TARGET_CPU_FAMILY = x86
|
2020-09-15 17:22:05 +02:00
|
|
|
else ifeq ($(BR2_m68k),y)
|
|
|
|
HOST_MESON_TARGET_CPU_FAMILY = m68k
|
|
|
|
else ifeq ($(BR2_microblazeel)$(BR2_microblazebe),y)
|
|
|
|
HOST_MESON_TARGET_CPU_FAMILY = microblaze
|
2018-12-26 09:52:27 +01:00
|
|
|
else ifeq ($(BR2_mips)$(BR2_mipsel),y)
|
|
|
|
HOST_MESON_TARGET_CPU_FAMILY = mips
|
|
|
|
else ifeq ($(BR2_mips64)$(BR2_mips64el),y)
|
|
|
|
HOST_MESON_TARGET_CPU_FAMILY = mips64
|
|
|
|
else ifeq ($(BR2_powerpc),y)
|
|
|
|
HOST_MESON_TARGET_CPU_FAMILY = ppc
|
|
|
|
else ifeq ($(BR2_powerpc64)$(BR2_powerpc64le),y)
|
|
|
|
HOST_MESON_TARGET_CPU_FAMILY = ppc64
|
|
|
|
else ifeq ($(BR2_riscv),y)
|
|
|
|
HOST_MESON_TARGET_CPU_FAMILY = riscv64
|
2020-09-15 17:22:05 +02:00
|
|
|
else ifeq ($(BR2_sh4)$(BR2_sh4eb)$(BR2_sh4a)$(BR2_sh4aeb),y)
|
|
|
|
HOST_MESON_TARGET_CPU_FAMILY = sh4
|
2018-12-26 09:52:27 +01:00
|
|
|
else ifeq ($(BR2_sparc),y)
|
|
|
|
HOST_MESON_TARGET_CPU_FAMILY = sparc
|
|
|
|
else ifeq ($(BR2_sparc64),y)
|
|
|
|
HOST_MESON_TARGET_CPU_FAMILY = sparc64
|
|
|
|
else ifeq ($(BR2_x86_64),y)
|
|
|
|
HOST_MESON_TARGET_CPU_FAMILY = x86_64
|
|
|
|
else
|
|
|
|
HOST_MESON_TARGET_CPU_FAMILY = $(ARCH)
|
|
|
|
endif
|
|
|
|
|
package/meson: fix shebang in deep build trees
The meson script includes the full path to the python interpreter. In
deep build trees, this path can be more than 128 characters long, which
is the limit for how long a shebang may be.
Notice that this has been bumped to 256 since kerel 5.1, but the issue still
persists:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6eb3c3d0a52dca337e327ae8868ca1f44a712e02
In older kernels, this limit was silently ignored, leading to potential
bugs, but newer kernels enforce that limit, and refuse to execve() the
script, returning with NOEXEC. Since the script is +x, the shell (any
bourne shell, as well as the C shell) will conclude from that situation that
they should interpret it as a shell script, which it obviously is not.
Fix the problem by replacing the shebang with a call to /usr/bin/env
which will redirect to the correct python3 interpreter found in the
PATH.
Note however that this means our meson installation can no longer be
called from outside of the meson-package infrastructure anymore (not
that we ever supported it before, but who knows what people may have
done in their br2-external), unless one does set the PATH to include
$(HOST_DIR)/bin/ earlier than a system-provided python3 would be found.
Fixes: #12331 #12461
Reported-by: Jean-pierre Cartal <jpcartal@free.fr>
Reported-by: Matthias Weißer <m.weisser.m@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2020-01-13 19:03:22 +01:00
|
|
|
# Avoid interpreter shebang longer than 128 chars
|
|
|
|
define HOST_MESON_SET_INTERPRETER
|
|
|
|
$(SED) '1s:.*:#!/usr/bin/env python3:' $(HOST_DIR)/bin/meson
|
|
|
|
endef
|
|
|
|
HOST_MESON_POST_INSTALL_HOOKS += HOST_MESON_SET_INTERPRETER
|
|
|
|
|
2017-10-29 14:10:51 +01:00
|
|
|
$(eval $(host-python-package))
|