summary refs log tree commit diff
path: root/pkgs/build-support/dotnet/dotnetbuildhelpers/remove-duplicated-dlls.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support/dotnet/dotnetbuildhelpers/remove-duplicated-dlls.sh')
-rw-r--r--pkgs/build-support/dotnet/dotnetbuildhelpers/remove-duplicated-dlls.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/pkgs/build-support/dotnet/dotnetbuildhelpers/remove-duplicated-dlls.sh b/pkgs/build-support/dotnet/dotnetbuildhelpers/remove-duplicated-dlls.sh
new file mode 100644
index 00000000000..d8d29912c8f
--- /dev/null
+++ b/pkgs/build-support/dotnet/dotnetbuildhelpers/remove-duplicated-dlls.sh
@@ -0,0 +1,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