depot/third_party/nixpkgs/pkgs/build-support/dotnetbuildhelpers/remove-duplicated-dlls.sh
Default email 8ac5e011d6 Project import generated by Copybara.
GitOrigin-RevId: 2c3273caa153ee8eb5786bc8141b85b859e7efd7
2020-04-24 19:36:52 -04:00

22 lines
573 B
Bash

#!/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