From 06ed82677a84fae47f0ab87b89519ea1792af346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 23 Aug 2015 12:39:44 +0200 Subject: [PATCH] qt5: embed path to mesa (libGL) in Qt mkspecs file Fixes this problem, when building apps in QtCreator: ...(compile output window) g++ -Wl,-rpath,/nix/store/1w7h7p6s2srfw2ady90k7072991lrnpp-qtbase-5.4.2/lib \ -o qt-test3 main.o mainwindow.o moc_mainwindow.o \ -L/nix/store/1w7h7p6s2srfw2ady90k7072991lrnpp-qtbase-5.4.2/lib \ -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread /nix/store/b8qhjrwf8sf9ggkjxqqav7f1m6w83bh0-binutils-2.23.1/bin/ld: cannot find -lGL collect2: error: ld returned 1 exit status mesa is already in the closure of Qt, so there is no size increase. The patch is copied into both qt-5.3 and qt-5.4 directories, like other patches are. Note that programs still can _run_ against a different libGL (e.g. one provided by nvidia) by configuring the dynamic linker. For instance, NixOS sets the LD_LIBRARY_PATH environment variable to /run/opengl-driver/lib/, meaning that whatever libGL is found there will be used instead of the default (mesa). --- .../libraries/qt-5/5.3/0014-mkspecs-libgl.patch | 15 +++++++++++++++ pkgs/development/libraries/qt-5/5.3/default.nix | 3 ++- .../libraries/qt-5/5.4/0014-mkspecs-libgl.patch | 15 +++++++++++++++ pkgs/development/libraries/qt-5/5.4/qtbase.nix | 3 ++- 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/libraries/qt-5/5.3/0014-mkspecs-libgl.patch create mode 100644 pkgs/development/libraries/qt-5/5.4/0014-mkspecs-libgl.patch diff --git a/pkgs/development/libraries/qt-5/5.3/0014-mkspecs-libgl.patch b/pkgs/development/libraries/qt-5/5.3/0014-mkspecs-libgl.patch new file mode 100644 index 000000000000..94a031d12574 --- /dev/null +++ b/pkgs/development/libraries/qt-5/5.3/0014-mkspecs-libgl.patch @@ -0,0 +1,15 @@ +Ensure Qt knows where libGL is. + +Author: Bjørn Forsman +diff -uNr qt-everywhere-opensource-src-5.3.2.orig/qtbase/mkspecs/common/linux.conf qt-everywhere-opensource-src-5.3.2/qtbase/mkspecs/common/linux.conf +--- qt-everywhere-opensource-src-5.3.2.orig/qtbase/mkspecs/common/linux.conf 2014-09-11 12:48:07.000000000 +0200 ++++ qt-everywhere-opensource-src-5.3.2/qtbase/mkspecs/common/linux.conf 2015-08-23 13:03:30.617473019 +0200 +@@ -13,7 +13,7 @@ + QMAKE_INCDIR_X11 = + QMAKE_LIBDIR_X11 = + QMAKE_INCDIR_OPENGL = +-QMAKE_LIBDIR_OPENGL = ++QMAKE_LIBDIR_OPENGL = @mesa@/lib + QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_OPENGL + QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL + QMAKE_INCDIR_EGL = diff --git a/pkgs/development/libraries/qt-5/5.3/default.nix b/pkgs/development/libraries/qt-5/5.3/default.nix index 7f4e0b60c2d0..d1a049d78a72 100644 --- a/pkgs/development/libraries/qt-5/5.3/default.nix +++ b/pkgs/development/libraries/qt-5/5.3/default.nix @@ -81,7 +81,8 @@ stdenv.mkDerivation rec { (substituteAll { src = ./0011-dlopen-openssl.patch; inherit openssl; }) (substituteAll { src = ./0012-dlopen-dbus.patch; dbus_libs = dbus; }) ./0013-qtwebkit-glib-2.44.patch - ]; + ] ++ optional mesaSupported + (substituteAll { src = ./0014-mkspecs-libgl.patch; inherit mesa; }); preConfigure = '' export LD_LIBRARY_PATH="$PWD/qtbase/lib:$PWD/qtbase/plugins/platforms:$PWD/qttools/lib:$LD_LIBRARY_PATH" diff --git a/pkgs/development/libraries/qt-5/5.4/0014-mkspecs-libgl.patch b/pkgs/development/libraries/qt-5/5.4/0014-mkspecs-libgl.patch new file mode 100644 index 000000000000..94a031d12574 --- /dev/null +++ b/pkgs/development/libraries/qt-5/5.4/0014-mkspecs-libgl.patch @@ -0,0 +1,15 @@ +Ensure Qt knows where libGL is. + +Author: Bjørn Forsman +diff -uNr qt-everywhere-opensource-src-5.3.2.orig/qtbase/mkspecs/common/linux.conf qt-everywhere-opensource-src-5.3.2/qtbase/mkspecs/common/linux.conf +--- qt-everywhere-opensource-src-5.3.2.orig/qtbase/mkspecs/common/linux.conf 2014-09-11 12:48:07.000000000 +0200 ++++ qt-everywhere-opensource-src-5.3.2/qtbase/mkspecs/common/linux.conf 2015-08-23 13:03:30.617473019 +0200 +@@ -13,7 +13,7 @@ + QMAKE_INCDIR_X11 = + QMAKE_LIBDIR_X11 = + QMAKE_INCDIR_OPENGL = +-QMAKE_LIBDIR_OPENGL = ++QMAKE_LIBDIR_OPENGL = @mesa@/lib + QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_OPENGL + QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL + QMAKE_INCDIR_EGL = diff --git a/pkgs/development/libraries/qt-5/5.4/qtbase.nix b/pkgs/development/libraries/qt-5/5.4/qtbase.nix index 6ec57787e224..2e4a1c1c161a 100644 --- a/pkgs/development/libraries/qt-5/5.4/qtbase.nix +++ b/pkgs/development/libraries/qt-5/5.4/qtbase.nix @@ -71,7 +71,8 @@ stdenv.mkDerivation { (substituteAll { src = ./0011-dlopen-openssl.patch; inherit openssl; }) (substituteAll { src = ./0012-dlopen-dbus.patch; dbus_libs = dbus; }) ./0013-xdg_config_dirs.patch - ] + ] ++ optional mesaSupported + (substituteAll { src = ./0014-mkspecs-libgl.patch; inherit mesa; }) ++ (optional decryptSslTraffic ./0100-ssl.patch); preConfigure = ''