about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/qt-6/hooks/qmake-hook.sh
blob: 130e8290a3feb8d7dfbd0e1ddb9180931ce0049d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
. @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[@]}")
}
prePhases+=" qmakePrePhase"

qmakeConfigurePhase() {
    runHook preConfigure

    echo "QMAKEPATH=$QMAKEPATH"
    echo qmake "${qmakeFlags[@]}"
    qmake "${qmakeFlags[@]}"

    if ! [[ -v enableParallelBuilding ]]; then
        enableParallelBuilding=1
        echo "qmake: enabled parallel building"
    fi

    if ! [[ -v enableParallelInstalling ]]; then
        enableParallelInstalling=1
        echo "qmake: enabled parallel installing"
    fi

    runHook postConfigure
}

if [ -z "${dontUseQmakeConfigure-}" -a -z "${configurePhase-}" ]; then
    configurePhase=qmakeConfigurePhase
fi