Skip to content

Commit

Permalink
qt5.qtbase: fix host_bins= path in pkg-config file
Browse files Browse the repository at this point in the history
So that pkg-config can be used to find 'moc' etc. (Currently it points
to a non-existing path.)

Fixes #22945 ('Linux kbuild incompatible with "nix-shell -p qt5.full"').
  • Loading branch information
bjornfor authored and ttuegel committed Mar 4, 2017
1 parent 46ba7cf commit f5d460a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkgs/development/libraries/qt-5/5.5/qtbase/default.nix
Expand Up @@ -269,6 +269,9 @@ stdenv.mkDerivation {
done
popd
fi
# fixup .pc file (where to find 'moc' etc.)
sed "s|^host_bins=.*|host_bins=$dev/bin|" -i "$dev/lib/pkgconfig/Qt5Core.pc"
'';

inherit lndir;
Expand Down
3 changes: 3 additions & 0 deletions pkgs/development/libraries/qt-5/5.6/qtbase/default.nix
Expand Up @@ -267,6 +267,9 @@ stdenv.mkDerivation {
done
popd
fi
# fixup .pc file (where to find 'moc' etc.)
sed "s|^host_bins=.*|host_bins=$dev/bin|" -i "$dev/lib/pkgconfig/Qt5Core.pc"
'' + lib.optionalString stdenv.isDarwin ''
fixDarwinDylibNames_rpath() {
local flags=()
Expand Down
23 changes: 23 additions & 0 deletions pkgs/development/libraries/qt-5/5.7/qtbase/default.nix
Expand Up @@ -228,6 +228,29 @@ stdenv.mkDerivation {
done
popd
fi
# fixup .pc file (where to find 'moc' etc.)
sed "s|^host_bins=.*|host_bins=$dev/bin|" -i "$dev/lib/pkgconfig/Qt5Core.pc"
''
# Don't move .prl files on darwin because they end up in
# "dev/lib/Foo.framework/Foo.prl" which interferes with subsequent
# use of lndir in the qtbase setup-hook. On Linux, the .prl files
# are in lib, and so do not cause a subsequent recreation of deep
# framework directory trees.
+ lib.optionalString stdenv.isDarwin ''
fixDarwinDylibNames_rpath() {
local flags=()
for fn in "$@"; do
flags+=(-change "@rpath/$fn.framework/Versions/5/$fn" "$out/lib/$fn.framework/Versions/5/$fn")
done
for fn in "$@"; do
echo "$fn: fixing dylib"
install_name_tool -id "$out/lib/$fn.framework/Versions/5/$fn" "''${flags[@]}" "$out/lib/$fn.framework/Versions/5/$fn"
done
}
fixDarwinDylibNames_rpath "QtConcurrent" "QtPrintSupport" "QtCore" "QtSql" "QtDBus" "QtTest" "QtGui" "QtWidgets" "QtNetwork" "QtXml" "QtOpenGL"
'';

inherit lndir;
Expand Down
27 changes: 26 additions & 1 deletion pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
Expand Up @@ -225,10 +225,35 @@ stdenv.mkDerivation {
done
popd
fi
# fixup .pc file (where to find 'moc' etc.)
sed "s|^host_bins=.*|host_bins=$dev/bin|" -i "$dev/lib/pkgconfig/Qt5Core.pc"
''
# Don't move .prl files on darwin because they end up in
# "dev/lib/Foo.framework/Foo.prl" which interferes with subsequent
# use of lndir in the qtbase setup-hook. On Linux, the .prl files
# are in lib, and so do not cause a subsequent recreation of deep
# framework directory trees.
+ lib.optionalString stdenv.isDarwin ''
fixDarwinDylibNames_rpath() {
local flags=()
for fn in "$@"; do
flags+=(-change "@rpath/$fn.framework/Versions/5/$fn" "$out/lib/$fn.framework/Versions/5/$fn")
done
for fn in "$@"; do
echo "$fn: fixing dylib"
install_name_tool -id "$out/lib/$fn.framework/Versions/5/$fn" "''${flags[@]}" "$out/lib/$fn.framework/Versions/5/$fn"
done
}
fixDarwinDylibNames_rpath "QtConcurrent" "QtPrintSupport" "QtCore" "QtSql" "QtDBus" "QtTest" "QtGui" "QtWidgets" "QtNetwork" "QtXml" "QtOpenGL"
'';

inherit lndir;
setupHook = ../../qtbase-setup-hook.sh;
setupHook = if stdenv.isDarwin
then ../../qtbase-setup-hook-darwin.sh
else ../../qtbase-setup-hook.sh;

enableParallelBuilding = true;

Expand Down

0 comments on commit f5d460a

Please sign in to comment.