qmake: unify Darwin and Linux setup hooks

This commit is contained in:
Thomas Tuegel 2017-05-17 14:25:42 -05:00
parent 870c07cc2b
commit 1607f51613
No known key found for this signature in database
GPG Key ID: 22CBF5249D4B4D59
4 changed files with 14 additions and 51 deletions

View File

@ -151,10 +151,10 @@ let
{ deps = [ makeWrapper ]; } { deps = [ makeWrapper ]; }
(if stdenv.isDarwin then ../make-qt-wrapper-darwin.sh else ../make-qt-wrapper.sh); (if stdenv.isDarwin then ../make-qt-wrapper-darwin.sh else ../make-qt-wrapper.sh);
qmake = qmake = makeSetupHook {
makeSetupHook deps = [ self.qtbase.dev ];
{ deps = [ self.qtbase.dev ]; } substitutions = { inherit (stdenv) isDarwin; };
(if stdenv.isDarwin then ../qmake-hook-darwin.sh else ../qmake-hook.sh); } ../qmake-hook.sh;
}; };
self = makeScope newScope addPackages; self = makeScope newScope addPackages;

View File

@ -138,11 +138,11 @@ let
{ deps = [ makeWrapper ] ++ optionals (!stdenv.isDarwin) [ dconf.lib gtk3 ]; } { deps = [ makeWrapper ] ++ optionals (!stdenv.isDarwin) [ dconf.lib gtk3 ]; }
(if stdenv.isDarwin then ../make-qt-wrapper-darwin.sh else ../make-qt-wrapper.sh); (if stdenv.isDarwin then ../make-qt-wrapper-darwin.sh else ../make-qt-wrapper.sh);
qmake =
makeSetupHook
{ deps = [ self.qtbase.dev ]; }
(if stdenv.isDarwin then ../qmake-hook-darwin.sh else ../qmake-hook.sh);
qmake = makeSetupHook {
deps = [ self.qtbase.dev ];
substitutions = { inherit (stdenv) isDarwin; };
} ../qmake-hook.sh;
}; };
self = makeScope newScope addPackages; self = makeScope newScope addPackages;

View File

@ -1,42 +0,0 @@
qmakeConfigurePhase() {
runHook preConfigure
qmake PREFIX=$out $qmakeFlags
runHook postConfigure
}
if [ -z "$dontUseQmakeConfigure" -a -z "$configurePhase" ]; then
configurePhase=qmakeConfigurePhase
fi
_qtModuleMultioutDevsPre() {
# We cannot simply set these paths in configureFlags because libQtCore retains
# references to the paths it was built with.
moveToOutput "bin" "${!outputDev}"
moveToOutput "include" "${!outputDev}"
# The destination directory must exist or moveToOutput will do nothing
mkdir -p "${!outputDev}/share"
moveToOutput "share/doc" "${!outputDev}"
}
_qtModuleMultioutDevsPost() {
# Move libtool archives and qmake project files to $dev/lib
if [ "z${!outputLib}" != "z${!outputDev}" ]; then
pushd "${!outputLib}"
if [ -d "lib" ]; then
find lib \( -name '*.a' -o -name '*.la' \) -print0 | \
while read -r -d $'\0' file; do
mkdir -p "${!outputDev}/$(dirname "$file")"
mv "${!outputLib}/$file" "${!outputDev}/$file"
done
fi
popd
fi
}
if [ -n "$NIX_QT_SUBMODULE" ]; then
preFixupHooks+=(_qtModuleMultioutDevsPre)
postFixupHooks+=(_qtModuleMultioutDevsPost)
fi

View File

@ -22,11 +22,16 @@ _qtModuleMultioutDevsPre() {
} }
_qtModuleMultioutDevsPost() { _qtModuleMultioutDevsPost() {
local -a findopts=(-name '*.a' -o -name '*.la')
if [ -z "@isDarwin@" ]; then
findopts+=(-o -name '*.prl')
fi
# Move libtool archives and qmake project files to $dev/lib # Move libtool archives and qmake project files to $dev/lib
if [ "z${!outputLib}" != "z${!outputDev}" ]; then if [ "z${!outputLib}" != "z${!outputDev}" ]; then
pushd "${!outputLib}" pushd "${!outputLib}"
if [ -d "lib" ]; then if [ -d "lib" ]; then
find lib \( -name '*.a' -o -name '*.la' -o -name '*.prl' \) -print0 | \ find lib \( "${findopts[@]}" \) -print0 | \
while read -r -d $'\0' file; do while read -r -d $'\0' file; do
mkdir -p "${!outputDev}/$(dirname "$file")" mkdir -p "${!outputDev}/$(dirname "$file")"
mv "${!outputLib}/$file" "${!outputDev}/$file" mv "${!outputLib}/$file" "${!outputDev}/$file"