summary refs log tree commit diff
path: root/pkgs/build-support/dotnetbuildhelpers/remove-duplicated-dlls.sh
blob: d8d29912c8fa11b7b4db505d2e887a8235d377cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env bash

IFS="
"

for dll in $(find -iname \*.dll)
do
    baseName="$(basename "$dll" | sed "s/.dll$//i")"
    if pkg-config "$baseName"
    then
        candidateDll="$(pkg-config "$baseName" --variable=Libraries)"

        if diff "$dll" "$candidateDll" >/dev/null
        then
            echo "$dll is identical to $candidateDll. Substituting..."
            rm -vf "$dll"
            ln -sv "$candidateDll" "$dll"
        else
            echo "$dll and $candidateDll share the same name but have different contents, leaving alone."
        fi
    fi
done