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).
This commit is contained in:
Bjørn Forsman 2015-08-23 12:39:44 +02:00
parent 16b5d3f70b
commit 06ed82677a
4 changed files with 34 additions and 2 deletions

View File

@ -0,0 +1,15 @@
Ensure Qt knows where libGL is.
Author: Bjørn Forsman <bjorn.forsman@gmail.com>
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 =

View File

@ -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"

View File

@ -0,0 +1,15 @@
Ensure Qt knows where libGL is.
Author: Bjørn Forsman <bjorn.forsman@gmail.com>
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 =

View File

@ -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 = ''