commit:     909c1837f2cdc2bf1d93728b33c7c1285dff96bb
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  7 21:16:43 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri Feb  7 21:47:24 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=909c1837

media-libs/waffle: Generate WaffleConfig.cmake file

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 ...ate-cmake-config-and-version-files-if-mes.patch | 87 ++++++++++++++++++++++
 media-libs/waffle/waffle-1.6.0-r1.ebuild           | 77 +++++++++++++++++++
 2 files changed, 164 insertions(+)

diff --git 
a/media-libs/waffle/files/waffle-1.6.0-meson-Generate-cmake-config-and-version-files-if-mes.patch
 
b/media-libs/waffle/files/waffle-1.6.0-meson-Generate-cmake-config-and-version-files-if-mes.patch
new file mode 100644
index 00000000000..ef31275de08
--- /dev/null
+++ 
b/media-libs/waffle/files/waffle-1.6.0-meson-Generate-cmake-config-and-version-files-if-mes.patch
@@ -0,0 +1,87 @@
+From b71cfa674db5828a2be04a42ce9996d6677629ee Mon Sep 17 00:00:00 2001
+From: Dylan Baker <dy...@pnwbakers.com>
+Date: Fri, 7 Jun 2019 15:36:09 -0700
+Subject: [PATCH] meson: Generate cmake config and version files if meson is
+ new enough
+
+Meson 0.50.0 added a module similar to the pkg-config module for
+generating cmake config files. Since the CMake build system provides
+these the meson build system should as well.
+
+v2: - Bump version to 0.50 instead of incorrect 0.49
+v3: - remove TODO comment that this fixes
+    - Add a definition of set_and_check for meson-generated Config
+      files.
+
+Reviewed-by: Eric Engestrom <eric.engest...@intel.com>
+---
+ cmake/Modules/WaffleConfig.cmake.in | 10 ++++++++++
+ meson.build                         |  2 --
+ src/waffle/meson.build              | 20 ++++++++++++++++++++
+ 3 files changed, 30 insertions(+), 2 deletions(-)
+
+diff --git a/cmake/Modules/WaffleConfig.cmake.in 
b/cmake/Modules/WaffleConfig.cmake.in
+index b60b470..4e19755 100644
+--- a/cmake/Modules/WaffleConfig.cmake.in
++++ b/cmake/Modules/WaffleConfig.cmake.in
+@@ -7,6 +7,16 @@
+ 
+ @PACKAGE_INIT@
+ 
++# This should only be used for meson
++if (NOT DEFINED set_and_check)
++    macro(set_and_check _var _file)
++        set(${_var} "${_file}")
++        if(NOT EXISTS "${_file}")
++            message(FATAL_ERROR "File or directory ${_file} referenced by 
variable ${_var} does not exist !")
++        endif()
++    endmacro()
++endif()
++
+ set_and_check(Waffle_INCLUDE_DIRS 
"@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@/@waffle_libname@")
+ set_and_check(Waffle_LIBRARY_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
+ set(Waffle_LIBRARIES "@waffle_libname@")
+diff --git a/meson.build b/meson.build
+index 29fda22..22b7f59 100644
+--- a/meson.build
++++ b/meson.build
+@@ -231,5 +231,3 @@ endif
+ if get_option('build-examples')
+   subdir('examples')
+ endif
+-
+-# TODO:  CMake config file
+diff --git a/src/waffle/meson.build b/src/waffle/meson.build
+index 322df40..cd68ddf 100644
+--- a/src/waffle/meson.build
++++ b/src/waffle/meson.build
+@@ -211,6 +211,26 @@ pkg.generate(
+   description : 'A library for selecting an OpenGL API and windows system at 
runtime.',
+ )
+ 
++if meson.version().version_compare('>= 0.50')
++  cmake = import('cmake')
++  cmake.write_basic_package_version_file(
++    name : 'Waffle',
++    version : meson.project_version(),
++    compatibility : 'SameMajorVersion',
++  )
++
++  cmake_conf = configuration_data()
++  cmake_conf.set('waffle_libname', waffle_name)
++  cmake_conf.set('PACKAGE_CMAKE_INSTALL_INCLUDEDIR', 
join_paths('${PACKAGE_PREFIX_DIR}', get_option('includedir')))
++  cmake_conf.set('PACKAGE_CMAKE_INSTALL_LIBDIR', 
join_paths('${PACKAGE_PREFIX_DIR}', get_option('libdir')))
++
++  cmake.configure_package_config_file(
++    name : 'Waffle',
++    input : '../../cmake/Modules/WaffleConfig.cmake.in',
++    configuration : cmake_conf,
++  )
++endif
++
+ if get_option('build-tests')
+   if get_option('default_library') == 'shared'
+     # The unit tests need to poke at internals of the library, but with a
+-- 
+2.24.1
+

diff --git a/media-libs/waffle/waffle-1.6.0-r1.ebuild 
b/media-libs/waffle/waffle-1.6.0-r1.ebuild
new file mode 100644
index 00000000000..2f9c6de8b55
--- /dev/null
+++ b/media-libs/waffle/waffle-1.6.0-r1.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+if [[ ${PV} = *9999* ]]; then
+       EGIT_REPO_URI="https://gitlab.freedesktop.org/mesa/${PN}";
+       GIT_ECLASS="git-r3"
+else
+       SRC_URI="http://www.waffle-gl.org/files/release/${P}/${P}.tar.xz";
+       KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86"
+fi
+inherit meson multilib-minimal ${GIT_ECLASS}
+
+DESCRIPTION="Library that allows selection of GL API and of window system at 
runtime"
+HOMEPAGE="http://www.waffle-gl.org/ https://gitlab.freedesktop.org/mesa/waffle";
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="doc egl gbm test wayland X"
+RESTRICT="test" # gl_basic tests don't work when run from portage
+
+RDEPEND="
+       >=media-libs/mesa-9.1.6[egl?,gbm?,${MULTILIB_USEDEP}]
+       >=virtual/opengl-7.0-r1[${MULTILIB_USEDEP}]
+       >=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
+       >=x11-libs/libxcb-1.9.1[${MULTILIB_USEDEP}]
+       gbm? ( >=virtual/libudev-208:=[${MULTILIB_USEDEP}] )
+       wayland? ( >=dev-libs/wayland-1.0.6[${MULTILIB_USEDEP}] )
+"
+DEPEND="${RDEPEND}
+       >=x11-base/xcb-proto-1.8-r3[${MULTILIB_USEDEP}]
+       doc? (
+               dev-libs/libxslt
+               app-text/docbook-xml-dtd:4.2
+       )
+"
+
+PATCHES=(
+       
"${FILESDIR}"/${P}-meson-Generate-cmake-config-and-version-files-if-mes.patch
+)
+
+MULTILIB_CHOST_TOOLS=(
+       /usr/bin/wflinfo$(get_exeext)
+)
+
+src_unpack() {
+       default
+       [[ $PV = 9999* ]] && git-r3_src_unpack
+}
+
+multilib_src_configure() {
+       local emesonargs=(
+               $(meson_feature X glx)
+               $(meson_feature wayland)
+               $(meson_feature X x11_egl)
+               $(meson_feature gbm)
+               $(meson_feature egl surfaceless_egl)
+               $(meson_use test build-tests)
+               $(meson_use doc build-manpages)
+       )
+       meson_src_configure
+}
+
+multilib_src_compile() {
+       meson_src_compile
+}
+
+multilib_src_test() {
+       meson_src_test
+}
+
+multilib_src_install() {
+       meson_src_install
+
+       rm -rf "${D}"/usr/share/doc/waffle1
+}

Reply via email to