aboutsummaryrefslogtreecommitdiff
path: root/misc/remove_libraries_for_other_platforms.sh
blob: db2e33ccdfbc8ee5c6d31f696117f74d263706e8 (plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
OS=$(uname)

panic() {
	printf "%s\n" "$1"
	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
	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)
		assert_vendor
		remove_windows_libraries
		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
		;;
*)
	panic "Platform unsupported!"
esac