summary refs log tree commit diff
path: root/pkgs/development/libraries/qt-5/hooks/move-qt-dev-tools.sh
blob: 85489c85105bc9e62d52a42a55c6e90288cd862f (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
updateToolPath() {
    local tool="$1"
    local target="$2"
    local original="${!outputBin}/$tool"
    local actual="${!outputDev}/$tool"
    if grep -q "$original" "$target"; then
        echo "updateToolPath: Updating \`$original' in \`$target\'..."
        sed -i "$target" -e "s|$original|$actual|"
    fi
}

moveQtDevTools() {
    if [ -n "$devTools" ]; then
        for tool in $devTools; do
            moveToOutput "$tool" "${!outputDev}"
        done

        if [ -d "${!outputDev}/mkspecs" ]; then
            find "${!outputDev}/mkspecs" -name '*.pr?' | while read pr_; do
                for tool in $devTools; do
                    updateToolPath "$tool" "$pr_"
                done
            done
        fi

        if [ -d "${!outputDev}/lib/cmake" ]; then
            find "${!outputDev}/lib/cmake" -name '*.cmake' | while read cmake; do
                for tool in $devTools; do
                    updateToolPath "$tool" "$cmake"
                done
            done
        fi
    fi
}