diff mbox series

[2/6] package/libwpe: switch over to Meson

Message ID 20200915223053.3090447-3-aperez@igalia.com
State Accepted
Headers show
Series Update WPE stack to WebKit 2.30.0 | expand

Commit Message

Adrian Perez de Castro Sept. 15, 2020, 10:30 p.m. UTC
The CMake based build system will be eventually removed by upstream
so it seems like a good idea to switch over to Meson already before
that happens.

Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
---
 ...ial-dependency-to-pass-EGL-module-fl.patch | 45 +++++++++++++++++++
 package/libwpe/libwpe.mk                      |  7 ++-
 2 files changed, 48 insertions(+), 4 deletions(-)
 create mode 100644 package/libwpe/0001-meson-Use-a-partial-dependency-to-pass-EGL-module-fl.patch

Comments

Thomas Petazzoni Sept. 17, 2020, 8:42 p.m. UTC | #1
On Wed, 16 Sep 2020 01:30:49 +0300
Adrian Perez de Castro <aperez@igalia.com> wrote:

> diff --git a/package/libwpe/libwpe.mk b/package/libwpe/libwpe.mk
> index 6c3a1d354a..369ef5824a 100644
> --- a/package/libwpe/libwpe.mk
> +++ b/package/libwpe/libwpe.mk
> @@ -14,9 +14,8 @@ LIBWPE_DEPENDENCIES = libegl libxkbcommon
>  
>  # Workaround for https://github.com/raspberrypi/userland/issues/316
>  ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
> -LIBWPE_CONF_OPTS += \
> -	-DCMAKE_C_FLAGS='$(TARGET_CFLAGS) -D_GNU_SOURCE' \
> -	-DCMAKE_CXX_FLAGS='$(TARGET_CFLAGS) -D_GNU_SOURCE'
> +LIBWPE_CFLAGS += -D_GNU_SOURCE
> +LIBWPE_CXXFLAGS += -D_GNU_SOURCE
>  endif

Unfortunately pkg-meson.mk does this:

$(2)_CFLAGS ?= $$(TARGET_CFLAGS)
$(2)_LDFLAGS ?= $$(TARGET_LDFLAGS)
$(2)_CXXFLAGS ?= $$(TARGET_CXXFLAGS)

So, with your libwpe.mk, it means that when BR2_PACKAGE_RPI_USERLAND is
disabled, LIBWPE_CFLAGS is not defined by libwpe.mk, and the
$(TARGET_CFLAGS) value will be used by pkg-meson.mk.

However, if BR2_PACKAGE_RPI_USERLAND=y, LIBWPE_CFLAGS will be non-empty
by the time the meson-package infrastructure is invoked, and so you
LIBWPE_CFLAGS will contain only -D_GNU_SOURCE and not the other
$(TARGET_CFLAGS).

I fixed that up and applied to master. Thanks!

Thomas
diff mbox series

Patch

diff --git a/package/libwpe/0001-meson-Use-a-partial-dependency-to-pass-EGL-module-fl.patch b/package/libwpe/0001-meson-Use-a-partial-dependency-to-pass-EGL-module-fl.patch
new file mode 100644
index 0000000000..e74ebe125e
--- /dev/null
+++ b/package/libwpe/0001-meson-Use-a-partial-dependency-to-pass-EGL-module-fl.patch
@@ -0,0 +1,45 @@ 
+From 81bfedfa02fd864f3e4b295091d49c3eb20bb372 Mon Sep 17 00:00:00 2001
+From: Adrian Perez de Castro <aperez@igalia.com>
+Date: Wed, 16 Sep 2020 00:01:37 +0300
+Subject: [PATCH] meson: Use a partial dependency to pass EGL module flags
+
+Make Meson try to always find an "egl" dependency, if found extract
+the include directories and compiler flags from ir using a partial
+dependency, otherwise check that at least EGL/eglplatform.h is
+available when the pkg-config module is not found.
+
+Fixes #70
+
+Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
+[Upstrem status: https://github.com/WebPlatformForEmbedded/libwpe/pull/71]
+
+---
+ meson.build | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 5c88aed..a05f4ab 100644
+--- a/meson.build
++++ b/meson.build
+@@ -57,8 +57,16 @@ dependencies = [
+ ]
+ 
+ cc = meson.get_compiler('c')
+-if not cc.has_header('EGL/eglplatform.h')
+-	dependencies += dependency('egl')
++egl_dep = dependency('egl', required: false)
++if egl_dep.found()
++	dependencies += egl_dep.partial_dependency(
++		compile_args: true,
++		includes: true,
++	)
++else
++	assert(cc.has_header('EGL/eglplatform.h'),
++		'Required heaer <EGL/eglplatform.h> not found'
++	)
+ endif
+ 
+ if not cc.has_function('dlopen')
+-- 
+2.28.0
+
diff --git a/package/libwpe/libwpe.mk b/package/libwpe/libwpe.mk
index 6c3a1d354a..369ef5824a 100644
--- a/package/libwpe/libwpe.mk
+++ b/package/libwpe/libwpe.mk
@@ -14,9 +14,8 @@  LIBWPE_DEPENDENCIES = libegl libxkbcommon
 
 # Workaround for https://github.com/raspberrypi/userland/issues/316
 ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
-LIBWPE_CONF_OPTS += \
-	-DCMAKE_C_FLAGS='$(TARGET_CFLAGS) -D_GNU_SOURCE' \
-	-DCMAKE_CXX_FLAGS='$(TARGET_CFLAGS) -D_GNU_SOURCE'
+LIBWPE_CFLAGS += -D_GNU_SOURCE
+LIBWPE_CXXFLAGS += -D_GNU_SOURCE
 endif
 
-$(eval $(cmake-package))
+$(eval $(meson-package))