mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-02 07:31:26 +00:00
Merge branch 'qt-cmake-paths'
This commit is contained in:
commit
0d11f9beb5
@ -43,9 +43,13 @@ stdenv.mkDerivation rec {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp qtox $out/bin
|
cp qtox $out/bin
|
||||||
wrapQtProgram $out/bin/qtox
|
wrapQtProgram $out/bin/qtox
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
@ -17,15 +17,13 @@ stdenv.mkDerivation rec {
|
|||||||
sha256 = "1f4impsjck8anl39pwypsck7j6xw0dl18qd0b4xi23r45jvx9l60";
|
sha256 = "1f4impsjck8anl39pwypsck7j6xw0dl18qd0b4xi23r45jvx9l60";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgconfig which qmakeHook ];
|
nativeBuildInputs = [ pkgconfig which ];
|
||||||
|
|
||||||
buildInputs = [ boost libtorrentRasterbar qt5.qtbase qt5.qttools ]
|
buildInputs = [ boost libtorrentRasterbar qt5.qtbase qt5.qttools ]
|
||||||
++ optional guiSupport dbus_libs;
|
++ optional guiSupport dbus_libs;
|
||||||
|
|
||||||
dontUseQmakeConfigure = true;
|
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
export QT_QMAKE="$qtOut/bin"
|
export QT_QMAKE=$(dirname "$QMAKE")
|
||||||
'';
|
'';
|
||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
|
@ -52,6 +52,8 @@ let
|
|||||||
outputs = args.outputs or [ "dev" "out" ];
|
outputs = args.outputs or [ "dev" "out" ];
|
||||||
setOutputFlags = args.setOutputFlags or false;
|
setOutputFlags = args.setOutputFlags or false;
|
||||||
|
|
||||||
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
enableParallelBuilding = args.enableParallelBuilding or true;
|
enableParallelBuilding = args.enableParallelBuilding or true;
|
||||||
|
|
||||||
meta = self.qtbase.meta // (args.meta or {});
|
meta = self.qtbase.meta // (args.meta or {});
|
||||||
@ -111,7 +113,7 @@ let
|
|||||||
];
|
];
|
||||||
|
|
||||||
makeQtWrapper = makeSetupHook { deps = [ makeWrapper ]; } ./make-qt-wrapper.sh;
|
makeQtWrapper = makeSetupHook { deps = [ makeWrapper ]; } ./make-qt-wrapper.sh;
|
||||||
qmakeHook = makeSetupHook { substitutions = { qt_dev = qtbase.dev; lndir = pkgs.xorg.lndir; }; } ./qmake-hook.sh;
|
qmakeHook = makeSetupHook { deps = [ self.qtbase ]; } ./qmake-hook.sh;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,48 +1,14 @@
|
|||||||
if [[ -z "$QMAKE" ]]; then
|
qmakeConfigurePhase() {
|
||||||
|
runHook preConfigure
|
||||||
|
|
||||||
_qtLinkDependencyDir() {
|
qmake PREFIX=$out $qmakeFlags
|
||||||
@lndir@/bin/lndir -silent "$1/$2" "$qtOut/$2"
|
|
||||||
if [ -n "$NIX_QT_SUBMODULE" ]; then
|
runHook postConfigure
|
||||||
find "$1/$2" -printf "$2/%P\n" >> "$out/nix-support/qt-inputs"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_qtLinkModule() {
|
if [ -z "$dontUseQmakeConfigure" -a -z "$configurePhase" ]; then
|
||||||
if [ -d "$1/mkspecs" ]; then
|
configurePhase=qmakeConfigurePhase
|
||||||
# $1 is a Qt module
|
fi
|
||||||
_qtLinkDependencyDir "$1" mkspecs
|
|
||||||
|
|
||||||
for dir in bin include lib share; do
|
|
||||||
if [ -d "$1/$dir" ]; then
|
|
||||||
_qtLinkDependencyDir "$1" "$dir"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
_qtRmModules() {
|
|
||||||
cat "$out/nix-support/qt-inputs" | while read file; do
|
|
||||||
if [ -h "$out/$file" ]; then
|
|
||||||
rm "$out/$file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
cat "$out/nix-support/qt-inputs" | while read file; do
|
|
||||||
if [ -d "$out/$file" ]; then
|
|
||||||
rmdir --ignore-fail-on-non-empty -p "$out/$file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
rm "$out/nix-support/qt-inputs"
|
|
||||||
}
|
|
||||||
|
|
||||||
_qtRmQmake() {
|
|
||||||
rm "$qtOut/bin/qmake" "$qtOut/bin/qt.conf"
|
|
||||||
}
|
|
||||||
|
|
||||||
_qtSetQmakePath() {
|
|
||||||
export PATH="$qtOut/bin${PATH:+:}$PATH"
|
|
||||||
}
|
|
||||||
|
|
||||||
_qtModuleMultioutDevsPre() {
|
_qtModuleMultioutDevsPre() {
|
||||||
# We cannot simply set these paths in configureFlags because libQtCore retains
|
# We cannot simply set these paths in configureFlags because libQtCore retains
|
||||||
@ -65,63 +31,12 @@ _qtModuleMultioutDevsPost() {
|
|||||||
mkdir -p "${!outputDev}/$(dirname "$file")"
|
mkdir -p "${!outputDev}/$(dirname "$file")"
|
||||||
mv "${!outputLib}/$file" "${!outputDev}/$file"
|
mv "${!outputLib}/$file" "${!outputDev}/$file"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Ensure that CMake can find the shared libraries
|
|
||||||
mkdir -p "${!outputDev}/lib"
|
|
||||||
@lndir@/bin/lndir -silent "${!outputLib}/lib" "${!outputDev}/lib"
|
|
||||||
fi
|
fi
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_qtRmQtOut() {
|
|
||||||
rm -fr "$qtOut"
|
|
||||||
}
|
|
||||||
|
|
||||||
qmakeConfigurePhase() {
|
|
||||||
runHook preConfigure
|
|
||||||
|
|
||||||
qmake PREFIX=$out $qmakeFlags
|
|
||||||
|
|
||||||
runHook postConfigure
|
|
||||||
}
|
|
||||||
|
|
||||||
qtOut=""
|
|
||||||
if [[ -z "$NIX_QT_SUBMODULE" ]]; then
|
|
||||||
qtOut=`mktemp -d`
|
|
||||||
else
|
|
||||||
qtOut=$out
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p "$qtOut/bin" "$qtOut/mkspecs" "$qtOut/include" "$qtOut/nix-support" "$qtOut/lib" "$qtOut/share"
|
|
||||||
|
|
||||||
cp "@qt_dev@/bin/qmake" "$qtOut/bin"
|
|
||||||
cat >"$qtOut/bin/qt.conf" <<EOF
|
|
||||||
[Paths]
|
|
||||||
Prefix = $qtOut
|
|
||||||
Plugins = lib/qt5/plugins
|
|
||||||
Imports = lib/qt5/imports
|
|
||||||
Qml2Imports = lib/qt5/qml
|
|
||||||
Documentation = share/doc/qt5
|
|
||||||
EOF
|
|
||||||
|
|
||||||
export QMAKE="$qtOut/bin/qmake"
|
|
||||||
|
|
||||||
envHooks+=(_qtLinkModule)
|
|
||||||
# Set PATH to find qmake first in a preConfigure hook
|
|
||||||
# It must run after all the envHooks!
|
|
||||||
postHooks+=(_qtSetQmakePath)
|
|
||||||
|
|
||||||
if [ -z "$dontUseQmakeConfigure" -a -z "$configurePhase" ]; then
|
|
||||||
configurePhase=qmakeConfigurePhase
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$NIX_QT_SUBMODULE" ]; then
|
if [ -n "$NIX_QT_SUBMODULE" ]; then
|
||||||
postInstallHooks+=(_qtRmQmake _qtRmModules)
|
|
||||||
preFixupHooks+=(_qtModuleMultioutDevsPre)
|
preFixupHooks+=(_qtModuleMultioutDevsPre)
|
||||||
postFixupHooks+=(_qtModuleMultioutDevsPost)
|
postFixupHooks+=(_qtModuleMultioutDevsPost)
|
||||||
else
|
|
||||||
postInstallHooks+=(_qtRmQtOut)
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -253,12 +253,10 @@ stdenv.mkDerivation {
|
|||||||
mv "''${!outputLib}/$file" "''${!outputDev}/$file"
|
mv "''${!outputLib}/$file" "''${!outputDev}/$file"
|
||||||
done
|
done
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# Ensure that CMake can find the shared libraries
|
|
||||||
lndir -silent "''${!outputLib}/lib" "''${!outputDev}/lib"
|
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
inherit lndir;
|
||||||
setupHook = ./setup-hook.sh;
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
@ -50,3 +50,82 @@ if [[ -z "$NIX_QT_PIC" ]]; then
|
|||||||
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE${NIX_CFLAGS_COMPILE:+ }-fPIC"
|
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE${NIX_CFLAGS_COMPILE:+ }-fPIC"
|
||||||
export NIX_QT_PIC=1
|
export NIX_QT_PIC=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
_qtSetCMakePrefix() {
|
||||||
|
export CMAKE_PREFIX_PATH="$NIX_QT5_TMP${CMAKE_PREFIX_PATH:+:}${CMAKE_PREFIX_PATH}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_qtRmTmp() {
|
||||||
|
if [ -z "$NIX_QT_SUBMODULE" ]; then
|
||||||
|
rm -fr "$NIX_QT5_TMP"
|
||||||
|
else
|
||||||
|
cat "$NIX_QT5_TMP/nix-support/qt-inputs" | while read file; do
|
||||||
|
if [ ! -d "$NIX_QT5_TMP/$file" ]; then
|
||||||
|
rm -f "$NIX_QT5_TMP/$file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
cat "$NIX_QT5_TMP/nix-support/qt-inputs" | while read dir; do
|
||||||
|
if [ -d "$NIX_QT5_TMP/$dir" ]; then
|
||||||
|
rmdir --ignore-fail-on-non-empty -p "$NIX_QT5_TMP/$dir"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
rm "$NIX_QT5_TMP/nix-support/qt-inputs"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_qtSetQmakePath() {
|
||||||
|
export PATH="$NIX_QT5_TMP/bin${PATH:+:}$PATH"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$NIX_QT5_TMP" ]; then
|
||||||
|
if [ -z "$NIX_QT_SUBMODULE" ]; then
|
||||||
|
NIX_QT5_TMP=$(mktemp -d)
|
||||||
|
else
|
||||||
|
NIX_QT5_TMP=$out
|
||||||
|
fi
|
||||||
|
postInstallHooks+=(_qtRmTmp)
|
||||||
|
|
||||||
|
mkdir -p "$NIX_QT5_TMP/nix-support"
|
||||||
|
for subdir in bin include lib mkspecs share; do
|
||||||
|
mkdir "$NIX_QT5_TMP/$subdir"
|
||||||
|
echo "$subdir/" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
|
||||||
|
done
|
||||||
|
|
||||||
|
postHooks+=(_qtSetCMakePrefix)
|
||||||
|
|
||||||
|
cp "@dev@/bin/qmake" "$NIX_QT5_TMP/bin"
|
||||||
|
echo "bin/qmake" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
|
||||||
|
|
||||||
|
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
|
||||||
|
EOF
|
||||||
|
echo "bin/qt.conf" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
|
||||||
|
|
||||||
|
export QMAKE="$NIX_QT5_TMP/bin/qmake"
|
||||||
|
|
||||||
|
# Set PATH to find qmake first in a preConfigure hook
|
||||||
|
# It must run after all the envHooks!
|
||||||
|
postHooks+=(_qtSetQmakePath)
|
||||||
|
fi
|
||||||
|
|
||||||
|
qt5LinkModuleDir() {
|
||||||
|
if [ -d "$1/$2" ]; then
|
||||||
|
@lndir@/bin/lndir -silent "$1/$2" "$NIX_QT5_TMP/$2"
|
||||||
|
find "$1/$2" -printf "$2/%P\n" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
qt5LinkModuleDir @out@ "lib"
|
||||||
|
|
||||||
|
qt5LinkModuleDir @dev@ "bin"
|
||||||
|
qt5LinkModuleDir @dev@ "include"
|
||||||
|
qt5LinkModuleDir @dev@ "lib"
|
||||||
|
qt5LinkModuleDir @dev@ "mkspecs"
|
||||||
|
qt5LinkModuleDir @dev@ "share"
|
||||||
|
7
pkgs/development/libraries/qt-5/5.6/setup-hook.sh
Normal file
7
pkgs/development/libraries/qt-5/5.6/setup-hook.sh
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
qt5LinkModuleDir @out@ "lib"
|
||||||
|
|
||||||
|
qt5LinkModuleDir @dev@ "bin"
|
||||||
|
qt5LinkModuleDir @dev@ "include"
|
||||||
|
qt5LinkModuleDir @dev@ "lib"
|
||||||
|
qt5LinkModuleDir @dev@ "mkspecs"
|
||||||
|
qt5LinkModuleDir @dev@ "share"
|
Loading…
Reference in New Issue
Block a user