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.
This commit is contained in:
Thomas Tuegel 2017-05-15 06:44:33 -05:00
parent 08d25152b8
commit 3f3d33a078
No known key found for this signature in database
GPG Key ID: 22CBF5249D4B4D59
30 changed files with 129 additions and 123 deletions

View File

@ -183,7 +183,6 @@ in
environment.variables = {
# Enable GTK applications to load SVG icons
GDK_PIXBUF_MODULE_FILE = "${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache";
QT_PLUGIN_PATH = "/run/current-system/sw/lib/qt5/plugins";
};
fonts.fonts = with pkgs; [ noto-fonts hack-font ];

View File

@ -53,7 +53,7 @@ let
];
preConfigure = ''
export cmakeFlags="$cmakeFlags -DQT_IMPORTS_DIR=$out/lib/qt5/qml -DCMAKE_INSTALL_SYSCONFDIR=$out/etc -DSYSTEMD_SYSTEM_UNIT_DIR=$out/lib/systemd/system"
export cmakeFlags="$cmakeFlags -DQT_IMPORTS_DIR=$out/$qtQmlPrefix -DCMAKE_INSTALL_SYSCONFDIR=$out/etc -DSYSTEMD_SYSTEM_UNIT_DIR=$out/lib/systemd/system"
'';
enableParallelBuilding = true;

View File

@ -28,7 +28,7 @@ stdenv.mkDerivation {
cp -r * "$out"
# Hack around lack of libtinfo in NixOS
ln -s ${ncurses.out}/lib/libncursesw.so.6 $out/lib/libtinfo.so.5
ln -s ${qtbase.out}/lib/qt5/plugins $out/lib/qt_plugins
ln -s ${qtbase.out}/$qtPluginPrefix $out/lib/qt_plugins
ln -s ${zlib.out}/lib/libz.so.1 $out/lib/libz.so.1
for b in fdr4 _fdr4 refines _refines cspmprofiler cspmexplorerprof

View File

@ -56,10 +56,10 @@ stdenv.mkDerivation rec {
# we need to link to our Qt deps in our own output if we want
# this package to work without being installed as a system pkg
mkdir -p $out/lib/qt5 $out/etc/xdg
mkdir -p $out/lib/qt-$qtCompatVersion $out/etc/xdg
for pkg in $qtInputs; do
if [[ -d $pkg/lib/qt5 ]]; then
for dir in lib/qt5 share etc/xdg; do
if [[ -d $pkg/lib/qt-$qtCompatVersion ]]; then
for dir in lib/qt-$qtCompatVersion share etc/xdg; do
if [[ -d $pkg/$dir ]]; then
${lndir}/bin/lndir "$pkg/$dir" "$out/$dir"
fi

View File

@ -13,7 +13,7 @@ let
--replace "DESTINATION \"\''${LXQT_ETC_XDG_DIR}" "DESTINATION \"etc/xdg" \
--replace "DESTINATION \"\''${LXQT_SHARE_DIR}" "DESTINATION \"share/lxqt" \
--replace "DESTINATION \"\''${LXQT_GRAPHICS_DIR}" "DESTINATION \"share/lxqt/graphics" \
--replace "DESTINATION \"\''${QT_PLUGINS_DIR}" "DESTINATION \"lib/qt5/plugins" \
--replace "DESTINATION \"\''${QT_PLUGINS_DIR}" "DESTINATION \"$qtPluginPrefix" \
--replace "\''${LXQT_TRANSLATIONS_DIR}" share/lxqt/translations
echo ============================
echo $file

View File

@ -14,6 +14,6 @@ plasmaPackage {
];
patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
preConfigure = ''
NIX_CFLAGS_COMPILE+=" -DNIXPKGS_LIBKSCREEN_BACKENDS=\"''${!outputLib}/lib/qt5/plugins/kf5/kscreen\""
NIX_CFLAGS_COMPILE+=" -DNIXPKGS_LIBKSCREEN_BACKENDS=\"''${!outputLib}/$qtPluginPrefix/kf5/kscreen\""
'';
}

View File

@ -34,21 +34,8 @@ in runCommand "startkde" env ''
addToSearchPath suffixPATH "$p/lib/libexec/kf5"
done
# Configure Qt search paths
QT_PLUGIN_PATH=
QML_IMPORT_PATH=
QML2_IMPORT_PATH=
for p in $libs; do
addToSearchPath QT_PLUGIN_PATH "$p/lib/qt5/plugins"
addToSearchPath QML_IMPORT_PATH "$p/lib/qt5/imports"
addToSearchPath QML2_IMPORT_PATH "$p/lib/qt5/qml"
done
substitute ${./startkde.sh} "$out" \
--subst-var shell \
--subst-var suffixPATH \
--subst-var QT_PLUGIN_PATH \
--subst-var QML_IMPORT_PATH \
--subst-var QML2_IMPORT_PATH
--subst-var suffixPATH
chmod +x "$out"
''

View File

@ -2,9 +2,7 @@
PATH="$PATH${PATH:+:}@suffixPATH@"
export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}@QT_PLUGIN_PATH@"
export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}@QML_IMPORT_PATH@"
export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}@QML2_IMPORT_PATH@"
echo "NIX_PROFILES=\"$NIX_PROFILES\""
kbuildsycoca5

View File

@ -13,10 +13,6 @@ _ecmConfig() {
cmakeFlags+=" -DKDE_INSTALL_LIBDIR=${!outputLib}/lib"
cmakeFlags+=" -DKDE_INSTALL_LIBEXECDIR=${!outputBin}/lib/libexec"
cmakeFlags+=" -DKDE_INSTALL_CMAKEPACKAGEDIR=${!outputDev}/lib/cmake"
cmakeFlags+=" -DKDE_INSTALL_QTPLUGINDIR=${!outputBin}/lib/qt5/plugins"
cmakeFlags+=" -DKDE_INSTALL_PLUGINDIR=${!outputBin}/lib/qt5/plugins"
cmakeFlags+=" -DKDE_INSTALL_QTQUICKIMPORTSDIR=${!outputBin}/lib/qt5/imports"
cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/lib/qt5/qml"
cmakeFlags+=" -DKDE_INSTALL_INCLUDEDIR=${!outputInclude}/include"
cmakeFlags+=" -DKDE_INSTALL_LOCALSTATEDIR=/var"
cmakeFlags+=" -DKDE_INSTALL_DATAROOTDIR=${!outputBin}/share"
@ -46,6 +42,15 @@ _ecmConfig() {
cmakeFlags+=" -DKDE_INSTALL_SYSCONFDIR=${!outputBin}/etc"
cmakeFlags+=" -DKDE_INSTALL_CONFDIR=${!outputBin}/etc/xdg"
cmakeFlags+=" -DKDE_INSTALL_AUTOSTARTDIR=${!outputBin}/etc/xdg/autostart"
if [ -n "$qtPluginPrefix" ]; then
cmakeFlags+=" -DKDE_INSTALL_QTPLUGINDIR=${!outputBin}/$qtPluginPrefix"
cmakeFlags+=" -DKDE_INSTALL_PLUGINDIR=${!outputBin}/$qtPluginPrefix"
fi
if [ -n "$qtQmlPrefix" ]; then
cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/$qtQmlPrefix"
fi
}
preConfigureHooks+=(_ecmConfig)

View File

@ -14,6 +14,6 @@ kdeFramework {
propagatedBuildInputs = [ qtx11extras ];
patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
preConfigure = ''
NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PATH=\"$out/lib/qt5/plugins\""
NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PATH=\"$out/$qtPluginPrefix\""
'';
}

View File

@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
patchPhase = ''
substituteInPlace qmltermwidget.pro \
--replace '$$[QT_INSTALL_QML]' "/lib/qt5/qml/"
--replace '$$[QT_INSTALL_QML]' "/$qtQmlPrefix/"
'';
installFlags = [ "INSTALL_ROOT=$(out)" ];

View File

@ -18,8 +18,9 @@ existing packages here and modify it as necessary.
1. Update the URL in `./fetch.sh`.
2. Run `./maintainers/scripts/fetch-kde-qt.sh pkgs/development/libraries/qt-5/$VERSION/`
from the top of the Nixpkgs tree.
3. Use `nox-review wip` to check that everything builds.
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.
*/
@ -38,6 +39,8 @@ with stdenv.lib;
let
qtCompatVersion = "5.6";
mirror = "http://download.qt.io";
srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; };
@ -70,7 +73,7 @@ let
addPackages = self: with self;
let
callPackage = self.newScope { inherit qtSubmodule srcs; };
callPackage = self.newScope { inherit qtCompatVersion qtSubmodule srcs; };
in {
qtbase = callPackage ./qtbase {

View File

@ -1,5 +1,5 @@
{ stdenv, lib, fetchgit, copyPathsToStore
, srcs
, srcs, qtCompatVersion
, xlibs, libX11, libxcb, libXcursor, libXext, libXrender, libXi
, xcbutil, xcbutilimage, xcbutilkeysyms, xcbutilwm, libxkbcommon
@ -32,6 +32,7 @@ stdenv.mkDerivation {
name = "qtbase-${srcs.qtbase.version}";
inherit (srcs.qtbase) src version;
inherit qtCompatVersion;
outputs = [ "out" "dev" ];
@ -94,18 +95,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\""
'';
prefixKey = "-prefix ";

View File

@ -7,11 +7,11 @@ Index: qtbase-opensource-src-5.6.2/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);
+ }
+ }
+

View File

@ -5,4 +5,8 @@ qtSubmodule {
patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
qtInputs = [ qtbase qtsvg qtxmlpatterns ];
nativeBuildInputs = [ python2 ];
preConfigure = ''
NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QML2_IMPORT_PREFIX=\"$qtQmlPrefix\""
'';
}

View File

@ -1,20 +1,20 @@
Index: qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
Index: qtdeclarative-opensource-src-5.6.2/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.6.2.orig/src/qml/qml/qqmlimport.cpp
+++ qtdeclarative-opensource-src-5.6.2/src/qml/qml/qqmlimport.cpp
@@ -1568,6 +1568,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");

View File

@ -42,10 +42,9 @@ qtSubmodule {
sed -i -e 's,/cert.pem,/certs/ca-bundle.crt,' src/3rdparty/chromium/third_party/boringssl/src/crypto/x509/x509_def.c
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"
'';
propagatedBuildInputs = [
# Image formats

View File

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

View File

@ -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\""
'';

View File

@ -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);
+ }
+ }
+

View File

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

View File

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

View File

@ -3,7 +3,6 @@ wrapQtProgram() {
shift
wrapProgram "$prog" \
--set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
--set QML_IMPORT_PATH "$QML_IMPORT_PATH" \
--set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
--set DYLD_FRAMEWORK_PATH "/System/Library/Frameworks" \
--prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
@ -18,7 +17,6 @@ makeQtWrapper() {
shift
makeWrapper "$old" "$new" \
--set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
--set QML_IMPORT_PATH "$QML_IMPORT_PATH" \
--set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
--set DYLD_FRAMEWORK_PATH "/System/Library/Frameworks" \
--prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
@ -28,9 +26,8 @@ makeQtWrapper() {
_makeQtWrapperSetup() {
# cannot use addToSearchPath because these directories may not exist yet
export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/lib/qt5/plugins"
export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}${!outputLib}/lib/qt5/imports"
export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/lib/qt5/qml"
export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/$qtPluginPrefix"
export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/$qtQmlPrefix"
export RUNTIME_XDG_DATA_DIRS="$RUNTIME_XDG_DATA_DIRS${RUNTIME_XDG_DATA_DIRS:+:}${!outputBin}/share"
export RUNTIME_XDG_CONFIG_DIRS="$RUNTIME_XDG_CONFIG_DIRS${RUNTIME_XDG_CONFIG_DIRS:+:}${!outputBin}/etc/xdg"
}

View File

@ -3,7 +3,6 @@ wrapQtProgram() {
shift
wrapProgram "$prog" \
--prefix QT_PLUGIN_PATH : "$QT_PLUGIN_PATH" \
--prefix QML_IMPORT_PATH : "$QML_IMPORT_PATH" \
--prefix QML2_IMPORT_PATH : "$QML2_IMPORT_PATH" \
--prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
--prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
@ -18,7 +17,6 @@ makeQtWrapper() {
shift
makeWrapper "$old" "$new" \
--prefix QT_PLUGIN_PATH : "$QT_PLUGIN_PATH" \
--prefix QML_IMPORT_PATH : "$QML_IMPORT_PATH" \
--prefix QML2_IMPORT_PATH : "$QML2_IMPORT_PATH" \
--prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
--prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
@ -28,9 +26,8 @@ makeQtWrapper() {
_makeQtWrapperSetup() {
# cannot use addToSearchPath because these directories may not exist yet
export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/lib/qt5/plugins"
export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}${!outputLib}/lib/qt5/imports"
export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/lib/qt5/qml"
export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/$qtPluginPrefix"
export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/$qtQmlPrefix"
export RUNTIME_XDG_DATA_DIRS="$RUNTIME_XDG_DATA_DIRS${RUNTIME_XDG_DATA_DIRS:+:}${!outputBin}/share${GSETTINGS_SCHEMAS_PATH:+:$GSETTINGS_SCHEMAS_PATH}"
export RUNTIME_XDG_CONFIG_DIRS="$RUNTIME_XDG_CONFIG_DIRS${RUNTIME_XDG_CONFIG_DIRS:+:}${!outputBin}/etc/xdg"
}

View File

@ -13,10 +13,9 @@ buildEnv {
cat >"$out/bin/qt.conf" <<EOF
[Paths]
Prefix = $out
Plugins = lib/qt5/plugins
Imports = lib/qt5/imports
Qml2Imports = lib/qt5/qml
Documentation = share/doc/qt5
Plugins = $qtPluginPrefix
Qml2Imports = $qtQmlPrefix
Documentation = $qtDocPrefix
EOF
'';
}

View File

@ -1,3 +1,7 @@
qtPluginPrefix=@qtPluginPrefix@
qtQmlPrefix=@qtQmlPrefix@
qtDocPrefix=@qtDocPrefix@
addToSearchPathOnceWithCustomDelimiter() {
local delim="$1"
local search="$2"
@ -25,30 +29,28 @@ propagateOnce() {
}
_qtPropagate() {
for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
for dir in $qtPluginPrefix $qtQmlPrefix; do
if [ -d "$1/$dir" ]; then
propagateOnce propagatedBuildInputs "$1"
break
fi
done
addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
addToSearchPathOnce QT_PLUGIN_PATH "$1/$qtPluginPrefix"
addToSearchPathOnce QML2_IMPORT_PATH "$1/$qtQmlPrefix"
}
crossEnvHooks+=(_qtPropagate)
_qtPropagateNative() {
for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
for dir in $qtPluginPrefix $qtQmlPrefix; do
if [ -d "$1/$dir" ]; then
propagateOnce propagatedNativeBuildInputs "$1"
break
fi
done
if [ -z "$crossConfig" ]; then
addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
addToSearchPathOnce QT_PLUGIN_PATH "$1/$qtPluginPrefix"
addToSearchPathOnce QML2_IMPORT_PATH "$1/$qtQmlPrefix"
fi
}
@ -112,10 +114,9 @@ if [ -z "$NIX_QT5_TMP" ]; then
cat >"$NIX_QT5_TMP/bin/qt.conf" <<EOF
[Paths]
Prefix = $NIX_QT5_TMP
Plugins = lib/qt5/plugins
Imports = lib/qt5/imports
Qml2Imports = lib/qt5/qml
Documentation = share/doc/qt5
Plugins = $qtPluginPrefix
Qml2Imports = $qtQmlPrefix
Documentation = $qtDocPrefix
EOF
echo "bin/qt.conf" >> "$NIX_QT5_TMP/nix-support/qt-inputs"

View File

@ -1,3 +1,7 @@
qtPluginPrefix=@qtPluginPrefix@
qtQmlPrefix=@qtQmlPrefix@
qtDocPrefix=@qtDocPrefix@
addToSearchPathOnceWithCustomDelimiter() {
local delim="$1"
local search="$2"
@ -25,30 +29,28 @@ propagateOnce() {
}
_qtPropagate() {
for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
for dir in $qtPluginPrefix $qtQmlPrefix; do
if [ -d "$1/$dir" ]; then
propagateOnce propagatedBuildInputs "$1"
break
fi
done
addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
addToSearchPathOnce QT_PLUGIN_PATH "$1/$qtPluginPrefix"
addToSearchPathOnce QML2_IMPORT_PATH "$1/$qtQmlPrefix"
}
crossEnvHooks+=(_qtPropagate)
_qtPropagateNative() {
for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
for dir in $qtPluginPrefix $qtQmlPrefix; do
if [ -d "$1/$dir" ]; then
propagateOnce propagatedNativeBuildInputs "$1"
break
fi
done
if [ -z "$crossConfig" ]; then
addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
addToSearchPathOnce QT_PLUGIN_PATH "$1/$qtPluginPrefix"
addToSearchPathOnce QML2_IMPORT_PATH "$1/$qtQmlPrefix"
fi
}
@ -111,10 +113,9 @@ if [ -z "$NIX_QT5_TMP" ]; then
cat >"$NIX_QT5_TMP/bin/qt.conf" <<EOF
[Paths]
Prefix = $NIX_QT5_TMP
Plugins = lib/qt5/plugins
Imports = lib/qt5/imports
Qml2Imports = lib/qt5/qml
Documentation = share/doc/qt5
Plugins = $qtPluginPrefix
Qml2Imports = $qtQmlPrefix
Documentation = $qtDocPrefix
EOF
echo "bin/qt.conf" >> "$NIX_QT5_TMP/nix-support/qt-inputs"

View File

@ -16,7 +16,7 @@ stdenv.mkDerivation {
postPatch = ''
sed -i "s,-lhunspell,-lhunspell-1.6," src/spellcheck/spellcheck.pri
sed -i "s,\$\$\[QT_INSTALL_PLUGINS\],$out/lib/qt5/plugins," src/src.pro
sed -i "s,\$\$\[QT_INSTALL_PLUGINS\],$out/$qtPluginPrefix," src/src.pro
'';
meta = with stdenv.lib; {

View File

@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
installFlags = [ "INSTALL_ROOT=$(out)" ] ++ optional withDocumentation "install_docs";
preBuild = optional withDocumentation ''
ln -s ${qtbase}/share/doc $NIX_QT5_TMP/share
ln -s ${qtbase}/$qtDocPrefix $NIX_QT5_TMP/share
'';
postInstall = ''

View File

@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
buildInputs = [ qtbase qtsvg ];
preConfigure = ''
qmakeFlags="$qmakeFlags PLUGINDIR=$out/lib/qt5/plugins"
qmakeFlags="$qmakeFlags PLUGINDIR=$out/$qtPluginPrefix"
'';
preFixup = ''