From 5fc54ec7e57af02af38e6f979929d4542cadbfcf Mon Sep 17 00:00:00 2001 From: Mark Naughton Date: Wed, 5 Apr 2023 11:09:31 +0100 Subject: [PATCH 1/3] Add script for removing platform-specific libs --- misc/remove_libraries_for_other_platforms.sh | 46 ++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 misc/remove_libraries_for_other_platforms.sh diff --git a/misc/remove_libraries_for_other_platforms.sh b/misc/remove_libraries_for_other_platforms.sh new file mode 100755 index 000000000..5a5286faf --- /dev/null +++ b/misc/remove_libraries_for_other_platforms.sh @@ -0,0 +1,46 @@ +#!/bin/bash +OS=$(uname) + +panic() { + printf "%s\n" "$1" + exit 1 +} + +remove_windows_libraries() { + find . -type f -name '*.dll' | xargs rm -f + find . -type f -name '*.lib' | xargs rm -f + find . -type d -name 'windows' | xargs rm -rf +} + +remove_macos_libraries() { + find . -type f -name '*.dylib' | xargs rm -f + find . -type d -name '*macos*' | xargs rm -rf +} + +remove_linux_libraries() { + find . -type f -name '*.so' | xargs rm -f + find . -type d -name 'linux' | xargs rm -rf +} + +case $OS in + Linux) + remove_windows_libraries + remove_macos_libraries + ;; + Darwin) + remove_windows_libraries + remove_linux_libraries + ;; + OpenBSD) + remove_windows_libraries + remove_macos_libraries + remove_linux_libraries + ;; + FreeBSD) + remove_windows_libraries + remove_macos_libraries + remove_linux_libraries + ;; +*) + panic "Platform unsupported!" +esac From 119cafd963fc807466ca69c0464bf05a91471f88 Mon Sep 17 00:00:00 2001 From: Mark Naughton Date: Wed, 5 Apr 2023 11:28:54 +0100 Subject: [PATCH 2/3] Add assert_vendor() sub-routine --- misc/remove_libraries_for_other_platforms.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/misc/remove_libraries_for_other_platforms.sh b/misc/remove_libraries_for_other_platforms.sh index 5a5286faf..b66deddb6 100755 --- a/misc/remove_libraries_for_other_platforms.sh +++ b/misc/remove_libraries_for_other_platforms.sh @@ -6,6 +6,12 @@ panic() { exit 1 } +assert_vendor() { + if [ $(basename $(pwd)) != 'vendor' ]; then + panic "Not in vendor directory!" + fi +} + remove_windows_libraries() { find . -type f -name '*.dll' | xargs rm -f find . -type f -name '*.lib' | xargs rm -f @@ -24,6 +30,7 @@ remove_linux_libraries() { case $OS in Linux) + assert_vendor remove_windows_libraries remove_macos_libraries ;; From 4030c5a6893f9f49c79c75a4ca05a7dc486642cb Mon Sep 17 00:00:00 2001 From: Mark Naughton Date: Wed, 5 Apr 2023 11:34:41 +0100 Subject: [PATCH 3/3] Add assert_vendor to Darwin and *BSD --- misc/remove_libraries_for_other_platforms.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/misc/remove_libraries_for_other_platforms.sh b/misc/remove_libraries_for_other_platforms.sh index b66deddb6..db2e33ccd 100755 --- a/misc/remove_libraries_for_other_platforms.sh +++ b/misc/remove_libraries_for_other_platforms.sh @@ -35,15 +35,18 @@ case $OS in remove_macos_libraries ;; Darwin) + assert_vendor remove_windows_libraries remove_linux_libraries ;; OpenBSD) + assert_vendor remove_windows_libraries remove_macos_libraries remove_linux_libraries ;; FreeBSD) + assert_vendor remove_windows_libraries remove_macos_libraries remove_linux_libraries