about summary refs log tree commit diff
path: root/pkgs/development/libraries/qt-5/5.8
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@mailbox.org>2017-05-15 06:44:33 -0500
committerThomas Tuegel <ttuegel@mailbox.org>2017-06-18 08:41:57 -0500
commit3f3d33a07867116446ec9b5e2675ef1c8de8127d (patch)
treeb0c362b10bb8e908c2be61aadae8f9cdb69a8c6e /pkgs/development/libraries/qt-5/5.8
parent08d25152b85fb24f7b5b85efe25d6be4deb12227 (diff)
downloadnixlib-3f3d33a07867116446ec9b5e2675ef1c8de8127d.tar
nixlib-3f3d33a07867116446ec9b5e2675ef1c8de8127d.tar.gz
nixlib-3f3d33a07867116446ec9b5e2675ef1c8de8127d.tar.bz2
nixlib-3f3d33a07867116446ec9b5e2675ef1c8de8127d.tar.lz
nixlib-3f3d33a07867116446ec9b5e2675ef1c8de8127d.tar.xz
nixlib-3f3d33a07867116446ec9b5e2675ef1c8de8127d.tar.zst
nixlib-3f3d33a07867116446ec9b5e2675ef1c8de8127d.zip
qt5: use distinct `lib/qt-5.x` prefix for each minor version
Using a distinct prefix for plugins and QML libraries allows multiple Qt 5 minor
versions to coexist in the same environment.
Diffstat (limited to 'pkgs/development/libraries/qt-5/5.8')
-rw-r--r--pkgs/development/libraries/qt-5/5.8/default.nix9
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtbase/default.nix18
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtbase/nix-profiles-library-paths.patch8
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix4
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtdeclarative/nix-profiles-import-paths.patch20
5 files changed, 35 insertions, 24 deletions
diff --git a/pkgs/development/libraries/qt-5/5.8/default.nix b/pkgs/development/libraries/qt-5/5.8/default.nix
index 2865a879f47d..5a737441fa8e 100644
--- a/pkgs/development/libraries/qt-5/5.8/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/default.nix
@@ -9,8 +9,9 @@ top-level attribute to `top-level/all-packages.nix`.
 1. Update the URL in `maintainers/scripts/generate-qt.sh`.
 2. From the top of the Nixpkgs tree, run
    `./maintainers/scripts/generate-qt.sh > pkgs/development/libraries/qt-5/$VERSION/srcs.nix`.
-3. Check that the new packages build correctly.
-4. Commit the changes and open a pull request.
+3. Update `qtCompatVersion` below if the minor version number changes.
+4. Check that the new packages build correctly.
+5. Commit the changes and open a pull request.
 
 */
 
@@ -29,6 +30,8 @@ with stdenv.lib;
 
 let
 
+  qtCompatVersion = "5.8";
+
   mirror = "http://download.qt.io";
   srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; };
 
@@ -61,7 +64,7 @@ let
 
   addPackages = self: with self;
     let
-      callPackage = self.newScope { inherit qtSubmodule srcs; };
+      callPackage = self.newScope { inherit qtCompatVersion qtSubmodule srcs; };
     in {
 
       qtbase = callPackage ./qtbase {
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 ee6399c2bd46..008eb1e37098 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
@@ -1,6 +1,6 @@
 {
   stdenv, lib, copyPathsToStore,
-  src, version,
+  src, version, qtCompatVersion,
 
   coreutils, bison, flex, gdb, gperf, lndir, patchelf, perl, pkgconfig, python2,
   ruby,
@@ -32,7 +32,7 @@ in
 stdenv.mkDerivation {
 
   name = "qtbase-${version}";
-  inherit src version;
+  inherit qtCompatVersion src version;
 
   propagatedBuildInputs =
     [
@@ -117,18 +117,22 @@ stdenv.mkDerivation {
      # Note on the above: \x27 is a way if including a single-quote
      # character in the sed string arguments.
 
+  qtPluginPrefix = "lib/qt-${qtCompatVersion}/plugins";
+  qtQmlPrefix = "lib/qt-${qtCompatVersion}/qml";
+  qtDocPrefix = "share/doc/qt-${qtCompatVersion}";
+
   setOutputFlags = false;
   preConfigure = ''
     export LD_LIBRARY_PATH="$PWD/lib:$PWD/plugins/platforms:$LD_LIBRARY_PATH"
     export MAKEFLAGS=-j$NIX_BUILD_CORES
 
     configureFlags+="\
-        -plugindir $out/lib/qt5/plugins \
-        -importdir $out/lib/qt5/imports \
-        -qmldir $out/lib/qt5/qml \
-        -docdir $out/share/doc/qt5"
+        -plugindir $out/$qtPluginPrefix \
+        -qmldir $out/$qtQmlPrefix \
+        -docdir $out/$qtDocPrefix"
 
-    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/lib/qt5/plugins/platforms\""
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PREFIX=\"$qtPluginPrefix\""
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/$qtPluginPrefix/platforms\""
   '';
 
 
diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/nix-profiles-library-paths.patch b/pkgs/development/libraries/qt-5/5.8/qtbase/nix-profiles-library-paths.patch
index 553c71d0ace3..f626e399288a 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtbase/nix-profiles-library-paths.patch
+++ b/pkgs/development/libraries/qt-5/5.8/qtbase/nix-profiles-library-paths.patch
@@ -7,11 +7,11 @@ Index: qtbase-opensource-src-5.8.0/src/corelib/kernel/qcoreapplication.cpp
          coreappdata()->app_libpaths.reset(app_libpaths);
  
 +        // Add library paths derived from NIX_PROFILES.
-+        const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
-+        const QString plugindir = QString::fromLatin1("/lib/qt5/plugins");
-+        for (const QByteArray &profile: profiles) {
++        const QStringList profiles = QFile::decodeName(qgetenv("NIX_PROFILES")).split(' ');
++        const QString plugindir = QStringLiteral(NIXPKGS_QT_PLUGIN_PREFIX);
++        for (const QString &profile: profiles) {
 +            if (!profile.isEmpty()) {
-+                app_libpaths->append(QFile::decodeName(profile) + plugindir);
++                app_libpaths->append(profile + QDir::separator() + plugindir);
 +            }
 +        }
 +
diff --git a/pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix b/pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix
index acddbd9e3657..28ea571adca0 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix
@@ -8,6 +8,10 @@ qtSubmodule {
   qtInputs = [ qtbase qtsvg qtxmlpatterns ];
   nativeBuildInputs = [ python2 makeQtWrapper ];
 
+  preConfigure = ''
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QML2_IMPORT_PREFIX=\"$qtQmlPrefix\""
+  '';
+
   postInstall = ''
     wrapQtProgram $out/bin/qmleasing
     wrapQtProgram $out/bin/qmlscene
diff --git a/pkgs/development/libraries/qt-5/5.8/qtdeclarative/nix-profiles-import-paths.patch b/pkgs/development/libraries/qt-5/5.8/qtdeclarative/nix-profiles-import-paths.patch
index 06b244b974ff..2d51f7b67596 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtdeclarative/nix-profiles-import-paths.patch
+++ b/pkgs/development/libraries/qt-5/5.8/qtdeclarative/nix-profiles-import-paths.patch
@@ -1,20 +1,20 @@
-Index: qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
+Index: qtdeclarative-opensource-src-5.8.0/src/qml/qml/qqmlimport.cpp
 ===================================================================
---- qtdeclarative-opensource-src-5.5.1.orig/src/qml/qml/qqmlimport.cpp
-+++ qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
-@@ -1549,6 +1549,15 @@ QQmlImportDatabase::QQmlImportDatabase(Q
+--- qtdeclarative-opensource-src-5.8.0.orig/src/qml/qml/qqmlimport.cpp
++++ qtdeclarative-opensource-src-5.8.0/src/qml/qml/qqmlimport.cpp
+@@ -1630,6 +1630,15 @@ QQmlImportDatabase::QQmlImportDatabase(Q
      QString installImportsPath =  QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
      addImportPath(installImportsPath);
  
 +    // Add library paths derived from NIX_PROFILES.
-+    const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
-+    const QString qmldir = QString::fromLatin1("/lib/qt5/qml");
-+    Q_FOREACH (const QByteArray &profile, profiles) {
++    const QStringList profiles = QFile::decodeName(qgetenv("NIX_PROFILES")).split(' ');
++    const QString qmldir = QStringLiteral(NIXPKGS_QML2_IMPORT_PREFIX);
++    for (const QString &profile: profiles) {
 +        if (!profile.isEmpty()) {
-+            addImportPath(QFile::decodeName(profile) + qmldir);
++            addImportPath(profile + QDir::separator() + qmldir);
 +        }
 +    }
 +
      // env import paths
-     QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
-     if (!envImportPath.isEmpty()) {
+     if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
+         const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");