git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commit3f3d33a07867116446ec9b5e2675ef1c8de8127d authorThomas Tuegel <ttuegel@mailbox.org> dateMon 15 May 2017, 06:44 (10 years ago) parent08d2515
30 files changed+129−123
nixos/modules/services/x11/desktop-managers/plasma5.nix−1 pkgs/applications/display-managers/sddm/default.nix+1−1 pkgs/applications/science/programming/fdr/default.nix+1−1 pkgs/applications/science/robotics/qgroundcontrol/default.nix+3−3 pkgs/desktops/lxqt/default.nix+1−1 pkgs/desktops/plasma-5/libkscreen/default.nix+1−1 pkgs/desktops/plasma-5/startkde/default.nix+1−14 pkgs/desktops/plasma-5/startkde/startkde.sh+1−3 pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh+9−4 pkgs/development/libraries/kde-frameworks/kwindowsystem/default.nix+1−1 pkgs/development/libraries/qmltermwidget/default.nix+1−1 pkgs/development/libraries/qt-5/5.6/default.nix+6−3 pkgs/development/libraries/qt-5/5.6/qtbase/default.nix+11−6 pkgs/development/libraries/qt-5/5.6/qtbase/nix-profiles-library-paths.patch+4−4 pkgs/development/libraries/qt-5/5.6/qtdeclarative/default.nix+4 pkgs/development/libraries/qt-5/5.6/qtdeclarative/nix-profiles-import-paths.patch+10−10 pkgs/development/libraries/qt-5/5.6/qtwebengine/default.nix+3−4 pkgs/development/libraries/qt-5/5.8/default.nix+6−3 pkgs/development/libraries/qt-5/5.8/qtbase/default.nix+11−7 pkgs/development/libraries/qt-5/5.8/qtbase/nix-profiles-library-paths.patch+4−4 pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix+4 pkgs/development/libraries/qt-5/5.8/qtdeclarative/nix-profiles-import-paths.patch+10−10 pkgs/development/libraries/qt-5/make-qt-wrapper-darwin.sh+2−5 pkgs/development/libraries/qt-5/make-qt-wrapper.sh+2−5 pkgs/development/libraries/qt-5/qt-env.nix+3−4 pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh+13−12 pkgs/development/libraries/qt-5/qtbase-setup-hook.sh+13−12 pkgs/development/libraries/qtwebkit-plugins/default.nix+1−1 pkgs/development/qtcreator/default.nix+1−1 pkgs/tools/misc/qt5ct/default.nix+1−1
nixos/modules/services/x11/desktop-managers/plasma5.nix−1
@@ -183,7 +183,6 @@ in
183183 environment.variables = {
184184 # Enable GTK applications to load SVG icons
185185 GDK_PIXBUF_MODULE_FILE = "${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache";
186− QT_PLUGIN_PATH = "/run/current-system/sw/lib/qt5/plugins";
187186 };
188187
189188 fonts.fonts = with pkgs; [ noto-fonts hack-font ];
pkgs/applications/display-managers/sddm/default.nix+1−1
@@ -53,7 +53,7 @@ let
5353 ];
5454
5555 preConfigure = ''
56− export cmakeFlags="$cmakeFlags -DQT_IMPORTS_DIR=$out/lib/qt5/qml -DCMAKE_INSTALL_SYSCONFDIR=$out/etc -DSYSTEMD_SYSTEM_UNIT_DIR=$out/lib/systemd/system"
56+ export cmakeFlags="$cmakeFlags -DQT_IMPORTS_DIR=$out/$qtQmlPrefix -DCMAKE_INSTALL_SYSCONFDIR=$out/etc -DSYSTEMD_SYSTEM_UNIT_DIR=$out/lib/systemd/system"
5757 '';
5858
5959 enableParallelBuilding = true;
pkgs/applications/science/programming/fdr/default.nix+1−1
@@ -28,7 +28,7 @@ stdenv.mkDerivation {
2828 cp -r * "$out"
2929 # Hack around lack of libtinfo in NixOS
3030 ln -s ${ncurses.out}/lib/libncursesw.so.6 $out/lib/libtinfo.so.5
31− ln -s ${qtbase.out}/lib/qt5/plugins $out/lib/qt_plugins
31+ ln -s ${qtbase.out}/$qtPluginPrefix $out/lib/qt_plugins
3232 ln -s ${zlib.out}/lib/libz.so.1 $out/lib/libz.so.1
3333
3434 for b in fdr4 _fdr4 refines _refines cspmprofiler cspmexplorerprof
pkgs/applications/science/robotics/qgroundcontrol/default.nix+3−3
@@ -56,10 +56,10 @@ stdenv.mkDerivation rec {
5656
5757 # we need to link to our Qt deps in our own output if we want
5858 # this package to work without being installed as a system pkg
59− mkdir -p $out/lib/qt5 $out/etc/xdg
59+ mkdir -p $out/lib/qt-$qtCompatVersion $out/etc/xdg
6060 for pkg in $qtInputs; do
61− if [[ -d $pkg/lib/qt5 ]]; then
62− for dir in lib/qt5 share etc/xdg; do
61+ if [[ -d $pkg/lib/qt-$qtCompatVersion ]]; then
62+ for dir in lib/qt-$qtCompatVersion share etc/xdg; do
6363 if [[ -d $pkg/$dir ]]; then
6464 ${lndir}/bin/lndir "$pkg/$dir" "$out/$dir"
6565 fi
pkgs/desktops/lxqt/default.nix+1−1
@@ -13,7 +13,7 @@ let
1313 --replace "DESTINATION \"\''${LXQT_ETC_XDG_DIR}" "DESTINATION \"etc/xdg" \
1414 --replace "DESTINATION \"\''${LXQT_SHARE_DIR}" "DESTINATION \"share/lxqt" \
1515 --replace "DESTINATION \"\''${LXQT_GRAPHICS_DIR}" "DESTINATION \"share/lxqt/graphics" \
16− --replace "DESTINATION \"\''${QT_PLUGINS_DIR}" "DESTINATION \"lib/qt5/plugins" \
16+ --replace "DESTINATION \"\''${QT_PLUGINS_DIR}" "DESTINATION \"$qtPluginPrefix" \
1717 --replace "\''${LXQT_TRANSLATIONS_DIR}" share/lxqt/translations
1818 echo ============================
1919 echo $file
pkgs/desktops/plasma-5/libkscreen/default.nix+1−1
@@ -14,6 +14,6 @@ plasmaPackage {
1414 ];
1515 patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
1616 preConfigure = ''
17− NIX_CFLAGS_COMPILE+=" -DNIXPKGS_LIBKSCREEN_BACKENDS=\"''${!outputLib}/lib/qt5/plugins/kf5/kscreen\""
17+ NIX_CFLAGS_COMPILE+=" -DNIXPKGS_LIBKSCREEN_BACKENDS=\"''${!outputLib}/$qtPluginPrefix/kf5/kscreen\""
1818 '';
1919}
pkgs/desktops/plasma-5/startkde/default.nix+1−14
@@ -34,21 +34,8 @@ in runCommand "startkde" env ''
3434 addToSearchPath suffixPATH "$p/lib/libexec/kf5"
3535 done
3636
37− # Configure Qt search paths
38− QT_PLUGIN_PATH=
39− QML_IMPORT_PATH=
40− QML2_IMPORT_PATH=
41− for p in $libs; do
42− addToSearchPath QT_PLUGIN_PATH "$p/lib/qt5/plugins"
43− addToSearchPath QML_IMPORT_PATH "$p/lib/qt5/imports"
44− addToSearchPath QML2_IMPORT_PATH "$p/lib/qt5/qml"
45− done
46−
4737 substitute ${./startkde.sh} "$out" \
4838 --subst-var shell \
49− --subst-var suffixPATH \
50− --subst-var QT_PLUGIN_PATH \
51− --subst-var QML_IMPORT_PATH \
52− --subst-var QML2_IMPORT_PATH
39+ --subst-var suffixPATH
5340 chmod +x "$out"
5441''
pkgs/desktops/plasma-5/startkde/startkde.sh+1−3
@@ -2,9 +2,7 @@
22
33PATH="$PATH${PATH:+:}@suffixPATH@"
44
5−export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}@QT_PLUGIN_PATH@"
6−export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}@QML_IMPORT_PATH@"
7−export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}@QML2_IMPORT_PATH@"
5+echo "NIX_PROFILES=\"$NIX_PROFILES\""
86
97kbuildsycoca5
108
pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh+9−4
@@ -13,10 +13,6 @@ _ecmConfig() {
1313 cmakeFlags+=" -DKDE_INSTALL_LIBDIR=${!outputLib}/lib"
1414 cmakeFlags+=" -DKDE_INSTALL_LIBEXECDIR=${!outputBin}/lib/libexec"
1515 cmakeFlags+=" -DKDE_INSTALL_CMAKEPACKAGEDIR=${!outputDev}/lib/cmake"
16− cmakeFlags+=" -DKDE_INSTALL_QTPLUGINDIR=${!outputBin}/lib/qt5/plugins"
17− cmakeFlags+=" -DKDE_INSTALL_PLUGINDIR=${!outputBin}/lib/qt5/plugins"
18− cmakeFlags+=" -DKDE_INSTALL_QTQUICKIMPORTSDIR=${!outputBin}/lib/qt5/imports"
19− cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/lib/qt5/qml"
2016 cmakeFlags+=" -DKDE_INSTALL_INCLUDEDIR=${!outputInclude}/include"
2117 cmakeFlags+=" -DKDE_INSTALL_LOCALSTATEDIR=/var"
2218 cmakeFlags+=" -DKDE_INSTALL_DATAROOTDIR=${!outputBin}/share"
@@ -46,6 +42,15 @@ _ecmConfig() {
4642 cmakeFlags+=" -DKDE_INSTALL_SYSCONFDIR=${!outputBin}/etc"
4743 cmakeFlags+=" -DKDE_INSTALL_CONFDIR=${!outputBin}/etc/xdg"
4844 cmakeFlags+=" -DKDE_INSTALL_AUTOSTARTDIR=${!outputBin}/etc/xdg/autostart"
45+
46+ if [ -n "$qtPluginPrefix" ]; then
47+ cmakeFlags+=" -DKDE_INSTALL_QTPLUGINDIR=${!outputBin}/$qtPluginPrefix"
48+ cmakeFlags+=" -DKDE_INSTALL_PLUGINDIR=${!outputBin}/$qtPluginPrefix"
49+ fi
50+
51+ if [ -n "$qtQmlPrefix" ]; then
52+ cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/$qtQmlPrefix"
53+ fi
4954}
5055
5156preConfigureHooks+=(_ecmConfig)
pkgs/development/libraries/kde-frameworks/kwindowsystem/default.nix+1−1
@@ -14,6 +14,6 @@ kdeFramework {
1414 propagatedBuildInputs = [ qtx11extras ];
1515 patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
1616 preConfigure = ''
17− NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PATH=\"$out/lib/qt5/plugins\""
17+ NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PATH=\"$out/$qtPluginPrefix\""
1818 '';
1919}
pkgs/development/libraries/qmltermwidget/default.nix+1−1
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
1515
1616 patchPhase = ''
1717 substituteInPlace qmltermwidget.pro \
18− --replace '$$[QT_INSTALL_QML]' "/lib/qt5/qml/"
18+ --replace '$$[QT_INSTALL_QML]' "/$qtQmlPrefix/"
1919 '';
2020
2121 installFlags = [ "INSTALL_ROOT=$(out)" ];
pkgs/development/libraries/qt-5/5.6/default.nix+6−3
@@ -18,8 +18,9 @@ existing packages here and modify it as necessary.
18181. Update the URL in `./fetch.sh`.
19192. Run `./maintainers/scripts/fetch-kde-qt.sh pkgs/development/libraries/qt-5/$VERSION/`
2020 from the top of the Nixpkgs tree.
21−3. Use `nox-review wip` to check that everything builds.
22−4. Commit the changes and open a pull request.
21+3. Update `qtCompatVersion` below if the minor version number changes.
22+4. Check that the new packages build correctly.
23+5. Commit the changes and open a pull request.
2324
2425*/
2526
@@ -38,6 +39,8 @@ with stdenv.lib;
3839
3940let
4041
42+ qtCompatVersion = "5.6";
43+
4144 mirror = "http://download.qt.io";
4245 srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; };
4346
@@ -70,7 +73,7 @@ let
7073
7174 addPackages = self: with self;
7275 let
73− callPackage = self.newScope { inherit qtSubmodule srcs; };
76+ callPackage = self.newScope { inherit qtCompatVersion qtSubmodule srcs; };
7477 in {
7578
7679 qtbase = callPackage ./qtbase {
pkgs/development/libraries/qt-5/5.6/qtbase/default.nix+11−6
@@ -1,5 +1,5 @@
11{ stdenv, lib, fetchgit, copyPathsToStore
2−, srcs
2+, srcs, qtCompatVersion
33
44, xlibs, libX11, libxcb, libXcursor, libXext, libXrender, libXi
55, xcbutil, xcbutilimage, xcbutilkeysyms, xcbutilwm, libxkbcommon
@@ -32,6 +32,7 @@ stdenv.mkDerivation {
3232
3333 name = "qtbase-${srcs.qtbase.version}";
3434 inherit (srcs.qtbase) src version;
35+ inherit qtCompatVersion;
3536
3637 outputs = [ "out" "dev" ];
3738
@@ -94,18 +95,22 @@ stdenv.mkDerivation {
9495 # Note on the above: \x27 is a way if including a single-quote
9596 # character in the sed string arguments.
9697
98+ qtPluginPrefix = "lib/qt-${qtCompatVersion}/plugins";
99+ qtQmlPrefix = "lib/qt-${qtCompatVersion}/qml";
100+ qtDocPrefix = "share/doc/qt-${qtCompatVersion}";
101+
97102 setOutputFlags = false;
98103 preConfigure = ''
99104 export LD_LIBRARY_PATH="$PWD/lib:$PWD/plugins/platforms:$LD_LIBRARY_PATH"
100105 export MAKEFLAGS=-j$NIX_BUILD_CORES
101106
102107 configureFlags+="\
103− -plugindir $out/lib/qt5/plugins \
104− -importdir $out/lib/qt5/imports \
105− -qmldir $out/lib/qt5/qml \
106− -docdir $out/share/doc/qt5"
108+ -plugindir $out/$qtPluginPrefix \
109+ -qmldir $out/$qtQmlPrefix \
110+ -docdir $out/$qtDocPrefix"
107111
108− NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/lib/qt5/plugins/platforms\""
112+ NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PREFIX=\"$qtPluginPrefix\""
113+ NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/$qtPluginPrefix/platforms\""
109114 '';
110115
111116 prefixKey = "-prefix ";
pkgs/development/libraries/qt-5/5.6/qtbase/nix-profiles-library-paths.patch+4−4
@@ -7,11 +7,11 @@ Index: qtbase-opensource-src-5.6.2/src/corelib/kernel/qcoreapplication.cpp
77 coreappdata()->app_libpaths.reset(app_libpaths);
88
99+ // Add library paths derived from NIX_PROFILES.
10−+ const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
11−+ const QString plugindir = QString::fromLatin1("/lib/qt5/plugins");
12−+ for (const QByteArray &profile: profiles) {
10++ const QStringList profiles = QFile::decodeName(qgetenv("NIX_PROFILES")).split(' ');
11++ const QString plugindir = QStringLiteral(NIXPKGS_QT_PLUGIN_PREFIX);
12++ for (const QString &profile: profiles) {
1313+ if (!profile.isEmpty()) {
14−+ app_libpaths->append(QFile::decodeName(profile) + plugindir);
14++ app_libpaths->append(profile + QDir::separator() + plugindir);
1515+ }
1616+ }
1717+
pkgs/development/libraries/qt-5/5.6/qtdeclarative/default.nix+4
@@ -5,4 +5,8 @@ qtSubmodule {
55 patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
66 qtInputs = [ qtbase qtsvg qtxmlpatterns ];
77 nativeBuildInputs = [ python2 ];
8+
9+ preConfigure = ''
10+ NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QML2_IMPORT_PREFIX=\"$qtQmlPrefix\""
11+ '';
812}
pkgs/development/libraries/qt-5/5.6/qtdeclarative/nix-profiles-import-paths.patch+10−10
@@ -1,20 +1,20 @@
1−Index: qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
1+Index: qtdeclarative-opensource-src-5.6.2/src/qml/qml/qqmlimport.cpp
22===================================================================
3−--- qtdeclarative-opensource-src-5.5.1.orig/src/qml/qml/qqmlimport.cpp
4−+++ qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
5−@@ -1549,6 +1549,15 @@ QQmlImportDatabase::QQmlImportDatabase(Q
3+--- qtdeclarative-opensource-src-5.6.2.orig/src/qml/qml/qqmlimport.cpp
4++++ qtdeclarative-opensource-src-5.6.2/src/qml/qml/qqmlimport.cpp
5+@@ -1568,6 +1568,15 @@ QQmlImportDatabase::QQmlImportDatabase(Q
66 QString installImportsPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
77 addImportPath(installImportsPath);
88
99+ // Add library paths derived from NIX_PROFILES.
10−+ const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
11−+ const QString qmldir = QString::fromLatin1("/lib/qt5/qml");
12−+ Q_FOREACH (const QByteArray &profile, profiles) {
10++ const QStringList profiles = QFile::decodeName(qgetenv("NIX_PROFILES")).split(' ');
11++ const QString qmldir = QStringLiteral(NIXPKGS_QML2_IMPORT_PREFIX);
12++ for (const QString &profile: profiles) {
1313+ if (!profile.isEmpty()) {
14−+ addImportPath(QFile::decodeName(profile) + qmldir);
14++ addImportPath(profile + QDir::separator() + qmldir);
1515+ }
1616+ }
1717+
1818 // env import paths
19− QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
20− if (!envImportPath.isEmpty()) {
19+ if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
20+ const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
pkgs/development/libraries/qt-5/5.6/qtwebengine/default.nix+3−4
@@ -42,10 +42,9 @@ qtSubmodule {
4242 sed -i -e 's,/cert.pem,/certs/ca-bundle.crt,' src/3rdparty/chromium/third_party/boringssl/src/crypto/x509/x509_def.c
4343
4444 configureFlags+="\
45− -plugindir $out/lib/qt5/plugins \
46− -importdir $out/lib/qt5/imports \
47− -qmldir $out/lib/qt5/qml \
48− -docdir $out/share/doc/qt5"
45+ -plugindir $out/$qtPluginPrefix \
46+ -qmldir $out/$qtQmlPrefix \
47+ -docdir $out/$qtDocPrefix"
4948 '';
5049 propagatedBuildInputs = [
5150 # Image formats
pkgs/development/libraries/qt-5/5.8/default.nix+6−3
@@ -9,8 +9,9 @@ top-level attribute to `top-level/all-packages.nix`.
991. Update the URL in `maintainers/scripts/generate-qt.sh`.
10102. From the top of the Nixpkgs tree, run
1111 `./maintainers/scripts/generate-qt.sh > pkgs/development/libraries/qt-5/$VERSION/srcs.nix`.
12−3. Check that the new packages build correctly.
13−4. Commit the changes and open a pull request.
12+3. Update `qtCompatVersion` below if the minor version number changes.
13+4. Check that the new packages build correctly.
14+5. Commit the changes and open a pull request.
1415
1516*/
1617
@@ -29,6 +30,8 @@ with stdenv.lib;
2930
3031let
3132
33+ qtCompatVersion = "5.8";
34+
3235 mirror = "http://download.qt.io";
3336 srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; };
3437
@@ -61,7 +64,7 @@ let
6164
6265 addPackages = self: with self;
6366 let
64− callPackage = self.newScope { inherit qtSubmodule srcs; };
67+ callPackage = self.newScope { inherit qtCompatVersion qtSubmodule srcs; };
6568 in {
6669
6770 qtbase = callPackage ./qtbase {
pkgs/development/libraries/qt-5/5.8/qtbase/default.nix+11−7
@@ -1,6 +1,6 @@
11{
22 stdenv, lib, copyPathsToStore,
3− src, version,
3+ src, version, qtCompatVersion,
44
55 coreutils, bison, flex, gdb, gperf, lndir, patchelf, perl, pkgconfig, python2,
66 ruby,
@@ -32,7 +32,7 @@ in
3232stdenv.mkDerivation {
3333
3434 name = "qtbase-${version}";
35− inherit src version;
35+ inherit qtCompatVersion src version;
3636
3737 propagatedBuildInputs =
3838 [
@@ -117,18 +117,22 @@ stdenv.mkDerivation {
117117 # Note on the above: \x27 is a way if including a single-quote
118118 # character in the sed string arguments.
119119
120+ qtPluginPrefix = "lib/qt-${qtCompatVersion}/plugins";
121+ qtQmlPrefix = "lib/qt-${qtCompatVersion}/qml";
122+ qtDocPrefix = "share/doc/qt-${qtCompatVersion}";
123+
120124 setOutputFlags = false;
121125 preConfigure = ''
122126 export LD_LIBRARY_PATH="$PWD/lib:$PWD/plugins/platforms:$LD_LIBRARY_PATH"
123127 export MAKEFLAGS=-j$NIX_BUILD_CORES
124128
125129 configureFlags+="\
126− -plugindir $out/lib/qt5/plugins \
127− -importdir $out/lib/qt5/imports \
128− -qmldir $out/lib/qt5/qml \
129− -docdir $out/share/doc/qt5"
130+ -plugindir $out/$qtPluginPrefix \
131+ -qmldir $out/$qtQmlPrefix \
132+ -docdir $out/$qtDocPrefix"
130133
131− NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/lib/qt5/plugins/platforms\""
134+ NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PREFIX=\"$qtPluginPrefix\""
135+ NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/$qtPluginPrefix/platforms\""
132136 '';
133137
134138
pkgs/development/libraries/qt-5/5.8/qtbase/nix-profiles-library-paths.patch+4−4
@@ -7,11 +7,11 @@ Index: qtbase-opensource-src-5.8.0/src/corelib/kernel/qcoreapplication.cpp
77 coreappdata()->app_libpaths.reset(app_libpaths);
88
99+ // Add library paths derived from NIX_PROFILES.
10−+ const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
11−+ const QString plugindir = QString::fromLatin1("/lib/qt5/plugins");
12−+ for (const QByteArray &profile: profiles) {
10++ const QStringList profiles = QFile::decodeName(qgetenv("NIX_PROFILES")).split(' ');
11++ const QString plugindir = QStringLiteral(NIXPKGS_QT_PLUGIN_PREFIX);
12++ for (const QString &profile: profiles) {
1313+ if (!profile.isEmpty()) {
14−+ app_libpaths->append(QFile::decodeName(profile) + plugindir);
14++ app_libpaths->append(profile + QDir::separator() + plugindir);
1515+ }
1616+ }
1717+
pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix+4
@@ -8,6 +8,10 @@ qtSubmodule {
88 qtInputs = [ qtbase qtsvg qtxmlpatterns ];
99 nativeBuildInputs = [ python2 makeQtWrapper ];
1010
11+ preConfigure = ''
12+ NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QML2_IMPORT_PREFIX=\"$qtQmlPrefix\""
13+ '';
14+
1115 postInstall = ''
1216 wrapQtProgram $out/bin/qmleasing
1317 wrapQtProgram $out/bin/qmlscene
pkgs/development/libraries/qt-5/5.8/qtdeclarative/nix-profiles-import-paths.patch+10−10
@@ -1,20 +1,20 @@
1−Index: qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
1+Index: qtdeclarative-opensource-src-5.8.0/src/qml/qml/qqmlimport.cpp
22===================================================================
3−--- qtdeclarative-opensource-src-5.5.1.orig/src/qml/qml/qqmlimport.cpp
4−+++ qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
5−@@ -1549,6 +1549,15 @@ QQmlImportDatabase::QQmlImportDatabase(Q
3+--- qtdeclarative-opensource-src-5.8.0.orig/src/qml/qml/qqmlimport.cpp
4++++ qtdeclarative-opensource-src-5.8.0/src/qml/qml/qqmlimport.cpp
5+@@ -1630,6 +1630,15 @@ QQmlImportDatabase::QQmlImportDatabase(Q
66 QString installImportsPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
77 addImportPath(installImportsPath);
88
99+ // Add library paths derived from NIX_PROFILES.
10−+ const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
11−+ const QString qmldir = QString::fromLatin1("/lib/qt5/qml");
12−+ Q_FOREACH (const QByteArray &profile, profiles) {
10++ const QStringList profiles = QFile::decodeName(qgetenv("NIX_PROFILES")).split(' ');
11++ const QString qmldir = QStringLiteral(NIXPKGS_QML2_IMPORT_PREFIX);
12++ for (const QString &profile: profiles) {
1313+ if (!profile.isEmpty()) {
14−+ addImportPath(QFile::decodeName(profile) + qmldir);
14++ addImportPath(profile + QDir::separator() + qmldir);
1515+ }
1616+ }
1717+
1818 // env import paths
19− QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
20− if (!envImportPath.isEmpty()) {
19+ if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
20+ const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
pkgs/development/libraries/qt-5/make-qt-wrapper-darwin.sh+2−5
@@ -3,7 +3,6 @@ wrapQtProgram() {
33 shift
44 wrapProgram "$prog" \
55 --set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
6− --set QML_IMPORT_PATH "$QML_IMPORT_PATH" \
76 --set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
87 --set DYLD_FRAMEWORK_PATH "/System/Library/Frameworks" \
98 --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
@@ -18,7 +17,6 @@ makeQtWrapper() {
1817 shift
1918 makeWrapper "$old" "$new" \
2019 --set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
21− --set QML_IMPORT_PATH "$QML_IMPORT_PATH" \
2220 --set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
2321 --set DYLD_FRAMEWORK_PATH "/System/Library/Frameworks" \
2422 --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
@@ -28,9 +26,8 @@ makeQtWrapper() {
2826
2927_makeQtWrapperSetup() {
3028 # cannot use addToSearchPath because these directories may not exist yet
31− export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/lib/qt5/plugins"
32− export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}${!outputLib}/lib/qt5/imports"
33− export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/lib/qt5/qml"
29+ export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/$qtPluginPrefix"
30+ export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/$qtQmlPrefix"
3431 export RUNTIME_XDG_DATA_DIRS="$RUNTIME_XDG_DATA_DIRS${RUNTIME_XDG_DATA_DIRS:+:}${!outputBin}/share"
3532 export RUNTIME_XDG_CONFIG_DIRS="$RUNTIME_XDG_CONFIG_DIRS${RUNTIME_XDG_CONFIG_DIRS:+:}${!outputBin}/etc/xdg"
3633}
pkgs/development/libraries/qt-5/make-qt-wrapper.sh+2−5
@@ -3,7 +3,6 @@ wrapQtProgram() {
33 shift
44 wrapProgram "$prog" \
55 --prefix QT_PLUGIN_PATH : "$QT_PLUGIN_PATH" \
6− --prefix QML_IMPORT_PATH : "$QML_IMPORT_PATH" \
76 --prefix QML2_IMPORT_PATH : "$QML2_IMPORT_PATH" \
87 --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
98 --prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
@@ -18,7 +17,6 @@ makeQtWrapper() {
1817 shift
1918 makeWrapper "$old" "$new" \
2019 --prefix QT_PLUGIN_PATH : "$QT_PLUGIN_PATH" \
21− --prefix QML_IMPORT_PATH : "$QML_IMPORT_PATH" \
2220 --prefix QML2_IMPORT_PATH : "$QML2_IMPORT_PATH" \
2321 --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
2422 --prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
@@ -28,9 +26,8 @@ makeQtWrapper() {
2826
2927_makeQtWrapperSetup() {
3028 # cannot use addToSearchPath because these directories may not exist yet
31− export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/lib/qt5/plugins"
32− export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}${!outputLib}/lib/qt5/imports"
33− export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/lib/qt5/qml"
29+ export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/$qtPluginPrefix"
30+ export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/$qtQmlPrefix"
3431 export RUNTIME_XDG_DATA_DIRS="$RUNTIME_XDG_DATA_DIRS${RUNTIME_XDG_DATA_DIRS:+:}${!outputBin}/share${GSETTINGS_SCHEMAS_PATH:+:$GSETTINGS_SCHEMAS_PATH}"
3532 export RUNTIME_XDG_CONFIG_DIRS="$RUNTIME_XDG_CONFIG_DIRS${RUNTIME_XDG_CONFIG_DIRS:+:}${!outputBin}/etc/xdg"
3633}
pkgs/development/libraries/qt-5/qt-env.nix+3−4
@@ -13,10 +13,9 @@ buildEnv {
1313 cat >"$out/bin/qt.conf" <<EOF
1414 [Paths]
1515 Prefix = $out
16− Plugins = lib/qt5/plugins
17− Imports = lib/qt5/imports
18− Qml2Imports = lib/qt5/qml
19− Documentation = share/doc/qt5
16+ Plugins = $qtPluginPrefix
17+ Qml2Imports = $qtQmlPrefix
18+ Documentation = $qtDocPrefix
2019 EOF
2120 '';
2221}
pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh+13−12
@@ -1,3 +1,7 @@
1+qtPluginPrefix=@qtPluginPrefix@
2+qtQmlPrefix=@qtQmlPrefix@
3+qtDocPrefix=@qtDocPrefix@
4+
15addToSearchPathOnceWithCustomDelimiter() {
26 local delim="$1"
37 local search="$2"
@@ -25,30 +29,28 @@ propagateOnce() {
2529}
2630
2731_qtPropagate() {
28− for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
32+ for dir in $qtPluginPrefix $qtQmlPrefix; do
2933 if [ -d "$1/$dir" ]; then
3034 propagateOnce propagatedBuildInputs "$1"
3135 break
3236 fi
3337 done
34− addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
35− addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
36− addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
38+ addToSearchPathOnce QT_PLUGIN_PATH "$1/$qtPluginPrefix"
39+ addToSearchPathOnce QML2_IMPORT_PATH "$1/$qtQmlPrefix"
3740}
3841
3942crossEnvHooks+=(_qtPropagate)
4043
4144_qtPropagateNative() {
42− for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
45+ for dir in $qtPluginPrefix $qtQmlPrefix; do
4346 if [ -d "$1/$dir" ]; then
4447 propagateOnce propagatedNativeBuildInputs "$1"
4548 break
4649 fi
4750 done
4851 if [ -z "$crossConfig" ]; then
49− addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
50− addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
51− addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
52+ addToSearchPathOnce QT_PLUGIN_PATH "$1/$qtPluginPrefix"
53+ addToSearchPathOnce QML2_IMPORT_PATH "$1/$qtQmlPrefix"
5254 fi
5355}
5456
@@ -112,10 +114,9 @@ if [ -z "$NIX_QT5_TMP" ]; then
112114 cat >"$NIX_QT5_TMP/bin/qt.conf" <<EOF
113115[Paths]
114116Prefix = $NIX_QT5_TMP
115−Plugins = lib/qt5/plugins
116−Imports = lib/qt5/imports
117−Qml2Imports = lib/qt5/qml
118−Documentation = share/doc/qt5
117+Plugins = $qtPluginPrefix
118+Qml2Imports = $qtQmlPrefix
119+Documentation = $qtDocPrefix
119120EOF
120121 echo "bin/qt.conf" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
121122
pkgs/development/libraries/qt-5/qtbase-setup-hook.sh+13−12
@@ -1,3 +1,7 @@
1+qtPluginPrefix=@qtPluginPrefix@
2+qtQmlPrefix=@qtQmlPrefix@
3+qtDocPrefix=@qtDocPrefix@
4+
15addToSearchPathOnceWithCustomDelimiter() {
26 local delim="$1"
37 local search="$2"
@@ -25,30 +29,28 @@ propagateOnce() {
2529}
2630
2731_qtPropagate() {
28− for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
32+ for dir in $qtPluginPrefix $qtQmlPrefix; do
2933 if [ -d "$1/$dir" ]; then
3034 propagateOnce propagatedBuildInputs "$1"
3135 break
3236 fi
3337 done
34− addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
35− addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
36− addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
38+ addToSearchPathOnce QT_PLUGIN_PATH "$1/$qtPluginPrefix"
39+ addToSearchPathOnce QML2_IMPORT_PATH "$1/$qtQmlPrefix"
3740}
3841
3942crossEnvHooks+=(_qtPropagate)
4043
4144_qtPropagateNative() {
42− for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
45+ for dir in $qtPluginPrefix $qtQmlPrefix; do
4346 if [ -d "$1/$dir" ]; then
4447 propagateOnce propagatedNativeBuildInputs "$1"
4548 break
4649 fi
4750 done
4851 if [ -z "$crossConfig" ]; then
49− addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
50− addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
51− addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
52+ addToSearchPathOnce QT_PLUGIN_PATH "$1/$qtPluginPrefix"
53+ addToSearchPathOnce QML2_IMPORT_PATH "$1/$qtQmlPrefix"
5254 fi
5355}
5456
@@ -111,10 +113,9 @@ if [ -z "$NIX_QT5_TMP" ]; then
111113 cat >"$NIX_QT5_TMP/bin/qt.conf" <<EOF
112114[Paths]
113115Prefix = $NIX_QT5_TMP
114−Plugins = lib/qt5/plugins
115−Imports = lib/qt5/imports
116−Qml2Imports = lib/qt5/qml
117−Documentation = share/doc/qt5
116+Plugins = $qtPluginPrefix
117+Qml2Imports = $qtQmlPrefix
118+Documentation = $qtDocPrefix
118119EOF
119120 echo "bin/qt.conf" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
120121
pkgs/development/libraries/qtwebkit-plugins/default.nix+1−1
@@ -16,7 +16,7 @@ stdenv.mkDerivation {
1616
1717 postPatch = ''
1818 sed -i "s,-lhunspell,-lhunspell-1.6," src/spellcheck/spellcheck.pri
19− sed -i "s,\$\$\[QT_INSTALL_PLUGINS\],$out/lib/qt5/plugins," src/src.pro
19+ sed -i "s,\$\$\[QT_INSTALL_PLUGINS\],$out/$qtPluginPrefix," src/src.pro
2020 '';
2121
2222 meta = with stdenv.lib; {
pkgs/development/qtcreator/default.nix+1−1
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
3232 installFlags = [ "INSTALL_ROOT=$(out)" ] ++ optional withDocumentation "install_docs";
3333
3434 preBuild = optional withDocumentation ''
35− ln -s ${qtbase}/share/doc $NIX_QT5_TMP/share
35+ ln -s ${qtbase}/$qtDocPrefix $NIX_QT5_TMP/share
3636 '';
3737
3838 postInstall = ''
pkgs/tools/misc/qt5ct/default.nix+1−1
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
1414 buildInputs = [ qtbase qtsvg ];
1515
1616 preConfigure = ''
17− qmakeFlags="$qmakeFlags PLUGINDIR=$out/lib/qt5/plugins"
17+ qmakeFlags="$qmakeFlags PLUGINDIR=$out/$qtPluginPrefix"
1818 '';
1919
2020 preFixup = ''