From 1bcca7d66b0a052b703d029c4593434b84136455 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Wed, 12 Jun 2024 18:31:45 +0200 Subject: [PATCH] qt: support structuredAttrs in qmake hook Tested qbs with and without __structuredAttrs. --- .../libraries/qt-5/hooks/qmake-hook.sh | 36 +++++++++---------- .../qt-5/hooks/qttools-setup-hook.sh | 2 +- .../libraries/qt-6/hooks/qmake-hook.sh | 28 +++++++-------- 3 files changed, 29 insertions(+), 37 deletions(-) diff --git a/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh b/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh index 56607df6b4b9..f52de4e51df2 100644 --- a/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh +++ b/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh @@ -1,40 +1,36 @@ . @fix_qmake_libtool@ -qmakeFlags=( ${qmakeFlags-} ) - qmakePrePhase() { - qmakeFlags_orig=( "${qmakeFlags[@]}" ) - # These flags must be added _before_ the flags specified in the derivation. - qmakeFlags=( \ - "PREFIX=$out" \ - "NIX_OUTPUT_OUT=$out" \ - "NIX_OUTPUT_DEV=${!outputDev}" \ - "NIX_OUTPUT_BIN=${!outputBin}" \ - "NIX_OUTPUT_DOC=${!outputDev}/${qtDocPrefix:?}" \ - "NIX_OUTPUT_QML=${!outputBin}/${qtQmlPrefix:?}" \ - "NIX_OUTPUT_PLUGIN=${!outputBin}/${qtPluginPrefix:?}" \ - ) + prependToVar qmakeFlags \ + "PREFIX=$out" \ + "NIX_OUTPUT_OUT=$out" \ + "NIX_OUTPUT_DEV=${!outputDev}" \ + "NIX_OUTPUT_BIN=${!outputBin}" \ + "NIX_OUTPUT_DOC=${!outputDev}/${qtDocPrefix:?}" \ + "NIX_OUTPUT_QML=${!outputBin}/${qtQmlPrefix:?}" \ + "NIX_OUTPUT_PLUGIN=${!outputBin}/${qtPluginPrefix:?}" if [ -n "@debug@" ]; then - qmakeFlags+=( "CONFIG+=debug" ) + prependToVar qmakeFlags "CONFIG+=debug" else - qmakeFlags+=( "CONFIG+=release" ) + prependToVar qmakeFlags "CONFIG+=release" fi # do the stripping ourselves (needed for separateDebugInfo) - qmakeFlags+=( "CONFIG+=nostrip" ) - - qmakeFlags+=( "${qmakeFlags_orig[@]}" ) + prependToVar qmakeFlags "CONFIG+=nostrip" } prePhases+=" qmakePrePhase" qmakeConfigurePhase() { runHook preConfigure + local flagsArray=() + concatTo flagsArray qmakeFlags + echo "QMAKEPATH=$QMAKEPATH" - echo qmake "${qmakeFlags[@]}" - qmake "${qmakeFlags[@]}" + echo qmake "${flagsArray[@]}" + qmake "${flagsArray[@]}" if ! [[ -v enableParallelBuilding ]]; then enableParallelBuilding=1 diff --git a/pkgs/development/libraries/qt-5/hooks/qttools-setup-hook.sh b/pkgs/development/libraries/qt-5/hooks/qttools-setup-hook.sh index c320a7974471..099c0879ed39 100644 --- a/pkgs/development/libraries/qt-5/hooks/qttools-setup-hook.sh +++ b/pkgs/development/libraries/qt-5/hooks/qttools-setup-hook.sh @@ -1 +1 @@ -qmakeFlags+=( "QMAKE_LRELEASE=@dev@/bin/lrelease" ) +appendToVar qmakeFlags "QMAKE_LRELEASE=@dev@/bin/lrelease" diff --git a/pkgs/development/libraries/qt-6/hooks/qmake-hook.sh b/pkgs/development/libraries/qt-6/hooks/qmake-hook.sh index 130e8290a3fe..84b2fb153d9f 100644 --- a/pkgs/development/libraries/qt-6/hooks/qmake-hook.sh +++ b/pkgs/development/libraries/qt-6/hooks/qmake-hook.sh @@ -1,33 +1,29 @@ . @fix_qmake_libtool@ -qmakeFlags=(${qmakeFlags-}) - qmakePrePhase() { - qmakeFlags_orig=("${qmakeFlags[@]}") - # These flags must be added _before_ the flags specified in the derivation. # TODO: these flags also need a patch which isn't applied # can we either remove these flags or update the qt5 patch? # "NIX_OUTPUT_DOC=${!outputDev}/${qtDocPrefix:?}" \ - qmakeFlags=( - "PREFIX=$out" - "NIX_OUTPUT_OUT=$out" - "NIX_OUTPUT_DEV=${!outputDev}" - "NIX_OUTPUT_BIN=${!outputBin}" - "NIX_OUTPUT_QML=${!outputBin}/${qtQmlPrefix:?}" - "NIX_OUTPUT_PLUGIN=${!outputBin}/${qtPluginPrefix:?}" - ) - - qmakeFlags+=("${qmakeFlags_orig[@]}") + prependToVar qmakeFlags \ + "PREFIX=$out" \ + "NIX_OUTPUT_OUT=$out" \ + "NIX_OUTPUT_DEV=${!outputDev}" \ + "NIX_OUTPUT_BIN=${!outputBin}" \ + "NIX_OUTPUT_QML=${!outputBin}/${qtQmlPrefix:?}" \ + "NIX_OUTPUT_PLUGIN=${!outputBin}/${qtPluginPrefix:?}" } prePhases+=" qmakePrePhase" qmakeConfigurePhase() { runHook preConfigure + local flagsArray=() + concatTo flagsArray qmakeFlags + echo "QMAKEPATH=$QMAKEPATH" - echo qmake "${qmakeFlags[@]}" - qmake "${qmakeFlags[@]}" + echo qmake "${flagsArray[@]}" + qmake "${flagsArray[@]}" if ! [[ -v enableParallelBuilding ]]; then enableParallelBuilding=1