Skip to content

Commit

Permalink
media-libs/glfw: Add minecraft patches from ninja-
Browse files Browse the repository at this point in the history
Also adds an additional patch to actually link against libdecoration if
requested.

Upstream pull request:
glfw/glfw#1725
  • Loading branch information
Calum Knight committed Dec 26, 2020
1 parent e6fa844 commit e5cd830
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
2 changes: 2 additions & 0 deletions media-libs/glfw/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
AUX glfw-9999-libdecoration-cmake.patch 987 BLAKE2B 3f78490ee88fd60da998fddf8227ce2253df9528a074e8cb24a764a1e280c620be0d6fb796e3e1f4fbf5e3422ddc991f8bd380a195764c0f0b55049bf307bb43 SHA512 cdb22da3534494c17cebbad40faa302d101c8088d26598865a7bfa894a8853acb839e061037bc575f98d4efaec654e5f8fcca8911852c6fac2fb25b31d23f6bb
EBUILD glfw-9999.ebuild 1203 BLAKE2B be0f96aa4dfde14ebc247d42fd4856e4f148cec139d0908e36da63f4c58cf3c72ec19e5291ba936ef770d0413015c8664f9291160773c9aaa9180a26beb80c96 SHA512 622bcc563f481b38f1ffdf30b5d7033fd6c8d9928600a30ca6454953e264c4e8ad629070148bfa33e1677f586e6b8617cd96f07dbb8cb87e026edc2e02a396e1
30 changes: 30 additions & 0 deletions media-libs/glfw/files/glfw-9999-libdecoration-cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3f5ebeb2..eb7687cd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -237,6 +237,14 @@ if (_GLFW_WAYLAND)
list(APPEND glfw_LIBRARIES "${EPOLLSHIM_LIBRARIES}")
endif()
endif()
+
+ if (GLFW_USE_LIBDECORATION)
+ set(WITH_DECORATION 1)
+ pkg_check_modules(Decoration REQUIRED
+ decoration)
+ list(APPEND glfw_INCLUDE_DIRS "${Decoration_INCLUDE_DIRS}")
+ list(APPEND glfw_LIBRARIES "${Decoration_LIBRARIES}")
+ endif()
endif()

#--------------------------------------------------------------------
diff --git a/src/glfw_config.h.in b/src/glfw_config.h.in
index f4876da2..3d848111 100644
--- a/src/glfw_config.h.in
+++ b/src/glfw_config.h.in
@@ -56,3 +56,6 @@
// Define this to 1 if the libc supports memfd_create()
#cmakedefine HAVE_MEMFD_CREATE

+// Define this to 1 if using libdecoration to provide Wayland decoration support
+#cmakedefine WITH_DECORATION
+
59 changes: 59 additions & 0 deletions media-libs/glfw/glfw-9999.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit cmake git-r3

DESCRIPTION="The Portable OpenGL FrameWork"
HOMEPAGE="https://www.glfw.org/"
EGIT_REPO_URI="https://github.com/ninja-/glfw.git"
EGIT_BRANCH="wayland_fixes"

LICENSE="ZLIB"
SLOT="0"
IUSE="wayland libdecoration"

RDEPEND="
x11-libs/libxkbcommon
!wayland? (
virtual/opengl
x11-libs/libX11
x11-libs/libXcursor
x11-libs/libXinerama
x11-libs/libXrandr
x11-libs/libXxf86vm
)
wayland? (
dev-libs/wayland
dev-util/meson
libdecoration? ( gui-libs/libdecoration )
media-libs/mesa[egl,wayland]
)
"
DEPEND="
${RDEPEND}
!wayland? ( x11-libs/libXi )
wayland? ( dev-libs/wayland-protocols )
"
BDEPEND="
wayland? ( kde-frameworks/extra-cmake-modules )
"

PATCHES=( "${FILESDIR}/${PN}-9999-libdecoration-cmake.patch" )

pkg_pretend() {
if use libdecoration && ! use wayland; then
ewarn "libdecoration USE flag has no effect without wayland"
fi
}

src_configure() {
local mycmakeargs=(
-DGLFW_BUILD_EXAMPLES=no
-DGLFW_USE_WAYLAND="$(usex wayland)"
-DGLFW_USE_LIBDECORATION="$(usex libdecoration)"
-DBUILD_SHARED_LIBS=1
)
cmake_src_configure
}

0 comments on commit e5cd830

Please sign in to comment.