Skip to contentSkip to conversation

meson: various class improvements

PATCH New Ross Burton 1 participant 4 messages Jul 3, 2018 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 meson: various class improvements

- Ensure that the PACKAGECONFIG arguments are always in EXTRA_OEMESON

- Log the arguments that are being passed in do_configure.

- Do verbose builds so the compile logs are useful for debugging build problems

---
 meta/classes/meson.bbclass | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
meta/classes/meson.bbclass +4 -3
index e572344bd20..c36b634b43d 100644
@@ -35,7 +35,7 @@ MESON_LINK_ARGS = "${MESON_TOOLCHAIN_ARGS} ${LDFLAGS}"
 MESON_HOST_ENDIAN = "bogus-endian"
 MESON_TARGET_ENDIAN = "bogus-endian"
 
-EXTRA_OEMESON += "${PACKAGECONFIG_CONFARGS}"
+EXTRA_OEMESON_append = " ${PACKAGECONFIG_CONFARGS}"
 
 MESON_CROSS_FILE = ""
 MESON_CROSS_FILE_class-target = "--cross-file ${WORKDIR}/meson.cross"
@@ -85,6 +85,7 @@ EOF
 CONFIGURE_FILES = "meson.build"
 
 meson_do_configure() {
+    bbnote Executing meson ${EXTRA_OEMESON}...
     if ! meson ${MESONOPTS} "${MESON_SOURCEPATH}" "${B}" ${MESON_CROSS_FILE} ${EXTRA_OEMESON}; then
         cat ${B}/meson-logs/meson-log.txt
         bbfatal_log meson failed
@@ -118,11 +119,11 @@ meson_do_configure_prepend_class-native() {
 
 do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+"
 meson_do_compile() {
-    ninja ${PARALLEL_MAKE}
+    ninja -v ${PARALLEL_MAKE}
 }
 
 meson_do_install() {
-    DESTDIR='${D}' ninja ${PARALLEL_MAKEINST} install
+    DESTDIR='${D}' ninja -v ${PARALLEL_MAKEINST} install
 }
 
 EXPORT_FUNCTIONS do_configure do_compile do_install
Signature · 1 line
2.11.0
#1 lore raw

PATCH 2/4 meson: map architecture to correct values in cross file

The cross file specifies the host/target cpu_family, which should be one of a defined set of values[1] but if it isn't Meson won't complain and instead recipes may behave unexpectedly.

[1] http://mesonbuild.com/Reference-tables.html#cpu-families

---
 meta/classes/meson.bbclass | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
meta/classes/meson.bbclass +14 -2
index c36b634b43d..d615a84cfb0 100644
@@ -45,6 +45,18 @@ def meson_array(var, d):
     items = d.getVar(var).split()
     return repr(items[0] if len(items) == 1 else items)
 
+# Map our ARCH values to what Meson expects:
+# http://mesonbuild.com/Reference-tables.html#cpu-families
+def meson_cpu_family(var, d):
+    import re
+    arch = d.getVar(var)
+    if arch == 'powerpc':
+        return 'ppc'
+    elif re.match(r"i[3-6]86", arch):
+        return "x86"
+    else:
+        return arch
+
 addtask write_config before do_configure
 do_write_config[vardeps] += "MESON_C_ARGS MESON_CPP_ARGS MESON_LINK_ARGS CC CXX LD AR NM STRIP READELF"
 do_write_config() {
@@ -70,13 +82,13 @@ gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper'
 
 [host_machine]
 system = '${HOST_OS}'
-cpu_family = '${HOST_ARCH}'
+cpu_family = '${@meson_cpu_family('HOST_ARCH', d)}'
 cpu = '${HOST_ARCH}'
 endian = '${MESON_HOST_ENDIAN}'
 
 [target_machine]
 system = '${TARGET_OS}'
-cpu_family = '${TARGET_ARCH}'
+cpu_family = '${@meson_cpu_family('TARGET_ARCH', d)}'
 cpu = '${TARGET_ARCH}'
 endian = '${MESON_TARGET_ENDIAN}'
 EOF
Signature · 1 line
2.11.0
#2 lore raw

PATCH 3/4 meson: validate cpu_family

In reply to Ross Burton

Meson has a defined list of known CPU families but these are not currently validated, so mistakes in cross files or new architectures are not noticed.

Backport a patch from upstream which warns on unknown architectures, but tweak it to fatally error instead. When we upgrade to Meson 0.47 the first half of this patch can be dropped.

---
 meta/recipes-devtools/meson/meson.inc              |   1 +
 .../meson/meson/validate-cpu.patch                 | 118 +++++++++++++++++++++
 2 files changed, 119 insertions(+)
 create mode 100644 meta/recipes-devtools/meson/meson/validate-cpu.patch
meta/recipes-devtools/meson/meson.inc +1 -0
index 4c113dcaf73..b278d33b72e 100644
@@ -11,6 +11,7 @@ SRC_URI = "https://github.com/mesonbuild/meson/releases/download/${PV}/meson-${P
            file://0003-native_bindir.patch \
            file://0004-Prettifying-some-output-with-pathlib.patch \
            file://0005-Set-the-meson-command-to-use-when-we-know-what-it-is.patch \
+           file://validate-cpu.patch \
            "
 
 SRC_URI[md5sum] = "1698f6526574839de5dcdc45e3f7d582"
meta/recipes-devtools/meson/meson/validate-cpu.patch new file +118 -0

118 lines not on this page · raw message

Signature · 1 line
2.11.0
#3 lore raw

PATCH 4/4 libdrm: port to Meson

In reply to Ross Burton

Drop the patch to install tests as the Meson build allows this.

Drop the patch to disable cunit as this predates recipe-specific-sysroots and isn't required anymore.

As Meson always builds the test suite (instead of building before running it), add a patch to fix compilation with musl.

---
 ...ac-Allow-explicit-enabling-of-cunit-tests.patch | 53 ----------------------
 .../recipes-graphics/drm/libdrm/installtests.patch | 25 ----------
 meta/recipes-graphics/drm/libdrm/musl-ioctl.patch  | 35 ++++++++++++++
 meta/recipes-graphics/drm/libdrm_2.4.92.bb         | 22 ++++-----
 4 files changed, 44 insertions(+), 91 deletions(-)
 delete mode 100644 meta/recipes-graphics/drm/libdrm/0001-configure.ac-Allow-explicit-enabling-of-cunit-tests.patch
 delete mode 100644 meta/recipes-graphics/drm/libdrm/installtests.patch
 create mode 100644 meta/recipes-graphics/drm/libdrm/musl-ioctl.patch
meta/recipes-graphics/drm/libdrm/0001-configure.ac-Allow-explicit-enabling-of-cunit-tests.patch deleted +0 -53
deleted file mode 100644
index 40bebc0f50c..00000000000
@@ -1,53 +0,0 @@
-From e6bd4205b0b546afe991ae6f72256645f4404ad4 Mon Sep 17 00:00:00 2001
-From: Jussi Kukkonen <[email protected]>
-Date: Mon, 5 Sep 2016 14:41:37 +0300
-Subject: [PATCH libdrm] configure.ac: Allow explicit enabling of cunit tests
-
-Add --with-cunit to make it easier to do reproducible builds. Default
-is still to probe cunit and build opportunistically.
-
-Signed-off-by: Jussi Kukkonen <[email protected]>
-Upstream-Status: Submitted [mailing list]
----
- configure.ac | 14 ++++++++++++--
- 1 file changed, 12 insertions(+), 2 deletions(-)
-
-Index: libdrm-2.4.91/configure.ac
-===================================================================
---- libdrm-2.4.91.orig/configure.ac
-+++ libdrm-2.4.91/configure.ac
-@@ -163,6 +163,12 @@ AC_ARG_ENABLE(install-test-programs,
- 		  [Install test programs (default: no)]),
- 		  [INSTALL_TESTS=$enableval], [INSTALL_TESTS=no])
- 
-+AC_ARG_WITH([cunit],
-+            [AS_HELP_STRING([--with-cunit],
-+                            [Build tests that use cunit (default: auto)])],
-+            [],
-+            [with_cunit=auto])
-+
- dnl ===========================================================================
- dnl check compiler flags
- AC_DEFUN([LIBDRM_CC_TRY_FLAG], [
-@@ -411,7 +417,7 @@ else
- 	AC_DEFINE(HAVE_RADEON, 0)
- fi
- 
--if test "x$AMDGPU" != xno; then
-+if test "x$with_cunit" != xno -a "x$AMDGPU" != xno; then
- 	# Detect cunit library
- 	PKG_CHECK_MODULES([CUNIT], [cunit >= 2.1], [have_cunit=yes], [have_cunit=no])
- 	# If pkg-config does not find cunit, check it using AC_CHECK_LIB.  We
-@@ -436,7 +442,11 @@ if test "x$AMDGPU" = xyes; then
- 	AC_DEFINE(HAVE_AMDGPU, 1, [Have amdgpu support])
- 
- 	if test "x$have_cunit" = "xno"; then
--		AC_MSG_WARN([Could not find cunit library. Disabling amdgpu tests])
-+		if test "x$with_cunit" = "xyes"; then
-+			AC_MSG_ERROR([Could not find cunit library but --with-cunit was given])
-+		elif test "x$with_cunit" = "xauto"; then
-+			AC_MSG_WARN([Could not find cunit library. Disabling amdgpu tests])
-+		fi
- 	fi
- else
- 	AC_DEFINE(HAVE_AMDGPU, 0)
meta/recipes-graphics/drm/libdrm/installtests.patch deleted +0 -25
deleted file mode 100644
index ec1fb0236e4..00000000000
@@ -1,25 +0,0 @@
-From 5c6eb43c2f6e7f2ee7c25c92e42f4e4403fa0527 Mon Sep 17 00:00:00 2001
-From: Jussi Kukkonen <[email protected]>
-Date: Tue, 21 Feb 2017 14:37:52 +0200
-Subject: [PATCH] tests: also install test apps
-
-Upstream-Status: Inappropriate [configuration]
-
-Signed-off-by: Yu Ke <[email protected]>
-Signed-off-by: Jussi Kukkonen <[email protected]>
----
- tests/Makefile.am | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/tests/Makefile.am b/tests/Makefile.am
-index 0355a92..b4882cd 100644
---- a/tests/Makefile.am
-+++ b/tests/Makefile.am
-@@ -45,3 +45,4 @@ TESTS = \
- check_PROGRAMS = \
- 	$(TESTS) \
- 	drmdevice
-+bin_PROGRAMS = $(check_PROGRAMS)
--- 
-2.1.4
-
meta/recipes-graphics/drm/libdrm/musl-ioctl.patch new file +35 -0
new file mode 100644
index 00000000000..e3d6c5b8537
@@ -0,0 +1,35 @@
+Upstream-Status: Submitted
+Signed-off-by: Ross Burton <[email protected]>
+
+From 46c0fd6c827a8cb4d04e067bf04fab579ac4712e Mon Sep 17 00:00:00 2001
+From: Ross Burton <[email protected]>
+Date: Mon, 18 Jun 2018 15:07:03 +0100
+Subject: [PATCH] tests/nouveau/threaded: adapt ioctl signature
+
+POSIX says ioctl() has the signature (int, int, ...) but glibc has decided to
+use (int, unsigned long int, ...) instead.
+
+Use a #ifdef to adapt the replacement function as appropriate.
+---
+ tests/nouveau/threaded.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/tests/nouveau/threaded.c b/tests/nouveau/threaded.c
+index 3669bcd3..e1c27c01 100644
+--- a/tests/nouveau/threaded.c
++++ b/tests/nouveau/threaded.c
+@@ -36,7 +36,11 @@ static int failed;
+ 
+ static int import_fd;
+ 
++#ifdef __GLIBC__
+ int ioctl(int fd, unsigned long request, ...)
++#else
++int ioctl(int fd, int request, ...)
++#endif
+ {
+ 	va_list va;
+ 	int ret;
+-- 
+2.11.0
+
meta/recipes-graphics/drm/libdrm_2.4.92.bb +9 -13
index 2b3bf4f83d2..347090cd5f2 100644
@@ -11,23 +11,19 @@ PROVIDES = "drm"
 DEPENDS = "libpthread-stubs libpciaccess"
 
 SRC_URI = "http://dri.freedesktop.org/libdrm/${BP}.tar.bz2 \
-           file://installtests.patch \
-           file://0001-configure.ac-Allow-explicit-enabling-of-cunit-tests.patch \
-          "
-
+           file://musl-ioctl.patch"
 SRC_URI[md5sum] = "f9b00d985f82d0be6ecc20c799acc89e"
 SRC_URI[sha256sum] = "e9e48fdb4de139dc4d9880aa1473158a16ff6aff63d14341367bd30a51ff39fa"
 
-inherit autotools pkgconfig manpages
+inherit meson pkgconfig manpages
+
+EXTRA_OEMESON = "-Dvalgrind=false \
+                 -Dcairo-tests=false \
+                 -Dinstall-test-programs=true \
+                 -Domap=true \
+                 -Detnaviv=true"
 
-EXTRA_OECONF += "--disable-cairo-tests \
-                 --without-cunit \
-                 --enable-omap-experimental-api \
-                 --enable-etnaviv-experimental-api \
-                 --enable-install-test-programs \
-                 --disable-valgrind \
-                "
-PACKAGECONFIG[manpages] = "--enable-manpages, --disable-manpages, libxslt-native xmlto-native"
+PACKAGECONFIG[manpages] = "-Dman-pages=true,-Dman-pages=false,libxslt-native xmlto-native"
 
 ALLOW_EMPTY_${PN}-drivers = "1"
 PACKAGES =+ "${PN}-tests ${PN}-drivers ${PN}-radeon ${PN}-nouveau ${PN}-omap \
Signature · 1 line
2.11.0