summary refs log tree commit diff
path: root/pkgs/development/libraries/qt-5/qmake-hook.sh
blob: c70410975ecddfb454c20fbffbb8c11a5312f5d3 (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
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() {
    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
    if [ "z${!outputLib}" != "z${!outputDev}" ]; then
        pushd "${!outputLib}"
        if [ -d "lib" ]; then
            find lib \( "${findopts[@]}" \) -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