From 1f62bf01d340967ec2a1600108d6686a3804c114 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sun, 16 Apr 2017 09:45:27 -0500 Subject: [PATCH] qt58.qtbase: Fix path to fallback libGL --- .../libraries/qt-5/5.8/qtbase/default.nix | 7 +++---- .../libraries/qt-5/5.8/qtbase/dlopen-gl.patch | 16 +++++++++------- .../development/libraries/qt-5/5.8/qtbase/series | 1 + 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix index 62ff9c2ea51..6d11927d6ce 100644 --- a/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix +++ b/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix @@ -40,7 +40,7 @@ stdenv.mkDerivation { copyPathsToStore (lib.readPathsFromFile ./. ./series) ++ [(if stdenv.isDarwin then ./cmake-paths-darwin.patch else ./cmake-paths.patch)] ++ lib.optional decryptSslTraffic ./decrypt-ssl-traffic.patch - ++ lib.optionals mesaSupported [ ./dlopen-gl.patch ./mkspecs-libgl.patch ]; + ++ lib.optionals mesaSupported [ ./mkspecs-libgl.patch ]; postPatch = '' @@ -54,9 +54,6 @@ stdenv.mkDerivation { sed -i 's/PATHS.*NO_DEFAULT_PATH//' "mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in" '' + lib.optionalString mesaSupported '' - substituteInPlace \ - src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp \ - --replace "@mesa_lib@" "${mesa.out}" substituteInPlace mkspecs/common/linux.conf \ --replace "@mesa_lib@" "${mesa.out}" \ --replace "@mesa_inc@" "${mesa.dev or mesa}" @@ -223,6 +220,8 @@ stdenv.mkDerivation { then ''-DNIXPKGS_LIBDBUS="${dbus.lib}/lib/libdbus-1"'' else ''-DNIXPKGS_LIBDBUS=""'') ] + ++ lib.optional mesaSupported + ''-DNIXPKGS_MESA_GL="${mesa.out}/lib/libGL"'' ++ lib.optionals stdenv.isDarwin [ "-D__MAC_OS_X_VERSION_MAX_ALLOWED=1090" diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/dlopen-gl.patch b/pkgs/development/libraries/qt-5/5.8/qtbase/dlopen-gl.patch index ea3073ced50..c835f2bfe44 100644 --- a/pkgs/development/libraries/qt-5/5.8/qtbase/dlopen-gl.patch +++ b/pkgs/development/libraries/qt-5/5.8/qtbase/dlopen-gl.patch @@ -1,17 +1,19 @@ -Index: qtbase-opensource-src-5.5.1/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +Index: qtbase-opensource-src-5.8.0/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp =================================================================== ---- qtbase-opensource-src-5.5.1.orig/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp -+++ qtbase-opensource-src-5.5.1/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp -@@ -563,7 +563,12 @@ void (*QGLXContext::getProcAddress(const - { +--- qtbase-opensource-src-5.8.0.orig/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp ++++ qtbase-opensource-src-5.8.0/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +@@ -576,7 +576,14 @@ QFunctionPointer QGLXContext::getProcAdd + #ifndef QT_NO_LIBRARY extern const QString qt_gl_library_name(); // QLibrary lib(qt_gl_library_name()); + // Check system library paths first QLibrary lib(QLatin1String("GL")); ++#ifdef NIXPKGS_MESA_GL + if (!lib.load()) { + // Fallback to Mesa driver -+ lib.setFileName(QLatin1String("@mesa_lib@/lib/libGL")); ++ lib.setFileName(QLatin1String(NIXPKGS_MESA_GL)); + } ++#endif // NIXPKGS_MESA_GL glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB"); + #endif } - } diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/series b/pkgs/development/libraries/qt-5/5.8/qtbase/series index f0b1bfa674d..9939aea7400 100644 --- a/pkgs/development/libraries/qt-5/5.8/qtbase/series +++ b/pkgs/development/libraries/qt-5/5.8/qtbase/series @@ -7,3 +7,4 @@ xdg-config-dirs.patch compose-search-path.patch libressl.patch qpa-plugin-path.patch +dlopen-gl.patch