From patchwork Sat Sep 22 10:56:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 973570 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SHvsS+WJ"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42HS8B0ljPz9sBW for ; Sat, 22 Sep 2018 20:56:41 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id EFBB4866F2; Sat, 22 Sep 2018 10:56:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GvYiyyGX-RKb; Sat, 22 Sep 2018 10:56:37 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id C5F31864BE; Sat, 22 Sep 2018 10:56:37 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 4F9891C0521 for ; Sat, 22 Sep 2018 10:56:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 4C64A881E9 for ; Sat, 22 Sep 2018 10:56:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wh1wFqzKNGWE for ; Sat, 22 Sep 2018 10:56:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by hemlock.osuosl.org (Postfix) with ESMTPS id 76860881D0 for ; Sat, 22 Sep 2018 10:56:32 +0000 (UTC) Received: by mail-wr1-f48.google.com with SMTP id s14-v6so15136469wrw.6 for ; Sat, 22 Sep 2018 03:56:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eWjIPNEI79UPba4k8Uhwvvj/OgZg0UrCi0MUe4q4u0Q=; b=SHvsS+WJiBNvHUN/MFrlWimZjPmFkpewJiWuXlGBeoZN2igygpaR/mU0rUGu7PGZPM 5pT+AMOSsr464jykEewL1pPzVxXAeEY9KcnqHOc7G9q6jqDtXQ5v3JFf5DK1VBSFqMDV 7o3Zli62ybxZKca5Ea0trkR/95cw6GmnRYrz17b1RjhJ0kqc+vNPkwoImaJbvgwjL+4x 4C7/65DG928YibYDL4+m6aOsLcMO5lEY4trSLrYBacEdxJt4QuHAypmKHQE0HbULMlPu tOXFmksuWY6Ouy4TPjPpo23H7kQO3gAkBcXEd0R9x9WTWQmgYoHtUqE2sdkwzDtjmNt9 WrlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eWjIPNEI79UPba4k8Uhwvvj/OgZg0UrCi0MUe4q4u0Q=; b=QUhx1xl7VFKh4wf82vZ1FwV5bYBDHCZS8KOm3Cx9tOaYu3LN4oy6S35rRfC+xsCwvq CAkwCB4aXJ31kWWVNaYE7Zvl/joX86OAkYPRrUOoWX5SaHXn+Q/otliZgWz+rhsnPP9M utpXhJDPjRczhH2AJ1pSPPESSk13p4Gr4d+kH3P1qmOBACyCIiupVV60e3fWHbENceVM 6mRmVre3fOl98qBhyhYIwJ9Gvl2dYFVP9fjao2ZVeCmRIrrXGXbA2h72vlkDCYpKViFg ScludmsZ9DPhEe+7yP11FgODSH79LV4USmj0aJeDiI2OEJyz2NORNb3MToCETukId7VR i3Jw== X-Gm-Message-State: ABuFfohbyITmhHitNDz+i5UZBPOc8Hf+g0upaLHbW2KE4wD5MUZ06XCg 9lpxR8p0XXm+3yQZUaUKYxRNPULR X-Google-Smtp-Source: ACcGV63fS8oWbnJUF9Ww1QQzH+yaFQCXGlVxRcRVJNHRm5mM6+7A2B1QdjZAMiabl9qzUxL59razzg== X-Received: by 2002:adf:f94e:: with SMTP id q14-v6mr1659378wrr.151.1537613790195; Sat, 22 Sep 2018 03:56:30 -0700 (PDT) Received: from adeos.home (2a01cb000577e4007362e7db4e8430b1.ipv6.abo.wanadoo.fr. [2a01:cb00:577:e400:7362:e7db:4e84:30b1]) by smtp.gmail.com with ESMTPSA id b21-v6sm1309886wmj.28.2018.09.22.03.56.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 22 Sep 2018 03:56:29 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Sat, 22 Sep 2018 12:56:25 +0200 Message-Id: <20180922105626.22626-2-romain.naour@gmail.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180922105626.22626-1-romain.naour@gmail.com> References: <20180922105626.22626-1-romain.naour@gmail.com> Subject: [Buildroot] [PATCH v3 2/3] package/waffle: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Romain Naour MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" waffle has four "backends", each having their own dependencies. At least one "backend" must be enabled, otherwise Waffle will refuse to build. The "backends" are: - glx, which needs full OpenGL + x11-xcb - wayland, which needs wayland-client, wayland-egl and EGL - x11-egl, which needs x11-xcb and EGL - gbm, which needs gbm, libudev and EGL Backport an upstream patch fixing a build issue with musl toolchains. Add a new patch fixing build with Wayand without X11. Signed-off-by: Romain Naour --- v3: rework waffle backends dependencies (ThomasP) --- DEVELOPERS | 1 + package/Config.in | 1 + ...-threads-Use-PTHREAD_MUTEX_RECURSIVE-by-d.patch | 54 ++++++++++++++++++++++ ...rd-cflags-from-.pc-files-to-waffle-cflags.patch | 40 ++++++++++++++++ package/waffle/Config.in | 48 +++++++++++++++++++ package/waffle/waffle.hash | 3 ++ package/waffle/waffle.mk | 48 +++++++++++++++++++ 7 files changed, 195 insertions(+) create mode 100644 package/waffle/0001-third_party-threads-Use-PTHREAD_MUTEX_RECURSIVE-by-d.patch create mode 100644 package/waffle/0002-cmake-forward-cflags-from-.pc-files-to-waffle-cflags.patch create mode 100644 package/waffle/Config.in create mode 100644 package/waffle/waffle.hash create mode 100644 package/waffle/waffle.mk diff --git a/DEVELOPERS b/DEVELOPERS index 84129553c5..1bcaea9d34 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1784,6 +1784,7 @@ F: package/supertuxkart/ F: package/terminology/ F: package/tk/ F: package/upower/ +F: package/waffle/ F: package/xenomai/ N: Roman Gorbenkov diff --git a/package/Config.in b/package/Config.in index c04645a30b..2dcc2e611a 100644 --- a/package/Config.in +++ b/package/Config.in @@ -1255,6 +1255,7 @@ menu "Graphics" source "package/poppler/Config.in" source "package/powervr/Config.in" source "package/tiff/Config.in" + source "package/waffle/Config.in" source "package/wayland/Config.in" source "package/wayland-protocols/Config.in" source "package/waylandpp/Config.in" diff --git a/package/waffle/0001-third_party-threads-Use-PTHREAD_MUTEX_RECURSIVE-by-d.patch b/package/waffle/0001-third_party-threads-Use-PTHREAD_MUTEX_RECURSIVE-by-d.patch new file mode 100644 index 0000000000..ef54953e34 --- /dev/null +++ b/package/waffle/0001-third_party-threads-Use-PTHREAD_MUTEX_RECURSIVE-by-d.patch @@ -0,0 +1,54 @@ +From 117456752cf9ac1f24d3cfd917ad34f670c244b8 Mon Sep 17 00:00:00 2001 +From: Emil Velikov +Date: Thu, 19 Mar 2015 22:26:11 +0000 +Subject: [PATCH] third_party/threads: Use PTHREAD_MUTEX_RECURSIVE by default + +PTHREAD_MUTEX_RECURSIVE_NP was used for compatibility with old glibc. +Although due to the_GNU_SOURCES define the portable, +PTHREAD_MUTEX_RECURSIVE will be available for Linuxes since at least +1998. Simplify things giving us compatibility with musl which +apparently does not provide the non-portable define. + +Inspired by almost identical commit in mesa aead7fe2e2b(c11/threads: Use +PTHREAD_MUTEX_RECURSIVE by default) by Felix Janda. + +Signed-off-by: Emil Velikov +Reviewed-by: Chad Versace +(Romain: cherry picked from commit 3b9b8f5f6d1b99af43e95ec0868404e552a85b73) +Signed-off-by: Romain Naour +--- + third_party/threads/threads_posix.c | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +diff --git a/third_party/threads/threads_posix.c b/third_party/threads/threads_posix.c +index 5835e43..e122bf9 100644 +--- a/third_party/threads/threads_posix.c ++++ b/third_party/threads/threads_posix.c +@@ -26,6 +26,9 @@ + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ ++ ++#define _GNU_SOURCE ++ + #include + #ifndef assert + #include +@@ -150,13 +153,8 @@ int mtx_init(mtx_t *mtx, int type) + && type != (mtx_try|mtx_recursive)) + return thrd_error; + pthread_mutexattr_init(&attr); +- if ((type & mtx_recursive) != 0) { +-#if defined(__linux__) || defined(__linux) +- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); +-#else ++ if ((type & mtx_recursive) != 0) + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); +-#endif +- } + pthread_mutex_init(mtx, &attr); + pthread_mutexattr_destroy(&attr); + return thrd_success; +-- +2.14.3 + diff --git a/package/waffle/0002-cmake-forward-cflags-from-.pc-files-to-waffle-cflags.patch b/package/waffle/0002-cmake-forward-cflags-from-.pc-files-to-waffle-cflags.patch new file mode 100644 index 0000000000..ffc1b5b8b1 --- /dev/null +++ b/package/waffle/0002-cmake-forward-cflags-from-.pc-files-to-waffle-cflags.patch @@ -0,0 +1,40 @@ +From 8b0ae49c8bea78df73c3ecae0059d54a95c561fa Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Sun, 24 Dec 2017 00:11:45 +0100 +Subject: [PATCH] cmake: forward cflags from *.pc files to waffle cflags + +When building mesa egl without x11 and gles2 the headers need a +MESA_EGL_NO_X11_HEADERS define to avoid including X11 headers. + +This define MESA_EGL_NO_X11_HEADERS is lost while building waffle +since CGLAGS defined by pc files are not used. + +MESA_EGL_NO_X11_HEADERS is defined in CFLAGS from egl.pc. + +Signed-off-by: Romain Naour +--- + src/waffle/CMakeLists.txt | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/waffle/CMakeLists.txt b/src/waffle/CMakeLists.txt +index d76e029..2ff72c8 100644 +--- a/src/waffle/CMakeLists.txt ++++ b/src/waffle/CMakeLists.txt +@@ -5,6 +5,14 @@ + add_definitions( + -DWAFFLE_API_VERSION=${waffle_api_version} + -DWAFFLE_API_EXPERIMENTAL ++ ${egl_CFLAGS} ++ ${gbm_CFLAGS} ++ ${gl_CFLAGS} ++ ${GLEXT_CFLAGS} ++ ${libudev_CFLAGS} ++ ${wayland-client_CFLAGS} ++ ${wayland-egl_CFLAGS} ++ ${x11-xcb_CFLAGS} + ) + + include_directories( +-- +2.14.3 + diff --git a/package/waffle/Config.in b/package/waffle/Config.in new file mode 100644 index 0000000000..2026efdeac --- /dev/null +++ b/package/waffle/Config.in @@ -0,0 +1,48 @@ +config BR2_PACKAGE_WAFFLE_SUPPORTS_GLX + bool + default y if BR2_PACKAGE_HAS_LIBGL && BR2_PACKAGE_XORG7 + +config BR2_PACKAGE_WAFFLE_SUPPORTS_WAYLAND + bool + default y if BR2_PACKAGE_WAYLAND && BR2_PACKAGE_HAS_LIBEGL_WAYLAND + +config BR2_PACKAGE_WAFFLE_SUPPORTS_X11_EGL + bool + default y if BR2_PACKAGE_HAS_LIBEGL && BR2_PACKAGE_XORG7 + +config BR2_PACKAGE_WAFFLE_SUPPORTS_GBM + bool + # mesa3d is for now the only GBM provider, and it is enabled + # together with its EGL support + default y if BR2_PACKAGE_HAS_LIBEGL && BR2_PACKAGE_MESA3D_OPENGL_EGL && BR2_PACKAGE_HAS_UDEV + +config BR2_PACKAGE_WAFFLE + bool "waffle" + depends on BR2_PACKAGE_WAFFLE_SUPPORTS_GLX || \ + BR2_PACKAGE_WAFFLE_SUPPORTS_WAYLAND || \ + BR2_PACKAGE_WAFFLE_SUPPORTS_X11_EGL || \ + BR2_PACKAGE_WAFFLE_SUPPORTS_GBM + depends on BR2_PACKAGE_HAS_LIBGLES # dlopen'ing the GLES libararies at runtime. + select BR2_PACKAGE_XLIB_LIBX11 if BR2_PACKAGE_WAFFLE_SUPPORTS_GLX || BR2_PACKAGE_WAFFLE_SUPPORTS_X11_EGL + select BR2_PACKAGE_LIBXCB if BR2_PACKAGE_WAFFLE_SUPPORTS_GLX || BR2_PACKAGE_WAFFLE_SUPPORTS_X11_EGL + help + Waffle is a cross-platform library that allows one to defer + selection of an OpenGL API and of window system until + runtime. For example, on Linux, Waffle enables an application + to select X11/EGL with an OpenGL 3.3 core profile, Wayland + with OpenGL ES2, and other window system / API combinations. + + Waffle's immediate goal is to enable Piglit [1] to test + multiple OpenGL flavors in a cross-platform way, and to allow + each Piglit test to choose its OpenGL API and window system + at runtime. A future goal is to enable the ability to record + (with another tool such APITrace [2]) an application's OpenGL + calls on one operating system or window system, and then + replay that trace on a different system. + + For more information, visit to Waffle's website. + + [1] http://piglit.freedesktop.org + [2] http://github.com/apitrace/apitrace#readme + + http://www.waffle-gl.org diff --git a/package/waffle/waffle.hash b/package/waffle/waffle.hash new file mode 100644 index 0000000000..5dfb976f2f --- /dev/null +++ b/package/waffle/waffle.hash @@ -0,0 +1,3 @@ +# Locally calculated +sha256 d662f6743f688dc5ea4b7d29f558eb54bd8f57350080f04a006693d22e5d1d5b waffle-v1.5.2.tar.gz +sha256 630844d1911c8a1b7b888a1de9097c4860b7e381362fd5aa64141d58ab7ecc9b LICENSE.txt diff --git a/package/waffle/waffle.mk b/package/waffle/waffle.mk new file mode 100644 index 0000000000..c6dd0d5451 --- /dev/null +++ b/package/waffle/waffle.mk @@ -0,0 +1,48 @@ +################################################################################ +# +# waffle +# +################################################################################ + +WAFFLE_VERSION = v1.5.2 +WAFFLE_SITE = $(call github,waffle-gl,waffle,$(WAFFLE_VERSION)) +WAFFLE_INSTALL_STAGING = YES +WAFFLE_LICENSE = BSD-2-Clause +WAFFLE_LICENSE_FILES = LICENSE.txt + +WAFFLE_DEPENDENCIES = host-pkgconf + +WAFFLE_CONF_OPTS = -Dwaffle_build_tests=OFF \ + -Dwaffle_build_examples=OFF \ + -Dwaffle_build_manpages=OFF \ + -Dwaffle_build_htmldocs=OFF + +ifeq ($(BR2_PACKAGE_WAFFLE_SUPPORTS_WAYLAND),y) +WAFFLE_DEPENDENCIES += libegl wayland +WAFFLE_CONF_OPTS += -Dwaffle_has_wayland=ON +else +WAFFLE_CONF_OPTS += -Dwaffle_has_wayland=OFF +endif + +ifeq ($(BR2_PACKAGE_WAFFLE_SUPPORTS_X11_EGL),y) +WAFFLE_DEPENDENCIES += libegl libxcb xlib_libX11 +WAFFLE_CONF_OPTS += -Dwaffle_has_x11_egl=ON +else +WAFFLE_CONF_OPTS += -Dwaffle_has_x11_egl=OFF +endif + +ifeq ($(BR2_PACKAGE_WAFFLE_SUPPORTS_GLX),y) +WAFFLE_DEPENDENCIES += libgl libxcb xlib_libX11 +WAFFLE_CONF_OPTS += -Dwaffle_has_glx=ON +else +WAFFLE_CONF_OPTS += -Dwaffle_has_glx=OFF +endif + +ifeq ($(BR2_PACKAGE_WAFFLE_SUPPORTS_GBM),y) +WAFFLE_DEPENDENCIES += libegl udev +WAFFLE_CONF_OPTS += -Dwaffle_has_gbm=ON +else +WAFFLE_CONF_OPTS += -Dwaffle_has_gbm=OFF +endif + +$(eval $(cmake-package))